Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!rutgers!sri-spam!mordor!lll-tis!ptsfa!ihnp4!cbosgd!cwruecmp!hal!ncoast!allbery From: allbery@ncoast.UUCP (Brandon Allbery) Newsgroups: comp.bugs.sys5 Subject: Re: CLOCAL, or catch-22 Message-ID: <4127@ncoast.UUCP> Date: Wed, 12-Aug-87 21:01:25 EDT Article-I.D.: ncoast.4127 Posted: Wed Aug 12 21:01:25 1987 Date-Received: Sat, 15-Aug-87 08:25:33 EDT References: <325@nsta.UUCP> Reply-To: allbery@ncoast.UUCP (Brandon Allbery) Followup-To: comp.bugs.sys5 Distribution: world Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 38 As quoted from <325@nsta.UUCP> by amos@nsta.UUCP (Amos Shapir): +--------------- | One of the optional flags of the c_cflag field of termio is CLOCAL. (see | ) It is supposed to cause the tty driver to ignore the | 'carrier detect' bit in the RS232 interface, and open the line anyway. | This is needed for ports that do not have the DC wired; trying to open | such a port without setting the CLOCAL bit first, will cause the open to | hang forever waiting for a carrier signal. | | However, the only way to set this flag is by a ioctl call; the ioctl | call needs a file-descriptor argument; a file-descriptor can only be | obtained by a successfull open call... +--------------- #include #include #include ... struct termio t; int fd; if ((fd = open("/dev/tty22", O_RDWR|O_NDELAY)) == -1) { perror("/dev/tty22"); exit(1); } ioctl(fd, TCGETA, &t); t.c_cflag |= CLOCAL; ioctl(fd, TCSETAW, &t); -- Brandon S. Allbery, moderator of comp.sources.misc and comp.binaries.ibm.pc {{harvard,mit-eddie}!necntc,well!hoptoad,sun!mandrill!hal}!ncoast!allbery ARPA: necntc!ncoast!allbery@harvard.harvard.edu Fido: 157/502 MCI: BALLBERY <> ** Site "cwruecmp" is changing its name to "mandrill". Please re-address ** *** all mail to ncoast to pass through "mandrill" instead of "cwruecmp". ***