1
votes

I want to know whether Linux kernel device driver of serial port device, e.g. /dev/tty1, /dev/tty2, support poll() operation? Or tell me where is the kernel source code of serial port device?

In my case, some sensors will send data to ARM CPU via serial port each second. And I think one way is to use a timer for periodically read from the serial port. Another way should use poll(), read it when data is ready.

1
select() definitely works to block until data is ready on a serial device. - Charles Duffy
An alternative is to use threads: one reads, one write. - RTLinuxSW
simple answer: YES :-) - Klaus

1 Answers

3
votes

Unless your serial port is a special case, using poll() or select() would seamlessly work.

If your serial port was controlled via USB, you would have to take care about what happens if the USB to serial is disconnected, but this does not seem to be the case for you.