Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uflorida!haven!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.dcom.modems Subject: driver supporting dialin/dialout on same device Keywords: modems ACU driver Message-ID: <13680@mimsy.UUCP> Date: 22 Sep 88 01:07:32 GMT References: <1260@moscom.UUCP> <324@mikros.systemware.de> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 87 In article <324@mikros.systemware.de> stefan@mikros.systemware.de (Stefan Stapelberg) writes: >I would like to implement this scheme, but controlling the >DTR signal from the modem turns out to be a problem: The modem >doesn't answer rings if DTR has not been asserted by the opening >process. Unfortunately, I have to use DTR to hangup the modem >after dialing out. > >So my question is: If getty's open has asserted DTR high and >uucico's last close sets DTR to low, how can I ensure that the >modem still will answer rings? Simple: in the kernel, the pending open from getty runs again, re-raising DTR. The code looks like this: ttyopen: ... switch (mode) { case DIAL_IN_MODE: /* * Assert DTR and wait for carrier, * but do nothing while the line is * tied up in `dialout' mode. */ for (;;) { if (!active_in_dialout()) assert_dtr(); wait_for_carrier(); if (active_in_dialout()) wait_for_status_change(); else break; } set_active_in_dialin(); /* now ready to use */ break; case DIAL_OUT_MODE: /* * Error if busy, else assert DTR and * open immediately. */ if (active_in_dialin() || active_in_dialout()) return (EBUSY); set_active_in_dialout(); assert_dtr(); /* now ready to use */ break; } and ttyclose: ... switch (mode) { case DIAL_IN_MODE: /* * Close down dial-in edition and * hang up if we should (`hupcls'). */ clear_active_in_dialin(); maybe_clear_dtr(); break; case DIAL_OUT_MODE: /* * Close down dial-out edition and * hang up no matter what, then delay * for about a second for the modem * to see DTR fall. */ clear_active_in_dialout(); clear_dtr(); sleep(1_second); break; } /* * Wake up anyone in the `other' mode * in case someone wants to reassert DTR. */ status_change(); -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris