Standards Schmandards

| categories: usb, ups, linux | View Comments

The Good News

As part of upgrading my home data center to better serve Spanish House Ministries, I bought a new UPS unit with longer runtime and AVR. The good news is that the new Tripp Lite has a 50 minute runtime at 18% load (versus 35 minutes with my old APC 1500). It also has robust AVR (Active Voltage Regulation) that is confirmed to compensate for switchover to generator power.

The Bad News

The bad news is that they totally screwed up the USB port needed for the server to monitor the UPS. It locks up every few days, and even resetting the hub controller does not reset it - it ignores the reset and address assignment requests from the hub, i.e. it does not implement the mandatory reset feature of the USB 2.0 standard. Reviews indicate that even their proprietary Windows software is stymied by this defect, but Windows users accept it as par for the course, naturally. (Windows users have trouble distinguishing between hardware and software problems.)

Industry Standards to the Rescue

It can be reset by removing and reinserting the USB cable, however. So, since the USB 2.0 standard mandates that all hubs implement port power control (either individually, or at a minimum, turning off all ports on the hub), I can just power cycle the port. In the worst case, with a cheap hub, I might have to dedicate a hub to the UPS if nothing else could be turned off. Here are the relevant paragraphs from the USB 2.0 specification:

Optional Per Port Power Switching (PPPS)

Self-powered hubs may have power switches that control delivery of power downstream facing ports but it is not required. Bus-powered hubs are required to have power switches. A hub with power switches can switch power to all ports as a group/gang, to each port individually, or have an arbitrary number of gangs of one or more ports. A hub indicates whether or not it supports power switching by the setting of the Logical Power Switching Mode field in wHubCharacteristics. If a hub supports per-port power switching, then the power to a port is turned on when a SetPortFeature(PORT_POWER) request is received for the port. Port power is turned off when the port is in the Powered-off or Not Configured states. If a hub supports ganged power switching, then the power to all ports in a gang is turned on when any port in a gang receives a SetPortFeature(PORT_POWER) request. The power to a gang is not turned off unless all ports in a gang are in the Powered-off or Not Configured states.

Mandatory All Ports Off State

Although a self-powered hub is not required to implement power switching, the hub must support the Powered-off state for all ports. Additionally, the hub must implement the PortPwrCtrlMask (all bits set to 1B) even though the hub has no power switches that can be controlled by the USB System Software.

The Sad Reality

While most USB microcontrollers used in hubs properly implement one or both of these options (controlled by configuration pins), unfortunately, it seems that nearly all actual USB hubs in a box on the market ignore this mandatory feature, and just hardwire Vcc on all ports to 5V.

The Workaround

A few enterprising hardware hackers have fixed this with a soldering iron, but that was beyond the level of "enjoyable challenge" in getting this already ridiculously expensive (given my time spent) UPS to work. So I found a list of working hubs, and bought a Linksys USB2HUB4. I hooked it up just now and tested it. Woo Hoo! I can turn the LED lamp plugged into a port off and on! Now to wait for the USB port on the UPS to fail again and verify that a power cycle resets it. Assuming that works, I just need to add a hook to the NUT software on the server to power cycle the port whenever the UPS drops off the USB bus.

blog comments powered by Disqus