?

Log in

No account? Create an account

Previous Web | Next Web

NUTty...

Alot of this weekend was spent hacking away at the NUT newhidups driver, or more specifically, the belkin-hid subdriver there-of.

I now have a driver that does the same things as my hacked version of the belkinunv driver, that is, it has "waitonshutdown" and "wait" functionality implemented to work around the rather crappy Belkin UPS hardware that doesn't do "wait for a certain battery charge level before turning the load back on".

I've also come across an annoyance in another part of NUT, upsdrvctl. Because the way that the waitonshutdown hack works, there are problems. Basically, before upsdrvctl attempts to load the driver in order to tell it to shutdown, it sets a timed alarm in order to pick up when a driver has failed to load. Unfortunately, when you actually *want* a driver to just sit there, the alarm gets triggered and upsdrvctl exits with an error...

So I now need to try to work out if its possible to cancel that alarm when the driver gets loaded... that would make things work "properly." At the moment, the alarm means that the system will only sit and wait for five or ten minutes (I can't remember exactly how long the alarm is for) and then the system ends up going through with the normal system shutdown process and (because its an AT box), ends up sitting saying "Power down." So at the moment, the system isn't really capable of recovering from a power outage *unless* the outage lasts long enough to drain the UPS battery.

I've also had to setup a slightly odd bit of system hackery to be able to run the driver in the shutdown and startup scripts... Because the driver is for a USB device, it needs access to the libusb.so shared library... but at the point that the driver is being used, the library files aren't available, as their on the /usr filesystem, which is mounted... so now I have the libusb files in the /usr/lib directory of the root filesystem, so they can be found at startup/shutdown. After the system mount /usr, the 'proper' librarys, etc are available as normal. Of course, I haven't tested this yet, but it should work in theory... its not really on to have the UPS bleeping away while I test things at this time of night...

Not a bad couple of days really...