Contributed by tbert on from the no-breaks-for-the-wicked dept.
Andre de Oliveira (andre@) has committed the upd(4) driver, which detects uninterruptible power supplies (UPS) attached to USB, which will show up in the dmesg:
uhidev0 at uhub1 port 1 configuration 1 interface 0 "American Power Conversion Back-UPS RS 500 FW:30.j5.I USB FW:j5" rev 1.10/0.06 addr 2 uhidev0: iclass 3/0, 98 report ids upd0 at uhidev0
The UPS will then have a few sensors attached, which will show you running on battery:
% sysctl hw.sensors.upd0 hw.sensors.upd0.indicator0=Off (Charging) hw.sensors.upd0.indicator1=On (Discharging) hw.sensors.upd0.indicator2=Off (ACPresent) hw.sensors.upd0.indicator3=On (BatteryPresent) hw.sensors.upd0.indicator4=Off (ShutdownImminent) hw.sensors.upd0.percent0=100.00% (FullChargeCapacity) hw.sensors.upd0.percent1=94.00% (RemainingCapacity)
And charging:
% sysctl hw.sensors.upd0 hw.sensors.upd0.indicator0=On (Charging) hw.sensors.upd0.indicator1=Off (Discharging) hw.sensors.upd0.indicator2=On (ACPresent) hw.sensors.upd0.indicator3=On (BatteryPresent) hw.sensors.upd0.indicator4=Off (ShutdownImminent) hw.sensors.upd0.percent0=100.00% (FullChargeCapacity) hw.sensors.upd0.percent1=91.00% (RemainingCapacity)
Please note that this still requires an additional patch:
upd(4) is now enabled to be built for amd64, macppc and sparc64, thanks to mpi@ uhidev diff. still, to get it attaching correctly, these vendor/product id pairs need to be removed from usb_quirks.c. read it as: these devices won't attach to ugen anymore.
Please note that this is a new driver under active development, so your UPS may not be supported. The only way that OpenBSD will get out-of-the-box support for these devices is for as wide a variety as can be tested to get tested, so patch, build, attach, and report any and all failures to the author.
UPDATE: andre@ has made it known that this no longer requires a patch; snapshots that are built after the time of publication should have the change.
(Comments are closed)
By Anonymous Powered (anon) on
By Anonymous Coward (24.113.147.35) on
Comments
By byte (2001:470:1f0a:990::2) on
http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/usb/upd.c?rev=1.5;sortby=date
Look for "VENDOR".
By Andre de Oliveira (deoliveiraa) on
It is an USB hid-standard based implementation.
Don't be afraid, download a recent snapshot, plug your UPS usb cable and enjoy the fun.
Comments
By Anonymous Coward (anon) on
>
> It is an USB hid-standard based implementation.
> Don't be afraid, download a recent snapshot, plug your UPS usb cable and enjoy the fun.
The majority of USB UPS use one of two basic types of interface - one is basically rs232-over-usb, and the other is a "HID power device", this driver is for the latter.
If you have a non-working device, it would be useful to post pkg_add usbutils and post the relevant output from "lsusb -v" for the device, along with the usual dmesg/description of what happens.