1: #ifndef lint
   2: static char sccsid[] = "@(#)nov.c	4.1 (Berkeley) 1/22/85";
   3: #endif
   4: 
   5: #include "../condevs.h"
   6: #ifdef NOVATION
   7: 
   8: /***
   9:  *	novopn(telno, flds, dev) connect to novation Smart-Cat
  10:  *	(similar to hayes smartmodem)
  11:  *	char *flds[], *dev[];
  12:  *
  13:  *	return codes:
  14:  *		>0  -  file number  -  ok
  15:  *		CF_DIAL,CF_DEVICE  -  failed
  16:  */
  17: 
  18: novopn(telno, flds, dev)
  19: char *telno;
  20: char *flds[];
  21: struct Devices *dev;
  22: {
  23:     int dh = -1;
  24:     extern errno;
  25:     char dcname[20];
  26:     int pulse = 0;
  27: 
  28:     sprintf(dcname, "/dev/%s", dev->D_line);
  29:     DEBUG(4, "dc - %s\n", dcname);
  30:     if (strcmp(dev->D_calldev, "pulse") == 0)
  31:         pulse = 1;
  32:     if (setjmp(Sjbuf)) {
  33:         DEBUG(1, "timeout novation open %s\n", dcname);
  34:         logent("novation open", "TIMEOUT");
  35:         if (dh >= 0)
  36:             close(dh);
  37:         delock(dev->D_line);
  38:         return CF_DIAL;
  39:     }
  40:     signal(SIGALRM, alarmtr);
  41:     getnextfd();
  42:     alarm(10);
  43:     dh = open(dcname, 2); /* read/write */
  44:     alarm(0);
  45: 
  46:     /* modem is open */
  47:     next_fd = -1;
  48:     if (dh >= 0) {
  49:         fixline(dh, dev->D_speed);
  50:         /* set guard time small so line is in transparant mode */
  51:         slowrite(dh, "\rATS12=1\r");
  52:         if (expect("OK", dh) != 0) {
  53:             logent("NOV no line", _FAILED);
  54:             strcpy(devSel, dev->D_line);
  55:             novcls(dh);
  56:             return CF_DIAL;
  57:         }
  58: 
  59:         if (pulse)
  60:             slowrite(dh, "ATDP");
  61:         else
  62:             slowrite(dh, "ATDT");
  63:         slowrite(dh, telno);
  64:         slowrite(dh, "\r");
  65: 
  66:         if (expect("CONNECT", dh) != 0) {
  67:             logent("NOV no carrier", _FAILED);
  68:             strcpy(devSel, dev->D_line);
  69:             novcls(dh);
  70:             return CF_DIAL;
  71:         }
  72: 
  73:     }
  74:     if (dh < 0) {
  75:         DEBUG(4, "novation failed\n", CNULL);
  76:         delock(dev->D_line);
  77:     }
  78:     DEBUG(4, "novation ok\n", CNULL);
  79:     return dh;
  80: }
  81: 
  82: novcls(fd)
  83: int fd;
  84: {
  85:     char dcname[20];
  86:     struct sgttyb hup, sav;
  87: 
  88:     if (fd > 0) {
  89:         sprintf(dcname, "/dev/%s", devSel);
  90:         DEBUG(4, "Hanging up fd = %d\n", fd);
  91:         /*
  92: 		 * code to drop DTR -- change to 0 baud then back to default.
  93: 		 */
  94:         gtty(fd, &hup);
  95:         gtty(fd, &sav);
  96:         hup.sg_ispeed = B0;
  97:         hup.sg_ospeed = B0;
  98:         stty(fd, &hup);
  99:         sleep(2);
 100:         stty(fd, &sav);
 101:         /*
 102: 		 * now raise DTR -- close the device & open it again.
 103: 		 */
 104:         sleep(2);
 105:         close(fd);
 106:         sleep(2);
 107:         fd = open(dcname, 2);
 108:         /*
 109: 		 * Since we have a getty sleeping on this line, when it wakes up it sends
 110: 		 * all kinds of garbage to the modem.  Unfortunatly, the modem likes to
 111: 		 * execute the previous command when it sees the garbage.  The previous
 112: 		 * command was to dial the phone, so let's make the last command reset
 113: 		 * the modem.
 114: 		 */
 115:         sleep(2);
 116:         slowrite(fd, "\rATZ\r");
 117:         close(fd);
 118:         delock(devSel);
 119:     }
 120: }
 121: 
 122: #endif NOVATION

Defined functions

novcls defined in line 82; used 2 times
novopn defined in line 18; never used

Defined variables

sccsid defined in line 2; never used
Last modified: 1987-02-17
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3182
Valid CSS Valid XHTML 1.0 Strict