[fpc-pascal] Serial unit for Linux and Windows

Stephano patspiper at yahoo.com
Thu Apr 10 01:11:25 CEST 2008


I am planning to improve, if possible, the serial units for both Linux 
and Windows, but have a few questions before I proceed any further:

1- I guess the unit rtl\win\wininc\struct.inc has 2 bugs:
	a- bm_DCB_fRtsControl = $3000. It should be $2000.
	b- bm_DCB_fDtrControl = $30. It should be $20.
    Can anybody confirm this?

2- I will define TSerialFlags = set of (XOnXOffFlowControl, 
RtsCtsFlowControl);
What flags do we have to set in Linux to have XOnXOff handshaking? The 
number of parameters in tios is mind boggling.

3- The Linux SerOpen function (based on fpopen) claims to return 0 if 
the device could not be found. Shouldn't it be -1?

4- Windows SerOpen function (based on CreateFile) returns an 
INVALID_HANDLE_VALUE if the device could not be found. How to unify for 
both Linux & Windows? Is it safe to return instead -1 (as in the Linux 
case)?

5- Is it OK to designate serial ports by COMx fow Windows and /dev/ttySx 
for Linux?

6- Is it OK for TSerialState to include DCB for Windows and tios for Linux?

My guess for questions 5 and 6 is yes.

Any input is appreciated.

Stephano



More information about the fpc-pascal mailing list