Hi Ted
On Tuesday 31 October 2006 20:26, Ted Harding wrote:
Then it would be easy to have a little script running in the background which would monitor the lines on the serial port, and initiate a shutdown if the voltage dropped to zero for (say) more than a minute.
That's the bare bones of the idea, and indeed enough to define a basic soldering-iron job!
Throwing a couple more ideas in to the pot..
Both the serial port and the parallel port can be set up to trigger an interrupt on a change of state - A tiny $trivial kernel module could sit quietly in the background waiting to be triggered.. This module need do nothing more than to initiate your shutdown script in usr space.
Using interrupts has the advantage that you don't have to schedule a script to poll the status of a port... Why, it is even possible to write a user space program to handle the interrupt mechanism and saves you from the joys of programming in kernel space.
Which ever way you go, parallel port, or serial port, please use a plugin card and/or opto-isolators. Should anything nasty happen with the el-cheapo PSU, you won't lose the ports on the motherboard.
hrmm... Another idea if you're a whiz with the iron... The serial port can supply a few milliamps of +/-12V - Use this to power a small amplifier, the input being a pickup coil v.close to the cable feeding the UPS. Tuned to 50Hz, the signal would disappear in the event of a power failure.
Some reading material: http://people.redhat.com/twaugh/parport/parportbook.ps.gz has some info on user space interrupts with the parallel port..
Regards, Paul.