On Sat, 27 Nov 2010 08:12:53 -0600, Paul Breneman <[email protected]> wrote:
>Bo Berglund wrote: >> Is there a way that one can use to list the actual serial ports >> available on a system that will work on both Windows and Linux? >> That is, is there a class/method or such already coded to give me a >> list of com ports when called? >> >> The com ports are differently named in Windows and Linux, but it >> should be possible to get a list of ports actually available. >> But not using a listing of dev with ttys in the name, because I have >> found that in my test Linux systems there are always 4 of these even >> though there is only hardware for a single port... >> > >I haven't found a very good way for Linux. I modified the SynaSer Linux >code for the GetSerialPortNames function in the code on this page: > http://www.turbocontrol.com/simpleserial.htm > >Here is what I scan on Linux: > ScanForPorts( '/dev/ttyS*'); > ScanForPorts( '/dev/ttyUSB*'); > ScanForPorts( '/dev/ttyAM*'); // for ARM board Are com ports on ARM based embedded Linux named 'ttyAM1', 'ttyAM2' etc? And how is the found "file" /dev/ttyS* verified as a real port? I have found that on UBUNTU Linux there are always 4 such "files" even though only one port actually exists. /dev/ttyS1 /dev/ttyS2 /dev/ttyS3 /dev/ttyS4 (or possibly 0-1-2-3, can't remember right now) Anyway I did get no communication at all using /dev/ttyS1, but when I switched to /dev/ttyS2 I could get a connection to a program on Windows. Mind you it was even possible to open the non-existing port.... Strange... -- Bo Berglund Developer in Sweden -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
