Is it possible to power up ports on a USB hub from Ubuntu?

I have a D-Link DUB-H7 powered USB 2.0 hub connected to my computer. Occasionally when I reboot the system, I've noticed that some of the ports on the hub get powered down: the green light next to the port is turned off, and the device attached to that port is not visible to lsusb or similar commands. Devices attached to the other ports on the hub function as normal.

I am able to restore the ports by disconnecting power to the hub temporarily (from the computer, AC adapter and any devices that might provide any power such as my phone), but this is a bit of a hassle.

It seems like something that might be related to power management, so is there some way you can tell the USB hub to power up through software?


Solution 1:

hub-ctrl will do what you need.

sudo apt-get install libusb-dev
cc -o hub-ctrl hub-ctrl.c -l usb
sudo ./hub-ctrl -v
sudo ./hub-ctrl -P 2 -p 1 # turn on port 2
sudo ./hub-ctrl -P 2 -p 0 # turn off port 2

Disclaimer: although I have tested it on Ubuntu 12.04 (precise), I did not write this utility. It does require a hub with built in power control, but given that your hub is powering down certain ports it is a good bet your hub has it.

Solution 2:

USB power has nothing to do with the OS. It depends on the device itself. Some hubs are self powered, in which case they get their power from the system; others require more power, and those have their own power supply.

A bus-powered hub is a hub that draws all its power from the host computer's USB interface. It does not need a separate power connection. However, many devices require more power than this method can provide, and will not work in this type of hub.
-- http://en.wikipedia.org/wiki/USB_hub#Power

Under Linux, you can use hwinfo --usb or for more detail try lsusb -v -t if hwinfo --usb is not installed you can install it.

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below.

sudo aptitude install hwinfo usbutils

Note:

Some self-powered hubs do not supply enough power to drive a 500mA load on every port. For example, many seven port hubs have a 1A power supply, when in fact seven ports could draw a maximum of 7 x 0.5 = 3.5A, plus power for the hub itself. Designers assume the user will most likely connect many low power devices and only one or two requiring a full 500mA. On the other hand, the packaging for some self-powered hubs states explicitly how many of the ports ports can drive a 500 mA full load at once. For example the packaging on a 7 port hub might claim to support a maximum of 4 full load devices ". So I would check with D-Link.

Most portable media devices sync data to a desktop or laptop computer via the USB port. The batteries in these devices can also be charged by that same powered USB connection. There may be situations, however, when you may need to change the default power settings of a particular USB port so the device connected to it does not interfere with the your computer's performance. For example, some types of devices connected to a computer's USB port can prevent the computer from going into its power-saving "sleep" mode. In Ubuntu Linux, there is a way to modify the power settings for the USB ports.1

Click Here

1Source: Wikipedia