Problem to read on a serial port

hi

i need to read from a serial port (c programming)

we use a sixnet Mini-VersaTRAK mIPm

formatting link

under bash: ~ # stty -a

Reply to
collinm
Loading thread data ...

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.

--
Grant Edwards                   grante             Yow!  World War III? No
                                  at               thanks!
                               visi.com
Reply to
Grant Edwards

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);

--
Grant Edwards                   grante             Yow!  Clear the
                                  at               laundromat!! This
                               visi.com            whirl-o-matic just had a
                                                   nuclear meltdown!!
Reply to
Grant Edwards

I am not familiar with the FNDELAY and O_NDELAY options to open. They are not standard Linux.

Ian

--
Ian Bell
Reply to
Ian Bell

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.