Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-12 Thread Stephano
Tomas Hajny wrote: Do I understand correctly that you cannot find it? As I wrote above, this constant is defined in unit System, i.e. always available without any additions to the uses clause or so. I was just too lazy to launch Lazarus/FPC and look for it when I replied. As you mention, it is r

Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Tomas Hajny
On Fri, April 11, 2008 22:12, Stephano wrote: > Tomas Hajny wrote: >> If I read the Windows unit sources correctly, INVALID_HANDLE_VALUE = -1 >> too. However, I believe that you might consider returning UnusedHandle >> constant defined in System unit for all the platforms (that's -1 for at >> least

Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Stephano
Koenraad Lelong wrote: 5- Is it OK to designate serial ports by COMx fow Windows and /dev/ttySx for Linux? FWIW, I have a USB to serial converter. It shows as /dev/ttyUSB0. I see now how I did not express myself clearly: I meant that I did not intend to change the way devices are specified. Un

Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Koenraad Lelong
Stephano schreef: > 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: > ... > 5- Is it OK to designate serial ports by COMx fow Windows and /dev/ttySx > for Linux? FWIW, I have a USB to serial converter. It

Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Stephano
Marco van de Voort wrote: No, they are correct. If you look into the headers you'll see: DWORD DCBlength; /* sizeof(DCB) */ DWORD BaudRate; /* Baudrate at which running */ DWORD fBinary: 1; /* Binary Mode (skip EOF check)*/ DWORD fParity:

Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Stephano
Tomas Hajny wrote: If I read the Windows unit sources correctly, INVALID_HANDLE_VALUE = -1 too. However, I believe that you might consider returning UnusedHandle constant defined in System unit for all the platforms (that's -1 for at least most of them anyway, but I believe that it may be still b

Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Jeff Wormsley
Marco van de Voort wrote: 5- Is it OK to designate serial ports by COMx fow Windows and /dev/ttySx for Linux? No, since e.g a serial port on some other device might have a different state. And strictly, this is even possible for Windows. Always keep naming configurable and

Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-11 Thread Marco van de Voort
> 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 = $

Re: [fpc-pascal] Serial unit for Linux and Windows

2008-04-09 Thread Tomas Hajny
On Thu, April 10, 2008 01:11, Stephano wrote: . . > 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)? . . If I read the Windows

[fpc-pascal] Serial unit for Linux and Windows

2008-04-09 Thread Stephano
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