OpenBSD Journal

Call for Testing: upd(4)

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)


Comments
  1. By Anonymous Powered (anon) on

    It can be monitored in sensorsd like so:

    hw.sensors.upd0.indicator0:low=1:high=2:command=echo "who turned %2 the lights?" | mail -s "power sensors" root
    And from snmp:

    $ snmpctl snmp walk localhost oid 1.3.6.1.4.1.30155.2.1.2.1 | fgrep .5=
    sensorEntry.sensorIndex.5=5
    sensorEntry.sensorDescr.5="ACPresent"
    sensorEntry.sensorType.5=9
    sensorEntry.sensorDevice.5="upd0"
    sensorEntry.sensorValue.5="on"
    sensorEntry.sensorUnits.5=""
    sensorEntry.sensorStatus.5=0

  2. By Anonymous Coward (24.113.147.35) on

    Where is the list of hardware this is for? Is this meant for normal APC UPS devices that have a normal USB connection? (probably a dumb question, but I didn't see a list of supported hardware in the manpage)

    Comments
    1. By byte (2001:470:1f0a:990::2) on

      > Where is the list of hardware this is for?

      http://www.openbsd.org/cgi-bin/cvsweb/src/sys/dev/usb/upd.c?rev=1.5;sortby=date

      Look for "VENDOR".

    2. By Andre de Oliveira (deoliveiraa) on

      > Where is the list of hardware this is for? Is this meant for normal APC UPS devices that have a normal USB connection? (probably a dumb question, but I didn't see a list of supported hardware in the manpage)

      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
      1. By Anonymous Coward (anon) on

        > > Where is the list of hardware this is for? Is this meant for normal APC UPS devices that have a normal USB connection? (probably a dumb question, but I didn't see a list of supported hardware in the manpage)
        >
        > 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.

Latest Articles

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]