Date: Thu, 29 Jun 1995 17:14:56 +0930 (CST) From: Michael Smith <msmith@atrad.adelaide.edu.au> To: xxnguyen@utacnvx.uta.edu (Mr. TR Nguyen) Cc: freebsd-questions@FreeBSD.ORG Subject: Re: APC Backups 400 && ups daemon Message-ID: <199506290744.RAA22262@genesis.atrad.adelaide.edu.au> In-Reply-To: <199506290242.VAA22022@utacnvx.uta.edu> from "Mr. TR Nguyen" at Jun 28, 95 09:42:48 pm
next in thread | previous in thread | raw e-mail | index | archive | help
Mr. TR Nguyen stands accused of saying: > I think hackers would be a more appropriate forum, but it's kind > of swamped for the time being. Anyways, I have an A.P.C. Back-UPS 400 > with a serial connection to my FreeBSD 2.0.5R's comm port 3. > > I've unsuccessfully tried to write a simple program to read a single > byte from this port (/dev/tty02) and check whether or not the "POWER-FAIL" > bit has been raised (pin #4, according to the Owner's Manual) Urk. You're confusing pin 4 (CTS) with bit #4 in a serial data stream. > Anyone with examples/tips to share with this stumped-abuser? Yup; try this : int fd, status; fd = open("/dev/tty2",O_RDONLY); ... for(;;) { status = ioctl(fd, TIOCMGET, NULL); if (status & TIOCM_CTS) power_has_failed() sleep(60); } Haven't tested it, but it ought to work 8) Make sure you don't have a getty on the port at the same time. > TR Nguyen -- ]] Mike Smith, Software Engineer msmith@atrad.adelaide.edu.au [[ ]] Genesis Software genesis@atrad.adelaide.edu.au [[ ]] High-speed data acquisition and [[ ]] realtime instrument control (ph/fax) +61-8-267-3039 [[ ]] My car has "demand start" - Terry Lambert [[
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199506290744.RAA22262>