s i s t e m a o p e r a c i o n a l m a g n u x l i n u x | ~/ · documentação · suporte · sobre |
Next
Previous
Contents
6. Hardware notes
6.1 How to make a cableThis section is just from messages I've seen on the net. I haven't done it so I can't write from experience. If anyone has, please write this section for me :). See also the message about the GPS1000 contained in section GPS1000 from ACCODATA, not to mention all the UPS specific data in section Info on selected UPSs.
>From miquels@caution.cistron.nl.mugnet.org Wed Jul 21 14:26:33 1993 Newsgroups: comp.os.linux Subject: Re: UPS interface for Linux? From: miquels@caution.cistron.nl.mugnet.org (Miquel van Smoorenburg) Date: Sat, 17 Jul 93 18:03:37 Distribution: world Organization: Cistron Electronics. In article <1993Jul15.184450.5193@excaliber.uucp> joel@rac1.wam.umd.edu (Joel M. Hoffman) writes: >I'm in the process of buying a UPS (Uninteruptable Power Supply), and >notice that some of them have interfaces for LAN's to signal the LAN >when the power fails. > >Is there such an interface for Linux? > >Thanks. > >-Joel >(joel@wam.umd.edu) > When I worked on the last versioon of SysVinit (Now version 2.4), I temporarily had a UPS on my computer, so I added support for it. You might have seen that in the latest <signal.h> header files there is a #define SIGPWR 30 now :-). Anyway, I did not have such a special interface but the output of most UPS's is just a relais that makes or breaks on power interrupt. I thought up a simple way to connect this to the DCD line of the serial port. In the SysVinit package there is a daemon called 'powerd' that keeps an eye on that serial line and sends SIGPWR to init when the status changes, so that init can do something (such as bringing the system down within 5 minutes). How to connect the UPS to the serial line is described in the source "powerd.c", but I will draw it here for explanation: +------------------------o DTR | +---+ | | resistor | | 10 kilo-Ohm | | +---+ To serial port. | +-----o-------+------------------------o DCD | | o UPS | \ relais | \ | | | +-----o-------+------------------------o GND Nice drawing eh? Hope this helps. SysVinit can be found on sunsite (and tsx-11 probably) as SysVinit2.4.tar.z Mike. -- Miquel van Smoorenburg, <miquels@cistron.nl.mugnet.org> Ibmio.com: cannot open CONFIG.SYS: file handle broke off. >From danny@caution.cistron.nl.mugnet.org Wed Jul 21 14:27:04 1993 Newsgroups: comp.os.linux Subject: Re: UPS interface for Linux? From: danny@caution.cistron.nl.mugnet.org (Danny ter Haar) Date: Mon, 19 Jul 93 11:02:14 Distribution: world Organization: Cistron Electronics. In article <9307174330@caution.cistron.nl.mugnet.org> miquels@caution.cistron.nl.mugnet.org (Miquel van Smoorenburg) writes: >How to connect the UPS to the serial line is described in the source >"powerd.c", but I will draw it here for explanation: The drawing wasn't really clear, please use this one in stead ! > > +------------------------o DTR > | > +---+ > | | resistor > | | 10 kilo-Ohm > | | > +---+ To serial port. > | > +-----o-------+------------------------o DCD > | > o UPS > \ relais > \ > | > +-----o--------------------------------o GND > The DTR is kept high, when the UPS's power input is gone it will close the relais . The computer is monitoring the DCD input port to go LOW . When this happens it will start a shutdown sequence... _____ Danny -- <=====================================================================> Danny ter Haar <dannyth@hacktic.nl> or <danny@cistron.nl.mugnet.org> Robins law #103: 'a couple of lightyears can't part good friends'
6.2 Reverse-engineering cables and hacking powerd.cTry to get documentation for the cables that your UPS seller supplies. In particular find out:
You then need to either hack If you have trouble getting the above information, or just want to
check it (a good idea) the following program might help. It's a
hacked version of Here's the (untested) upscheck.c program. It's untested because I edited the version I originally used to make it clearer, and can't test the new version at the moment.
6.3 Serial port pin assignmentsThe previous section presupposes knowledge of the correspondence between terminal signals and serial port pins. Here's a reference for that correspondence, taken from David Tal's ``Frequently Used Cables and Connectors'' document. I'm including a diagram illustrating the connectors, and a table listing the correspondence between pin numbers and terminal line signals. If you need a general reference for cable wiring, connectors, etc, then David Tal's would be a good one, but I can't seem to locate this document on the net any more. But I've found a good replacement. It's The Hardware Book. Other useful sites:
Incidentally, it seems that the Linuxdoc-sgml package still doesn't
format tables very well in the
1 13 1 5 _______________________________ _______________ \ . . . . . . . . . . . . . / \ . . . . . / RS232-connectors \ . . . . . . . . . . . . / \ . . . . / seen from outside --------------------------- ----------- of computer. 14 25 6 9 DTE : Data Terminal Equipment (i.e. computer) DCE : Data Communications Equipment (i.e. modem) RxD : Data received; 1 is transmitted "low", 0 as "high" TxD : Data sent; 1 is transmitted "low", 0 as "high" DTR : DTE announces that it is powered up and ready to communicate DSR : DCE announces that it is ready to communicate; low=modem hangup RTS : DTE asks DCE for permission to send data CTS : DCE agrees on RTS RI : DCE signals the DTE that an establishment of a connection is attempted DCD : DCE announces that a connection is established
6.4 Ioctl to RS232 correspondenceSince you also might need to modify
Note that the 3rd column is in Hex.
Next Previous Contents |