On Fri, Feb 14, 2014 at 10:26:53PM +0400, Kirill Bychkov wrote: > On Fri, February 14, 2014 17:07, Andre de Oliveira wrote: > > hello. > > > > blambert@ suggested me to write a driver for exposing usb-based > > uninterruptable power systems devices data as sysctl(8) sensors, thus > > enabling people to write "shutdown policies" using sensorsd(8), which > > can replaces apcupsd in some cases. > > > > I received some feedback from reyk@ and blambert@, hope it's now ok for > > tech@ comments. > > > > -a > Hi. > Tested with upd0 at uhub2 port 1 "American Power Conversion Back-UPS RS 500 > FW:30.j5.I USB FW:j5" rev 1.10/0.06 addr 2 > kirby@humppalaki:ttyp0<kirby> % sysctl hw.sensors.upd0 > hw.sensors.upd0.volt0=1.20 VDC (battery nominal volt) > hw.sensors.upd0.volt1=0.00 VDC (battery current volt) > hw.sensors.upd0.indicator0=Off (battery charging) > hw.sensors.upd0.indicator1=Off (battery discharging) > hw.sensors.upd0.indicator2=On (battery present) > hw.sensors.upd0.indicator3=Off (shutdown imminent) > hw.sensors.upd0.indicator4=On (acpower present) > hw.sensors.upd0.percent0=100.00% (battery load)
Kirill, thank you very much for the test. > Currently the problem is when UPS is attached as /dev/updX, apcupsd > stops working. So shpuld /dev/upd be enabled by default? You are right, I added a caveats session to the manpage explaining this. > And another moment. What is about MODBUS? Are you going to support > other APC protocols? I'm monitoring apcupsd mailing lists and it > doesn't look like APC is giving all the documentation for developers > on demand. I don't know, my current needs are just for USB devices, iirc modbus works over rs232 and tcp. A driver for ups based on tcp-connection the doesn't sounds to have a chance to get into base. Do you have this kind of device? let me know. > As it looks to me, this driver is going to have half of apcupsd usb > devices support to be really useful. It has been tested with the two devices we already have in usbdevs_data.h: http://bxr.su/OpenBSD/sys/dev/usb/usbdevs_data.h#621 -a