[Lazarus] Using 5dpo for serial comm...

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Fri Oct 8 09:29:47 CEST 2010


Bo Berglund wrote:

> I installed gtkterm and used that for initial testing with the
> loopback connector. I found that while I had been using ttyS0 all
> along, the working port is ttyS1!
> 
> After that I got my test application working too, both using the
> loopback connector and with a connection to Hyperterminal on my
> Windows host.
> 
> So far just functional tests, but next I will start up a serious comm
> unit and start checking out the capabilities of the comm component.
> 
> Thanks for the tips and suggestions!
> 
> A question concerning gtkterm:
> I cannot find any command to open/close the port. How is that done?
> Do I have to shut down the program to release the port?

[Checks] You don't, the designated port is open as long as the program 
is running. However you need to distinguish between "open", "in use" and 
"locked": there is a convention that when a program wants to claim usage 
of a port it writes a file containing its PID:

# ls -l /var/lock
total 12
-rw-r--r--    1 root     root           11 Aug 16 17:02 LCK..ttyS11
-rw-r--r--    1 root     root           11 Oct  2 14:38 LCK..ttyS6
drwxr-xr-x    2 root     root         4096 Mar 16  2010 subsys

There are times when having multiple programs looking at a port can be 
extremely useful, for example gettys tend to work like that. However 
managing these PID files reliably can be a lot of effort.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list