hayes.c revision 8d489c7a815fcac696803219572e95aa01532b0f
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "tip.h"
static int hayes_sync(int);
static void sigALRM(void);
static sigjmp_buf timeoutbuf;
void hayes_disconnect(void);
/*
* Dial up on a Hayes Smart Modem 1200 or 2400
*/
/* ARGSUSED */
int
{
if (!hayes_sync(FD)) {
(void) printf("can't synchronize with hayes\n");
#ifdef ACULOG
#endif
return (0);
}
(void) printf("\ndialing...");
#ifdef ACULOG
char line[80];
#endif
return (0);
}
if (*num == 'S')
else
(void) alarm(0);
return (1);
return (0);
}
void
hayes_disconnect(void)
{
}
void
hayes_abort(void)
{
(void) alarm(0);
(void) sleep(2);
}
static void
sigALRM(void)
{
}
/*
* This piece of code attempts to get the hayes in sync.
*/
static int
hayes_sync(int fd)
{
int tries;
/*
* Toggle DTR to force anyone off that might have left
* the modem connected, and insure a consistent state
* to start from.
*/
(void) sleep(1);
/*
* After reseting the modem, initialize all
* parameters to required vaules:
*
* V0 - result codes are single digits
* Q0 - result codes ARE sent
* E0 - do not echo
* S0=1 - automatically answer phone
* S2=255 - disable escape character
* S12=255 - longest possible escape guard time
*/
(void) sleep(1);
/* flush any echoes or return codes */
/* now see if the modem is talking to us properly */
(void) alarm(2);
return (1);
}
}
return (0);
}