[fpc-pascal] How to detect serial/usb-serial ports.

Fabio Luis Girardi fluisgirardi at gmail.com
Wed Jul 27 12:39:08 CEST 2011


Wich OS?

If Windows, you can use the function BuildCommDCB, and pass the
following string as param:

COMx: baud=1200 parity=N data=8 stop=1

if COMx exists on your system, this function will return true.

See:

http://msdn.microsoft.com/en-us/library/aa363143(v=vs.85).aspx

On linux, i don't found any other way than check if exists /dev/ttyUSBx devices.

Regards,

Fabio

2011/7/27 John Lee <johnelee0 at gmail.com>:
> I use the synaser unit - works for fpc 2.4, win and I think for other o/s
> too - google for info - it has the capability to look for serial ports, set
> baud rates, and to do character & block input & output.
> hth John
>
> On 27 July 2011 09:22, P. vanderWal <p.wal1 at quicknet.nl> wrote:
>>
>> Hello,
>>
>> In my program I need to present the user with a list of available serial
>> and usb-serial ports on the system they are using.
>> How do I detect in my program these ports?.  (something like GetPortList()
>> in Delphi-7???).
>>
>> One port is used by a milling-machine to receive its position and speed
>> commands, the other port is used by a controller for switching the machine
>> automaticaly on/off
>> and start or end of the milling and measure and detect the roughness of
>> the surface area of the material to be processed.
>>
>> Thanks in advance,
>>
>> grtjs Piet
>> _______________________________________________
>> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
>
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>



More information about the fpc-pascal mailing list