static char sccsid
[] = "@(#)hys.c 4.6 (Berkeley) %G%";
* The "correct" switch settings for a USR Courier 2400 are
* Dialin/out: 0 0 1 1 0 0 0 1 0 0
* Dialout only: 0 0 1 1 1 1 0 1 0 0
* where 0 = off and 1 = on
* hyspopn(telno, flds, dev) connect to hayes smartmodem (pulse call)
* hystopn(telno, flds, dev) connect to hayes smartmodem (tone call)
* CF_DIAL,CF_DEVICE - failed
hyspopn(telno
, flds
, dev
)
return hysopn(telno
, flds
, dev
, 0);
hystopn(telno
, flds
, dev
)
return hysopn(telno
, flds
, dev
, 1);
hysopn(telno
, flds
, dev
, toneflag
)
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 */
fixline(dh
, dev
->D_speed
);
if (dochat(dev
, flds
, dh
)) {
logent(dcname
, "CHAT FAILED");
write(dh
, "ATV1E0H\r", 8);
if (expect("OK\r\n", dh
) != 0) {
logent(dcname
, "HSM seems dead");
write(dh
, "ATX6S7=44\r", 10);
if (expect("OK\r\n", dh
) != 0) {
logent(dcname
, "HSM seems dead");
write(dh
, telno
, strlen(telno
));
logent(dcname
, "TIMEOUT");
strcpy(devSel
, dev
->D_line
);
signal(SIGALRM
, alarmtr
);
while (read(dh
, cp
,1) == 1)
while (++cp
< &cbuf
[MAXPH
] && read(dh
, cp
, 1) == 1 && *cp
!= '\n')
DEBUG(4,"\nGOT: %s", cbuf
);
} while (strncmp(cbuf
, "RING", 4) == 0 && nrings
++ < 5);
if (strncmp(cbuf
, "CONNECT", 7) != 0) {
strcpy(devSel
, dev
->D_line
);
if (i
> 0 && i
!= dev
->D_speed
) {
DEBUG(4,"Baudrate reset to %d\n", i
);
logent(dcname
, "CAN'T OPEN");
DEBUG(4, "hayes 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.
if (expect("OK",fd
) != 0)
logent(devSel
, "HSM did not respond to ATZ");