How to open a modem which isn't asserting carrier-detect?

David Sherman dave at lsuc.UUCP
Thu Jan 31 05:17:28 AEST 1985


Scenario: a Perkin-Elmer 3220 running v7, with source. Various
lines to modems and similar DCE devices. Normally, init waits on
an open(2) call; when a call comes in to the modem, the modem
raises CXR (carrier detect), the open succeeds, and init starts
up a getty. Fine.

Occasionally, I want an open to succeed whether or not CXR is
asserted by the modem. For example, I want to call out with cu(1).
I am *not* interested in solutions which involve changing a setting
on the modem, or jumpers within the cable. This change has to
be possible from the software, on any line at any time.

Looking at the code in /usr/sys/dev/vdu.c, I find:

vduopen(dev)
{
 ...
	vduenab(tp);
 ...
	while (!(tp->t_state&CARR_ON))
		sleep(&tp->t_rawq, TTIPRI);
 ...
}

vduenab(atp)
{
 ...
	stat = ss(radd);
	if ((stat&CARR_OFF) == 0)
		tp->t_state |= CARR_ON;
 ...
}

So it looks like the change is fairly simple: given an indication
that we don't care about the CARR_OFF (hardware) bit, vduenab can
simply turn on the CARR_ON indicator in t_state and we're off to the races.

Question (for those who are still with me): how do I get that
indication to the kernel - that is, that I want the open to work
whether or not the carrier is asserted? I can't use an ioctl,
because you have to get the device open first before you can ioctl.
Do I have to go through the hassle and overhead of another, almost
identical, device driver, which points to the same address?
Is there a better way?

All ideas greatly appreciated.

Dave Sherman
The Law Society of Upper Canada
Toronto
-- 
{utzoo pesnta nrcaero utcs}!lsuc!dave
{allegra decvax ihnp4 linus}!utcsrgv!lsuc!dave



More information about the Comp.unix.wizards mailing list