Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 Fluke 1/4/84; site fluke.UUCP Path: utzoo!linus!decvax!harpo!seismo!hao!hplabs!tektronix!uw-beaver!ssc-vax!fluke!joe From: joe@fluke.UUCP (Joe Kelsey) Newsgroups: net.bugs.uucp Subject: Re: condevs support for Vadic 212 and Vadic VA811S (4.2bsd uucp) Message-ID: <1526@vax4.fluke.UUCP> Date: Wed, 11-Apr-84 19:46:59 EST Article-I.D.: vax4.1526 Posted: Wed Apr 11 19:46:59 1984 Date-Received: Sun, 15-Apr-84 01:25:35 EST References: <1525@vax4.fluke.UUCP> Organization: John Fluke Mfg. Co., Everett, WA Lines: 295 Oooops! I fumbled and sent the message out without the code! Well, here is the code: (the usual caveats apply - the line numbers are not exact, etc.) 74a75,77 > #ifdef VA212 > int va212opn(), va212cls(); > #endif VA212 76a80,82 > #endif VA212 > #ifdef VA811S > int va811opn(), va811cls(); 113a120,122 > #ifdef VA212 > { "ACU", "va212", Acuopn, va212opn, va212cls }, > #endif VA212 116a126,128 > #ifdef VA811S > { "ACU", "va811s", Acuopn, va811opn, va811cls }, > #endif VA811S 422a435 > #ifndef FLUKE 424a438,441 > #else > DEBUG(4, "wanted %s ", "#"); > ok = expect("#", dh); > #endif FLUKE 429a447 > #ifndef FLUKE 431a450,453 > #else > DEBUG(4, "wanted %s ", "CONNECTING"); > ok = expect("CONNECTING", dh); > #endif FLUKE 1265a1288,1289 > DEBUG (4, errno == 4 ? "%s: no carrier\n" : "%s: can't open\n", > dcname); 1267c1291 < return(CF_NODEV); --- > return(errno == 4 ? CF_DIAL : CF_NODEV); 1285c1309 < for(i = 0; i < 5; ++i) { /* make 5 tries */ --- > for(i = 0; i < TRYCALLS; ++i) { /* make TRYCALLS tries */ 1347a1372,1500 > #ifdef VA212 > > /* > * va212opn: establish dial-out connection through a Racal-Vadic 212. > * Returns descriptor open to tty for reading and writing. > * Negative values (-1...-7) denote errors in connmsg. > * Be sure to disconnect tty when done, via HUPCL or stty 0. > */ > > va212opn(telno, flds, dev) > char *telno; > char *flds[]; > struct Devices *dev; > { > int dh = -1; > int i, ok, er = 0, delay; > extern errno; > char dcname[20]; > > sprintf(dcname, "/dev/%s", dev->D_line); > if (setjmp(Sjbuf)) { > DEBUG(1, "timeout va212 open\n", ""); > logent("va212 open", "TIMEOUT"); > if (dh >= 0) > close(dh); > delock(dev->D_line); > return(CF_NODEV); > } > signal(SIGALRM, alarmtr); > getnextfd(); > alarm(10); > dh = open(dcname, 2); > alarm(0); > > /* modem is open */ > next_fd = -1; > if (dh < 0) { > DEBUG (4, errno == 4 ? "%s: no carrier\n" : "%s: can't open\n", > dcname); > delock(dev->D_line); > return(errno == 4 ? CF_DIAL : CF_NODEV); > } > fixline(dh, dev->D_speed); > > /* translate - to K for Vadic */ > DEBUG(4, "calling %s -> ", telno); > delay = 0; > for (i = 0; i < strlen(telno); ++i) { > switch(telno[i]) { > case '=': /* await dial tone */ > case '-': /* delay */ > case '<': > telno[i] = 'K'; > delay += 5; > break; > } > } > DEBUG(4, "%s\n", telno); > for(i = 0; i < TRYCALLS; ++i) { /* make TRYCALLS tries */ > /* wake up Vadic */ > sendthem("\005\\d", dh); > DEBUG(4, "wanted %s ", "*"); > ok = expect("*", dh); > DEBUG(4, "got %s\n", ok ? "?" : "that"); > if (ok != 0) > continue; > > sendthem("D\\d", dh); /* "D" (enter number) command */ > DEBUG(4, "wanted %s ", "NUMBER?"); > ok = expect("NUMBER?", dh); > if (ok == 0) > ok = expect("\n", dh); > DEBUG(4, "got %s\n", ok ? "?" : "that"); > if (ok != 0) > continue; > > /* send telno, send \r */ > sendthem(telno, dh); > ok = expect(telno, dh); > if (ok == 0) > ok = expect("\n", dh); > DEBUG(4, "got %s\n", ok ? "?" : "that"); > if (ok != 0) > continue; > > sendthem("", dh); /* confirm number */ > DEBUG(4, "wanted %s ", "DIALING..."); > ok = expect("DIALING...", dh); > if (ok == 0) { > ok = expect("\n", dh); > DEBUG(4, "wanted %s ", "ANSWER TONE"); > ok = expect("ANSWER TONE", dh); > if (ok == 0) > ok = expect("\n", dh); > } > DEBUG(4, "got %s\n", ok ? "?" : "that"); > if (ok == 0) > break; > } > > if (ok == 0) { > DEBUG(4, "wanted ON LINE \\r\\n ", 0); > ok = expect("ON LINE \r\n", dh); > DEBUG(4, "got %s\n", ok ? "?" : "that"); > } > > if (ok != 0) { > sendthem("I\\d", dh); /* back to idle */ > if (dh > 2) > close(dh); > DEBUG(4, "vadDial failed\n", ""); > delock(dev->D_line); > return(CF_DIAL); > } > DEBUG(4, "va212 ok\n", ""); > return(dh); > } > > va212cls(fd) { > > if (fd > 0) { > close(fd); > sleep(5); > delock(devSel); > } > } > > #endif VA212 > 1482c1635,1751 < #endif --- > #endif RVMACS > > #ifdef VA811S > /* > * Racal-Vadic VA811 dialer with 831 adaptor. > * A typical 300 baud L-devices entry is > * ACU /dev/tty10 unused 300 va811s > * where tty10 is the communication line (D_Line), > * and 300 is the line speed. > * This is almost identical to RVMACS except that we don't need to > * send addresses and modem types, and don't need the fork. > */ > > #define STX 02 /* Access Adaptor */ > #define ETX 03 /* Transfer to Dialer */ > #define SI 017 /* Buffer Empty (end of phone number) */ > #define SOH 01 /* Abort */ > > va811opn(ph, flds, dev) > char *ph, *flds[]; > struct Devices *dev; > { > int va; > register int i, tries; > char c, dcname[20]; > char vabuf[35]; /* STX, 31 phone digits, SI, ETX, NUL */ > > va = 0; > sprintf(dcname, "/dev/%s", dev->D_line); > if (setjmp(Sjbuf)) { > DEBUG(1, "timeout va811 open\n", ""); > logent("va811opn", "TIMEOUT"); > if (va >= 0) > close(va); > delock(dev->D_line); > return CF_NODEV; > } > DEBUG(4, "va811: STARTING CALL\n", 0); > getnextfd(); > signal(SIGALRM, alarmtr); > alarm(10); > va = open(dcname, 2); > alarm(0); > > /* line is open */ > next_fd = -1; > if (va < 0) { > DEBUG(4, errno == 4 ? "%s: no carrier\n" : "%s: can't open\n", > dcname); > delock(dev->D_line); > logent(dcname, "CAN'T OPEN"); > return(errno == 4 ? CF_DIAL : CF_NODEV); > } > fixline(va, dev->D_speed); > > /* first, reset everything */ > sendthem("\\01\\c", va); > DEBUG(4, "wanted %c ", 'B'); > i = expect("B", va); > DEBUG(4, "got %s\n", i ? "?" : "that"); > if (i != 0) { > DEBUG(4, "va811: NO RESPONSE\n", ""); > logent("va811 reset", "TIMEOUT"); > close(va); > delock(dev->D_line); > return(CF_DIAL); > } > > sprintf(vabuf, "%c%.31s%c%c\\c", STX, ph, SI, SOH); > sendthem(vabuf, va); > DEBUG(4, "wanted %c ", 'B'); > i = expect("B", va); > DEBUG(4, "got %s\n", i ? "?" : "that"); > > if (i != 0) { > DEBUG(4, "va811: STORE NUMBER\n", ""); > logent("va811 STORE", "FAILED"); > close(va); > delock(dev->D_line); > return(CF_DIAL); > } > > for (tries = 0; tries < TRYCALLS; tries++) { > sprintf(vabuf, "%c%c\\c", STX, ETX); > sendthem(vabuf, va); > DEBUG(4, "DIALING...", ""); > i = expect("A", va); > DEBUG(4, " %s\n", i ? "FAILED" : "SUCCEEDED"); > if (i != 0) { > DEBUG(4, "va811: RESETTING\n", ""); > logent("va811 DIAL", "FAILED"); > sendthem("\\01\\c", va); > expect("B", va); > } > else > break; > } > > if (tries >= TRYCALLS) { > close(va); > delock(dev->D_line); > return(CF_DIAL); > } > > DEBUG(4, "va811 ok\n", ""); > return(va); > } > > va811cls(fd) > register int fd; > { > DEBUG(2, "va811 close %d\n", fd); > p_chwrite(fd, SOH); > /* ioctl(fd, TIOCCDTR, NULL);*/ > close(fd); > } > #endif VA811S