[Nut-upsuser] UPS has no built-in monitor. [GishPuppy]
Julian H. Stacey
jhs at berklix.com
Wed Jul 3 11:33:08 UTC 2013
Hi, Reference:
lists.vn1 at gishpuppy.com wrote:
> OS: Debian Wheezy
> Nut: 2.6.4-2.3
> Installation method: Synaptic
> Device: CDP B-UPR505
> Traces, debugs, etc.: Not available or irrelevant
>
> Description:
>
> Where I currently live (Honduras), buying a UPS with monitoring capability means spending at least twice as much as a "plain-Jane" model - usually even more than that. Thus, since I can't afford the ones with monitoring, all I have are ones that have absolutely no connection for monitoring.
>
> Many years ago, when monitoring just wasn't common yet, I developed a device to attached to a serial port and plug into an unprotected wall outlet and then wrote a C program to run as a daemon on my SCO Xenix systems to check whether that serial port could be opened or not. When the power went out, the device (not being connected to the UPS) would lose power, my program would not be able to open that serial port and the program would wait a couple of minutes (in case the power came back on) and then issue the shutdown command.
>
> Nowadays, the computers no longer have serial ports, so I have modified my concept by inserting a small relay into a USB mouse, hooking the coil to a wall transformer, cutting the USB power wire and hooking the resulting ends to the normally-open contacts of the relay. Thus, when there is power, the mouse works. When there isn't power, it's as though the mouse isn't even connected to the machine. (This can be done with an old, second mouse, so as not to interfere with the operation of the mouse I'd actually be moving around the screen.)
>
> So, here's my question: how can I get Nut to recognize such a set-up? Obviously, it's USB, but it's NOT the typical USB-HID that existing drivers would expect. With my programming experience, I'd probably be able to write the sub-driver for this, but I really don't know much about USB. For that matter, depending upon the USB information I get, I may even be able to write my own simple daemon (or even a shell script) without using Nut, at all, but it would be nice to be able to integrate it into Nut so I could have the Windows Nut client get info from the Linux machine, rather than my having to attempt such programming in the Windows environment.
>
> Of course, if someone has already developed what I described, then that would be even better, but I haven't found it in the Nut lists or documentation, yet.
>
> Thank you for any assistance you may provide.
Nice idea !
Maybe you don't even need to use NUT,
(Or could feed into back end of NUT daemon (to inform hosts & do
the countdown etc) from an alternate device input detector.)
In the case of FreeBSD, /etc/devd/*.conf allows programs to be
automatically run on connection & disconnection of a USB device,
(maybe your Linux offers similar ?).
Examples of FreeBSD USB `attach` & `detach` manual & command
/usr/src/sbin/devd/devd.conf.5
http://svnweb.freebsd.org/base/head/sbin/devd/devd.conf.5?view=markup
http://www.berklix.com/~jhs/src/bsd/fixes/freebsd/src/jhs/etc/devd/jhs.conf
Cheers,
Julian
--
Julian Stacey, BSD Unix Linux C Sys Eng Consultant, Munich http://berklix.com
Reply below not above, like a play script. Indent old text with "> ".
Send plain text. No quoted-printable, HTML, base64, multipart/alternative.
More information about the Nut-upsuser
mailing list