You would think that a cross-platform C library for serial ports is something that would have existed for 20 years already, but as of 2013 there still wasn't one, so I created libserialport.
It is tested on Windows, Mac OS X, Linux (including Android), BSD and will probably build on other Unix systems also. It supports:
- Port enumeration (obtaining a list of serial ports on the system)
- Opening, closing and querying ports
- Setting port parameters (baud rate, parity, etc.)
- Port signalling operations (modem control lines, breaks, etc.)
- Reading, writing, and flushing data
- Waiting for events
- Obtaining error information
The initial 0.1.0 release is in active use by the Sigrok project for supporting serial hardware and is packaged in several Linux distributions already. The git version also includes new API calls for getting information about USB serial adapters (VID/PID etc).