From owner-freebsd-hackers Fri Feb 25 16:36:55 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from blaubaer.kn-bremen.de (blaubaer.kn-bremen.de [195.37.179.254]) by hub.freebsd.org (Postfix) with ESMTP id 2072637BEC4; Fri, 25 Feb 2000 16:36:50 -0800 (PST) (envelope-from nox@saturn.kn-bremen.de) Received: from saturn.kn-bremen.de (uucp@localhost) by blaubaer.kn-bremen.de (8.9.1/8.9.1) with UUCP id BAA13755; Sat, 26 Feb 2000 01:31:02 +0100 Received: (from nox@localhost) by saturn.kn-bremen.de (8.9.3/8.8.5) id BAA12178; Sat, 26 Feb 2000 01:32:02 +0100 (CET) Date: Sat, 26 Feb 2000 01:32:02 +0100 (CET) From: Juergen Lock Message-Id: <200002260032.BAA12178@saturn.kn-bremen.de> To: ptacek@dashmail.net Subject: Re: modem program... Help X-Newsgroups: local.list.freebsd.hackers In-Reply-To: <200002252012.VAA04133@saturn.kn-bremen.de> References: Organization: home Cc: , Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Forgot something: In article <200002252012.VAA04133@saturn.kn-bremen.de> i wrioe: >Well the normal `unix' way to watch for CD is to turn off CLOCAL, >then you'll get a SIGHUP when the modem loses its connection. >(thats where that signal's name comes from, hangup. people have >dialed into unix boxes over modems long before the internet got >popular...) and to drop DTR you just do the equivalent of a `stty 0'. Or close the tty's fd... and if you don't want it to hang up (drop DTR) on close you reset HUPCL (tho usually thats just what you want.) also note how this means that `ordinary' programs like the login shell don't need to be aware that they're running on a modem line, when the user leaves them the tty driver will tell the modem to hang up and when the connection drops for whatever reason before the user left his shell/program it'll be killed/notified by the SIGHUP. And if you want some examples of modem handling or how to wait for CD to come on or how to portably do serial io efficiently look at uucp (especially /usr/src/gnu/libexec/uucp/libunix/serial.c), or another interesting one may be mgetty (/usr/ports/comms/mgetty+sendfax), that (unlike a `normal' getty) even interprets the modem messages and chats with the modem to be able to handle non-data calls too (i.e. faxes or voice, and if i remember right on some modems it will even get the caller id info...) HTH, -- Juergen Lock (remove dot foo from address to reply) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message