Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!sri-spam!ames!ptsfa!pttesac!robert From: robert@pttesac.UUCP (Robert Rodriguez) Newsgroups: comp.sys.att Subject: Re: VOICE/DATA toggle for 3B1 Message-ID: <592@pttesac.UUCP> Date: Tue, 13-Oct-87 15:15:39 EDT Article-I.D.: pttesac.592 Posted: Tue Oct 13 15:15:39 1987 Date-Received: Thu, 15-Oct-87 02:23:09 EDT References: <7600003@uiucdcsm> Reply-To: robert@pttesac.UUCP (Robert Rodriguez) Organization: Pacific*Bell ESAC, San Francisco, Ca. Lines: 74 Summary: This might work... In article <7600003@uiucdcsm> hartman@uiucdcsm.cs.uiuc.edu writes: > >Does anyone have a program for the 3b1/7300 which will toggle ph0 >between VOICE and DATA like F3 does from within the phone manager? >I am looking for something that can be placed in crontab to switch >my line to DATA at night. > >------------------------------------------------------------------- >Mark Hartman ihnp4!uiucdcs!hartman /* * * phstat A quick hack to get the status of the phone line so * we can decide whether or not to toggle it. * * At home, I have only one line, so when I leave for work * I want my phone line set to DATA. I run a shell script * from cron at 7:00 AM, that goes something like this: * * * Status=`/usr/lbin/phstat /dev/ph0` * * if [ "$Status" = "VOICE" ] ; then * /usr/bin/phtoggle * fi * * * Again, this was a quick hack, and I'm sure it could be * done better, so no flames please. * * * Robert Rodriguez {inhp4|ptsfa}!pttesac!robert */ #include /* * We could include fcntl.h, but why ? */ #define O_RDWR 2 #define O_NDELAY 04 main(argc, argv) int argc; char **argv; { int fd; struct updata phdata; if(argc != 2) { printf("Usage: phstat \n"); exit(1); } if((fd = open(argv[1], O_RDWR | O_NDELAY)) != 0) exit(1); if((ioctl(fd, PIOCGETP, &phdata)) != 0) exit(1); if(phdata.c_lineparam & VOICE) printf("VOICE\n"); else printf("DATA\n"); close(fd); exit(0); } Hope this helps.....