[Lazarus] How to list available serial ports on Linux?
bo.berglund at gmail.com
Tue Oct 6 23:35:08 CEST 2020
Is there a way to list the available (working) serial ports on a Linux
platform like the RaspberryPi?
I would like to offer a dropdown list of working serial ports to the
user to select among, but I am dissuaded from it when I do the
ls -la /dev/tty*
It returns a very long list of serial devices and most of these are
probably not even existing in real life.
On an RPi I get
/dev/ttyN (where N=0..63
/dev/ttyAMA0 <== This is RPi Serial0 port on the pin header.
/dev/ttyUSB0../dev/ttyUSB3 depending on what is plugged into USB
All in all about 70 devices, but not sure which are actually available
Is this an impossible task or can one check for "live" serial ports
only? If so how?
On Windows I have ported a convoluted function from Delphi, which uses
Registry reads to give me the list.
Developer in Sweden
More information about the lazarus