I'm no expert of Linux or serial programming, and my understanding of Linux serial port communication is: the system links certain /dev/ttyS* file to a certain physical serial port, then the system or other procedures can talk with any device that is attached to that serial port via the /dev/ttyS* file. And the /dev/ttyS* file would be assigned/linked to the serial port no matter there's any device attached.
If I'm correct about this, then is there any way, in C, that I can get all such /dev/ttyS* files which are linked to physical serial ports?
Have already searched all over Google and SO, nothing really helpful found, plz halp!
PS, I can find such files by using:
dmesg | grep ttyS
but I need a more precise way to get these info, things like libudev can do this ??