[Lazarus] How to list available serial orts on Ubuuntu?
Wayne Sherman
wsherman at gmail.com
Mon Nov 28 18:20:44 CET 2022
> My solution has been to scan all possible port names, such
> as /dev/ttyS*, dev/ttyUSB*, /dev/ttyXR*, etc. and then attempt
> to open each one by using SerOpen (in Serial.pp from fpcsrc- add
> "Serial" the Uses clause) If successful the port exists, and I add
> it to my list, if not, it doesn't exist.
If the port is in use (already open in another process), you will get
a SerOpen error and incorrectly exclude that port.
Some other ways to find Linux serial ports are discussed here:
https://stackoverflow.com/questions/2530096/how-to-find-all-serial-devices-ttys-ttyusb-on-linux-without-opening-them
More information about the lazarus
mailing list