lenny@icus.ICUS.COM (Lenny Tropiano) (09/08/90)
obminit was written by Roger Florkowski <...!cs.utexas.edu!taliesin!roger> to make setting up the on-board-modem and voice lines (ph0, ph1) a little easier and more understandable. The original way most people are used to is the /etc/phupd program. This program passed with the correct number of YES's and NO's and the line and type (VOICE or DATA) will set the phone lines to whatever you specified. Since the trend for everyone is to move away from the UA and UA-type programs, this becomes increasing more cryptic. Roger, like any hacker/programmer, came up with this solution. Basically it has all the functionality as /etc/phupd, but uses getopt() to handle arguments!! It's usage is quite a bit clearer. All the information regarding what bits to tweek, can be found in /usr/include/phone.h. Since Roger doesn't have immediate posting access to the net, I'm posting this on his behalf. The README, Makefile and manual page were written by: Lenny Tropiano <lenny@icus.ICUS.COM> -- cut here -- -- cut here -- -- cut here -- -- cut here -- -- cut here -- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh <file", e.g.. If this archive is complete, you # will see the following message at the end: # "End of shell archive." # Contents: README obminit.1 Makefile obminit.c # Wrapped by lenny@icus on Sat Sep 8 10:19:05 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f README -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"README\" else echo shar: Extracting \"README\" \(1000 characters\) sed "s/^X//" >README <<'END_OF_README' X Xobminit was written by Roger Florkowski <...!cs.utexas.edu!taliesin!roger> Xto make setting up the on-board-modem and voice lines (ph0, ph1) a little Xeasier and more understandable. The original way most people are used to Xis the /etc/phupd program. This program passed with the correct number of XYES's and NO's and the line and type (VOICE or DATA) will set the phone Xlines to whatever you specified. Since the trend for everyone is to Xmove away from the UA and UA-type programs, this becomes increasing more Xcryptic. X XRoger, like any hacker/programmer, came up with this solution. Basically Xit has all the functionality as /etc/phupd, but uses getopt() to handle Xarguments!! It's usage is quite a bit clearer. X XAll the information regarding what bits to tweek, can be found in X/usr/include/phone.h. X XSince Roger doesn't have immediate posting access to the net, I'm posting Xthis on his behalf. The README, Makefile and manual page were written by: XLenny Tropiano <lenny@icus.ICUS.COM> X END_OF_README if test 1000 -ne `wc -c <README`; then echo shar: \"README\" unpacked with wrong size! fi # end of overwriting check fi if test -f obminit.1 -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"obminit.1\" else echo shar: Extracting \"obminit.1\" \(928 characters\) sed "s/^X//" >obminit.1 <<'END_OF_obminit.1' X.TH OBMINIT 1L LOCAL X.SH NAME Xobminit \- UNIX PC initialize on-board modem and voice lines X.SH SYNOPSIS X.B obminit X[-kw] [-l line[0|1]] [-m mode[v|d]] [-u dial[p|t]] X.SH DESCRIPTION X.B obminit Xwill initialize the phone lines to their proper state, this should be Xcalled on bootup, in replacement for the /etc/phupd program X.RE X.SH OPTIONS Xobminit can be run with the following options. X.TP X-l 0|1 (line) XSets which line you are setting, ph0=0, ph1=1. X.TP X-m v|d (mode) XSets the mode of the line to either voice=v, or data=d. X.TP X-u p|t (dialmode) XSets the dialing mode to either pulse=p, or tone=t. X.TP X-k XSet the line for a keyset (lighted) phone. X.TP X-w XSet the line to say it has the message-waiting (call-waiting) feature. X.RE X.SH FILES X.nf X/dev/ph0 Telephone Line 0 X/dev/ph1 Telephone Line 1 X.fi X.SH AUTHOR X.RS X.PP XRoger Florkowski <...!cs.utexas.edu!taliesin!roger> XManual by Lenny Tropiano <lenny@icus.ICUS.COM> X.RE END_OF_obminit.1 if test 928 -ne `wc -c <obminit.1`; then echo shar: \"obminit.1\" unpacked with wrong size! fi # end of overwriting check fi if test -f Makefile -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"Makefile\" else echo shar: Extracting \"Makefile\" \(653 characters\) sed "s/^X//" >Makefile <<'END_OF_Makefile' X# X# Makefile to compile obminit.c (initialize the phone lines) X# Program by Roger Florkowski <...!cs.utexas.edu!taliesin!roger> X# Makefile & Manual Page by Lenny Tropiano <lenny@icus.ICUS.COM> X# XCFLAGS=-v -O XLDFLAGS=-s XLIBS=/lib/crt0s.o /lib/shlib.ifile XMAN=/usr/man/man1 XBIN=/usr/lbin X# Xobminit: obminit.o X @echo "Loading ..." X $(LD) $(LDFLAGS) -o obminit obminit.o $(LIBS) X# Xinstall: obminit X cp obminit.1 $(MAN)/ X chown bin $(MAN)/obminit.1 X chgrp bin $(MAN)/obminit.1 X chmod 644 $(MAN)/obminit.1 X cp obminit $(BIN)/ X chown root $(BIN)/obminit X chgrp bin $(BIN)/obminit X chmod 750 $(BIN)/obminit X# Xclean: X rm -f obminit *.o core END_OF_Makefile if test 653 -ne `wc -c <Makefile`; then echo shar: \"Makefile\" unpacked with wrong size! fi # end of overwriting check fi if test -f obminit.c -a "${1}" != "-c" ; then echo shar: Will not over-write existing file \"obminit.c\" else echo shar: Extracting \"obminit.c\" \(2962 characters\) sed "s/^X//" >obminit.c <<'END_OF_obminit.c' X X/* X * OBMinit. Set initial OBM parameters. X * Usage: X * obminit -l[0|1] -m[v|d] -u[p|t] -wk X * where: X * -l [0 == ph0, 1 == ph1] X * -m [v == voice, d == data] X * -u [p == pulse, t == tone] X * -w == message waiting X * -k == keyset X */ X X#include <stdio.h> X#include <sys/phone.h> X#include <fcntl.h> X Xextern char *optarg; Xchar *prog_name; X Xmain (argc,argv) Xint argc; Xchar *argv[]; X{ X int fd, i; X short line, key, mess_wait, mode, dial_out; X char *device[10]; X struct updata tud; X X /* defaults. ph0, voice, pulse, no keyset, no message waiting */ X line = key = mess_wait = 0; X mode = O_RDONLY; X dial_out = PULSE; X prog_name = argv[0]; X while ((i = getopt(argc, argv, "l:m:u:kw")) != EOF) { X switch (i) { X /* line. 0 == ph0, 1 == ph1 */ X case 'l': X line = atoi(optarg); X if (line < 0 || line > 1) X Usage(); X break; X X /* mode. v == voice, d == data */ X case 'm': X if (*optarg == 'v') X mode = O_RDONLY; X else if (*optarg == 'd') X mode = O_RDWR | O_NDELAY; X else X Usage(); X break; X X /* dial_out. p == pulse, t == tone */ X case 'u': X if (*optarg == 't') X dial_out = DTMF; X else if (*optarg == 'p') X dial_out = PULSE; X else X Usage(); X break; X X /* keyset line */ X case 'k': X key = USEALEAD; X break; X X /* message waiting feature */ X case 'w': X mess_wait = MSGWAIT; X break; X default: X Usage(); X } X } X sprintf (device, "/dev/ph%d", line); X X /* check args */ X#if 0 X /* do I really care? b/c the open() will fail */ X /* failures are as such: X * if no getty's are running, then all combinations work. X * if a (uu)getty is on /dev/ph1, then ph1 can only be set X * in data mode, and ph0 can only be set in voice mode. X * if a (uu)getty is on /dev/ph0, then ph0 can only be set X * in data mode, and ph1 can only be set in voice mode. X * But what does setting ph1 in voice mode mean? X */ X if (line == 1 && mode == O_RDONLY) { X fprintf (stderr, "%s: DATA mode only\n", device); X Usage(); X } X#endif X X if ((fd = open (device, mode)) < 0) { X fprintf (stderr, "%s: \"%s\" can not be opened.\n", prog_name, device); X Usage(); X } X X /* put handset on the line if call_type is voice on ph0. X * What would happen if we attached the handset to line 1? X * the relay happily clicks ... X */ X if (line == 0 && mode == O_RDONLY) X ioctl (fd, PIOCLINESEL, 0); X X /* get current settings */ X ioctl (fd, PIOCGETP, &tud); X X /* reset modes */ X tud.c_lineparam &= ~(DTMF); X tud.c_lineparam &= ~(PULSE); X tud.c_lineparam &= ~(MSGWAIT); X tud.c_lineparam &= ~(USEALEAD); X X /* set new modes */ X tud.c_lineparam |= (dial_out | key | mess_wait); X X ioctl (fd,PIOCSETP, &tud); X X close (fd); X exit (0); X} X XUsage() X{ X fprintf (stderr, "usage: %s -l[0|1] -m[voice|data] -u[pulse|tone] -wk\n", X prog_name); X exit (1); X} END_OF_obminit.c if test 2962 -ne `wc -c <obminit.c`; then echo shar: \"obminit.c\" unpacked with wrong size! fi # end of overwriting check fi echo shar: End of shell archive. exit 0 -- | Lenny Tropiano ICUS Software Systems lenny@icus.ICUS.COM | | {ames,pacbell,decuac,sbcs,hombre,rayssd}!icus!lenny attmail!icus!lenny | +------ ICUS Software Systems -- PO Box 1; Islip Terrace, NY 11752 ------+