Re: Warning, cua2 opened, ...

Gert Doering (gert@greenie.muc.de)
Mon, 16 Mar 1998 00:58:46 +0100 (MET)


Hi,

Alan Cox wrote:
> > >It doesnt however seem to guarantee they wont get hung up on instantly
> > >before they can issue a tcsetattr() ?
> > IIRC, the hangup is only generated on a DCD *drop*, not on DCD being
> > already low.
>
> Thats fine. If you are using a serial port which has a remote adapter that
> is running on a high speed RS485 network where DCD is raised and lowered
> as packets go past

Huh? Strange device...

> perhaps you'd care to tell me how to handle it without
> /dev/cua devices - and portably.

struct termios termios;
int fd;

fd = open( "/dev/ttyS0", O_RDWR | O_NDELAY );
tcgetattr( fd, &termios );
termio.c_cflag |= CLOCAL;
tcsetattr( fd, TCSANOW, &termios);
fcntl( fd, F_SETFL, O_RDWR );

/* work with non-blocking, non-carrier-sensitive file descriptor */

Alternatively, you could play with TIOCSSOFTCAR ("soft carrier"), though I
don't know off my head whether that's a SunOS invention or also present in
Linux.

gert

-- 
USENET is *not* the non-clickable part of WWW!
                                                           //www.muc.de/~gert/
Gert Doering - Munich, Germany                             gert@greenie.muc.de
fax: +49-89-35655025                        gert.doering@physik.tu-muenchen.de

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu