Bo Berglund wrote:

It looks like the  serial.pp unit implements a blocking system even though
it is not clearly written as such. But the synaser unit is definitely
blocking.

But the serial does allow you access to the handle, so it's trivial to use select() (actually fpSelect()) to implement the timeout.

1) Is serial communication with events not possible in FPC on Linux?

I'd comment at this point that some Windows programmers are excessively oriented towards events and messages (in my opinion) since that's about all that was available pre-NT.

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?

I agree with what other people have said about threads etc. but on occasion they're needless complexity. For example if all you're doing is handling a simple state machine polling (which looks at the OS buffer rather than the hardware itself) is frequently adequate.

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?

As other people have said, this is messy. I find myself looking for ttyS, ttyU and ttyI, making an arbitrary decision as to how many of each could reasonably be installed, and then tentatively opening each to see whether I've got access. It gets worse if you want to lock them (i.e. one program at a time gets access).

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

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

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to