[Lazarus] Getting rid of bogus form

Bo Berglund bo.berglund at gmail.com
Wed Sep 29 00:27:18 CEST 2010


> > Since I am used to having event driven serial communication 
> my question
> > is really twofold:
> > 
> > 1) Is serial communication with events not possible in FPC on Linux?
> > 
> > 2) How can one use blocking reads when there is no way to 
> know exactly when
> > data will arrive? Everything else will stop when waiting 
> for data, right?
> 
> Synapse works very well for Tcp and serial comms. Use threads to wait 
> for the data. It also supplies an event on data rx'd which 
> you can use 
> to call yourself when necessary

OK, I have to dive into the thread handling on Linux then I assume....
I have next to no exposure to Linux so far.
 
> > 3) How can one enumerate the existing com ports on Linux? 
> In Windows I know
> > how to do this and thus I can get a list of valid ports for 
> the user to 
> > select from. Is there some way also in Linux using FPC?
> > 
> 
> Quickest way I have found is to enumerate the device files in /dev 
> extracting all 'ttyxx' (comports) and 'ttyU' (usb ports). 
> This gives a 
> list of 'probables'. Then try to connect (using SynaSer for 
> example) to 
> verify actual usable ports in the list

On my Ubuntu 10 virtual machine I get this result from ls /dev/t*:

/dev/tty    /dev/tty19  /dev/tty3   /dev/tty40  /dev/tty51  /dev/tty62
/dev/tty0   /dev/tty2   /dev/tty30  /dev/tty41  /dev/tty52  /dev/tty63
/dev/tty1   /dev/tty20  /dev/tty31  /dev/tty42  /dev/tty53  /dev/tty7
/dev/tty10  /dev/tty21  /dev/tty32  /dev/tty43  /dev/tty54  /dev/tty8
/dev/tty11  /dev/tty22  /dev/tty33  /dev/tty44  /dev/tty55  /dev/tty9
/dev/tty12  /dev/tty23  /dev/tty34  /dev/tty45  /dev/tty56  /dev/ttyS0
/dev/tty13  /dev/tty24  /dev/tty35  /dev/tty46  /dev/tty57  /dev/ttyS1
/dev/tty14  /dev/tty25  /dev/tty36  /dev/tty47  /dev/tty58  /dev/ttyS2
/dev/tty15  /dev/tty26  /dev/tty37  /dev/tty48  /dev/tty59  /dev/ttyS3
/dev/tty16  /dev/tty27  /dev/tty38  /dev/tty49  /dev/tty6
/dev/tty17  /dev/tty28  /dev/tty39  /dev/tty5   /dev/tty60
/dev/tty18  /dev/tty29  /dev/tty4   /dev/tty50  /dev/tty61

I am absolutely certain there there is a maximum of 2 com ports avilable 
to my virtual machine so where did all of the others come from?

Looks a bit hard to go around opening all these ports to check if
they exist....


--
Bo B





More information about the Lazarus mailing list