clinuxserial-port

RS232 Serial Pin Read in C in Linux


Ist there any possibility to read values from the pins of the COM Port? Any solution in C under Linux is appreciated!


Solution

  • Yes, see for instance this guide.

    You use the ioctl() function, to read the various control pins. Data is, of course, best read through the normal read() handling, you don't want to be polling asynchronuous serial data.

    I don't think your assumption (expressed in a comment) that the driver must check the pin-states to handle data is correct, normally a serial port is "backed" by an UART and that typically handles the RX/TX pins in hardware.