[fpc-devel] serial under linux, SerOpen blocks

Armin Diehl ad at ardiehl.de
Fri Aug 19 09:29:32 CEST 2011


there must be a reason why minicom uses O_NDELAY (=O_NONBLOCK) in case 
O_NDELAY ist defined. Now i remember that i had the same problem several 
years ago with cat file >/dev/ttyUSB0, i think it was Fedora Core 3 or 4.
I assume this does not only happen with a pl2303.

#if defined(O_NDELAY) && defined(F_SETFL)
       portfd = open(dial_tty, O_RDWR|O_NDELAY|O_NOCTTY);
       if (portfd >= 0) {
         /* Cancel the O_NDELAY flag. */
         n = fcntl(portfd, F_GETFL, 0);
         fcntl(portfd, F_SETFL, n & ~O_NDELAY);
       }
#else
       if (portfd < 0)
         portfd = open(dial_tty, O_RDWR|O_NOCTTY);
#endif


On 08/18/2011 06:49 PM, Mark Morgan Lloyd wrote:
> Ludo Brands wrote:
>>>> Some serial ports seem to have clocal unset, for some reason, which
>>>> causes it to block on open (waiting for the modem status 
>>> lines).  Like
>>>> you, I've never seen it with any of my serial ports, either.
>>> Might have to do with the defaulting to autobaud of some usbserial 
>>> chips. _______________________________________________
>>
>>
>> Apparently a bug in a recent usb serial kernel module pl2303:
>>
>> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/661321
>
> Well spotted :-)  I was going to speculate that it might be something 
> to do with the Prolific driver- I think that the device I use most is 
> FTDI.
>




More information about the fpc-devel mailing list