hi
i need to read from a serial port (c programming)
we use a sixnet Mini-VersaTRAK mIPm
under bash: ~ # stty -a
hi
i need to read from a serial port (c programming)
we use a sixnet Mini-VersaTRAK mIPm
under bash: ~ # stty -a
O_NDELAY is on my man page for open(2):
O_NONBLOCK or O_NDELAY When possible, the file is opened in non-blocking mode. Neither the open nor any subsequent operations on the file descriptor which is returned will cause the calling process to wait. For the handling of FIFOs (named pipes), see also fifo(4). This mode need not have any effect on files other than FIFOs.
It's the commonly accepted way to open a serial port when you don't want the open() to block waiting for carrier detect.
Setting the FNDELAY flag is then the way you set the file descripter back to blocking mode after you've set the CLOCAL bit in the termios struct to tell it to ignore carrier detect.
ledisplay);
^^^^^^^ That should be O_NDELAY-------------------------^^^^^^^
ledisplay);
If you're not going to set CLOCAL before setting FNDELAY, then you might as well just do the open without O_NDELAY and skip the fcntl() call. The same comment applies to the writeopen() function above.
descriptor\n",fd1);
I am not familiar with the FNDELAY and O_NDELAY options to open. They are not standard Linux.
Ian
Have something to add? Share your thoughts — no account required.
Ask the community — no account required