* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
* This module is believed to contain source code proprietary to AT&T.
* Use and redistribution is subject to the Berkeley Software License
* Agreement and your Software Agreement with AT&T (Western Electric).
static char sccsid
[] = "@(#)df12.c 8.1 (Berkeley) 6/6/93";
* df12popn(telno, flds, dev) connect to df12 modem (pulse call)
* df12topn(telno, flds, dev) connect to df12 modem (tone call)
* CF_DIAL,CF_NODEV - failed
df12popn (telno
, flds
, dev
)
return df12opn (telno
, flds
, dev
, 0);
df12topn (telno
, flds
, dev
)
return df12opn (telno
, flds
, dev
, 1);
df12opn (telno
, flds
, dev
, toneflag
)
char dcname
[20], newphone
[64];
sprintf (dcname
, "/dev/%s", dev
-> D_line
);
DEBUG (4, "dc - %s\n", dcname
);
logent (dcname
, "TIMEOUT");
signal (SIGALRM
, alarmtr
);
dh
= open (dcname
, 2);/* read/write */
/* First, adjust our phone number string. These modems don't
* like any characters but digits and "=" signs (for delay)
for (phindex
= 0; *telno
; telno
++)
if (*telno
== '=' || (*telno
>= '0' && *telno
<= '9'))
newphone
[phindex
++] = *telno
;
logent (dcname
, "Phone number too long");
newphone
[phindex
] = '\0';
fixline (dh
, dev
-> D_speed
);
if (dochat (dev
, flds
, dh
))
logent (dcname
, "CHAT FAILED");
if (expect ("Ready\r\n", dh
) != 0)
DEBUG (4, "Didn't get 'Ready' response.\n", NULL
);
logent (dcname
, "Modem not responding");
DEBUG (4, "Got 'Ready' response\n", NULL
);
DEBUG (7, "Writing control select flag %c\n", toneflag
? 'T' : 'P');
slowrite (dh
, toneflag
? "T" : "P");
DEBUG (4, "Writing telephone number %s\n", newphone
);
DEBUG (7, "Telephone number written\n", NULL
);
DEBUG (7, "Writing # sign\n", NULL
);
if (expect ("Attached\r\n", dh
) != 0)
logent (dcname
, "No carrier");
strcpy (devSel
, dev
-> D_line
);
logent (dcname
, "CAN'T OPEN");
DEBUG (4, "df12 ok\n", CNULL
);
sprintf (dcname
, "/dev/%s", devSel
);
DEBUG (4, "Hanging up fd = %d\n", fd
);
* code to drop DTR -- change to 0 baud then back to default.
* now raise DTR -- close the device & open it again.