John Goerg <john at krwc1360.com> writes:

> David Dyer-Bennet wrote:
>  >No, the normal way to monitor the discrete ouput (stupid) UPSs has
>  >always been through a serial port (but not with a standard serial
>  >cable).  There are a bunch of lines you can directly monitor and
>  >control on a serial port -- DCD, DTR, DSR, CTS, RI, stuff like that.
> 
> Yes, that works too, I just didn't know you were hardware hacking that
> much.:)
> 
> David Dyer-Bennet also wrote:
>  >I think I've got a valid cable.  I can see on the breakout box how
>  >various lines change state when the UPS changes state.
> 
> OK, sounds like you got your cabling under control, back to the
> software. ( Something I don't know anything about!) Good Luck.

There's *something* I don't have under control.  Nothing I've tried
has been able to get the attention of any monitor program on the
serial port. 

I *did* switch the modem over, and qpage can use the modem just fine
on /dev/ttyS1.  

So I switched back again.  What can be wrong?  Not the cable, I used
the same cable to the modem.  Possibly the adapter that connects the
cable to the breakout box; but signals come through and light the
lights I'd expect.  Possibly the connections I make to try to tickle a
line.  Possibly the lines I choose to tickle -- but I tried all of
them.  What else?

So, on the connections -- I've tried connecting pin 20 (DTR; light
showing red for negative voltage) to various things both direct and
through a 4.7k resistor.  I've also tried grounding the other things
(to pin 7, SG).  

Then I wrote my own little monitoring program, which is at least
simple.  It detects an immediate change, and then no change no matter
what I do.

My stupid program looks like this:

/*
 *  Monitor pins on serial port.
 *
 *  Purpose is to try to figure out why the *&^*( I can't monitor my UPS.
 */

#include <stdio.h>
#include <unistd.h>
#include <termios.h>
#include <fcntl.h>
#include <sys/ioctl.h>

int main (int argc, char **argv) {
  int fd, res, nbits, obits;

  /* Open the serial port */
  fd = open ("/dev/ttyS1", O_NOCTTY | O_RDWR);
  if (!fd) {
    printf ("Failed to open tty\n");
  }

  obits = 0;

  /* Loop until they change */
  /* Report them */
  while (1) {
    if (nbits != obits) {
      printf ("Bits are: %08x\n", nbits);
      obits = nbits;
    }
    res=ioctl(fd, TIOCMGET, &nbits);
  }

  close (fd);
  exit (0);
}


-- 
David Dyer-Bennet, dd-b at dd-b.net  /  New TMDA anti-spam in test
 John Dyer-Bennet 1915-2002 Memorial Site http://john.dyer-bennet.net
        Book log: http://www.dd-b.net/dd-b/Ouroboros/booknotes/
         New Dragaera mailing lists, see http://dragaera.info