Return to BSD News archive
Xref: sserve comp.sys.next.programmer:10619 comp.unix.bsd:12290 Path: sserve!newshost.anu.edu.au!munnari.oz.au!constellation!convex!convex!cs.utexas.edu!asuvax!ncar!noao!CS.Arizona.EDU!not-for-mail From: kline@CS.Arizona.EDU (Nick Kline) Newsgroups: comp.sys.next.programmer,comp.unix.bsd Subject: detecting carrier for ttyfa Followup-To: comp.sys.next.programmer Date: 18 Jul 1993 03:28:39 -0700 Organization: University of Arizona CS Department, Tucson AZ Lines: 36 Message-ID: <22b8ko$a7j@cheltenham.cs.arizona.edu> NNTP-Posting-Host: cheltenham.cs.arizona.edu I can't reliably detect whether the carrier is on when I am using /dev/ttyfa. I use the call: int carrier(int ttyNum) { int result; if(ioctl(ttyNum,TIOCMGET,&result) < 0) { printf("bad ioctl\n"); return 0; } else { printf("result is %x\n",result); return result & TIOCM_CD; } } when the carrier is on, the bit for 64 should be set. it is usually, but not always. when the carrier is not on, it usually, but not always says that this bit is off. any suggestions which this wouldn't work? if I haven't used the modem lately, and i call someplace, then the carrier is initially correctly shown to be off. then if i call some place, the carrier is usually correctly shown on. if i log out, and then test the carrier bit again, it says it's still on. Is there something that needs to be done to 'flush' the state, other than redoing the ioctl? -nick