* Copyright (c) 1985, 1993
* The Regents of the University of California. All rights reserved.
* %sccs.include.proprietary.c%
static char sccsid
[] = "@(#)att2224.c 8.1 (Berkeley) %G%";
char dcname
[20], phone
[MAXPH
+10], c
= 0;
int dnf
, failret
= 0, timelim
;
sprintf(dcname
, "/dev/%s", dev
->D_line
);
DEBUG(4, "Open timed out %s", dcname
);
signal(SIGALRM
, alarmtr
);
if ((dnf
= open(dcname
, 2)) <= 0) {
DEBUG(4, "Can't open %s", dcname
);
fixline(dnf
, dev
->D_speed
);
DEBUG(4, "modem port - %s\n", dcname
);
logent("ACU WRITE", "FAILED");
signal(SIGALRM
, alarmtr
);
slowrite(dnf
, "\r"); /* wake up modem */
} while (expect(":~3", dnf
));
sprintf (phone
, "atzt%s\r", telno
);
slowrite (dnf
, phone
); /* type telno string to modem */
if ((expect(phone
, dnf
)) != SUCCESS
) {
logent("ACU READ", "FAILED");
logent("NO ANSWER", "FAILED");
timelim
= strlen(telno
) * 4;
signal(SIGALRM
, alarmtr
);
alarm(timelim
> 30 ? timelim
: 30);
if ((read(dnf
, &c
, 1)) != 1) {
logent("ACU READ", "FAILED");
case 'D': /* no dial tone */
logent("NO DIAL TONE", "FAILED");
case 'B': /* line busy */
logent("LINE BUSY", "FAILED");
case 'N': /* no answer */
logent("NO ANSWER", "FAILED");
case 'H': /* handshake failed */
logent("MODEM HANDSHAKE", "FAILED");
case '3': /* 2400 baud */
DEBUG(4, "Baudrate set to 2400 baud", CNULL
);
case '2': /* 1200 baud */
DEBUG(4, "Baudrate set to 1200 baud", CNULL
);
DEBUG(4, "Baudrate set to 300 baud", CNULL
);
default: /* Not one of the above, so must be garbage */
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