[fpc-devel] serial under linux, SerOpen blocks

Mark Morgan Lloyd markMLl.fpc-devel at telemetry.co.uk
Thu Aug 18 15:11:23 CEST 2011


Armin Diehl wrote:
> yes, that is better
> 
> function SerOpen(const DeviceName: String): TSerialHandle;
> var
>   flags : cint;
> begin
>   Result := fpopen(DeviceName, O_RDWR or O_NOCTTY or O_NONBLOCK);
>   if result > -1 then
>   begin
>     flags := fpfcntl(Result,F_GetFl);
>     fpfcntl(Result,F_SETFL,flags and (not O_NONBLOCK));
>   end;
> end;
> 
> results in
> open("/dev/ttyUSB0", O_RDWR|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = 10
> fcntl(10, F_GETFL)                      = 0x8802 (flags 
> O_RDWR|O_NONBLOCK|O_LARGEFILE)
> fcntl(10, F_SETFL, O_RDWR|O_LARGEFILE)  = 0
> 
> 
> i think this should be changed in serial.pp

But why have I not seen this problem on Debian despite having used this 
unit extensively? And why have I not seen it when testing the modified 
unit on Solaris with the SerOpen() function being unchanged?

-- 
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 fpc-devel mailing list