On 18/08/11 12:00, Armin Diehl wrote:
Hi Marco,minicom calls open with O_NONBLOCK and resets O_NONBLOCK directly after the open call: open("/dev/ttyUSB0", O_RDWR|O_NOCTTY|O_NONBLOCK) = 3 fcntl(3, F_GETFL) = 0x8802 (flags O_RDWR|O_NONBLOCK|O_LARGEFILE) fcntl(3, F_SETFL, O_RDWR|O_LARGEFILE) = 0 doing the same in serial.pp should not change the blocking behaviour of serial.pp. function SerOpen(const DeviceName: String): TSerialHandle; begin Result := fpopen(DeviceName, O_RDWR or O_NOCTTY or O_NONBLOCK); // AD: O_NONBLOCK was missing if result > -1 then fpfcntl(Result,F_SETFL,O_RDWR or O_NOCTTY); //AD: non blocking off again
Better use F_GETFL first, then flags &= ~O_NONBLOCK, like minicom does. Henry _______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-devel
