My Netgear WiFi stick (using the ath9k_htc driver) on my Raspberry Pi periodically gets into a bad state that results in USB read errors in dmesg. This state cannot be corrected by a system reset, but requires a full power cycle of the USB device, either by unplugging it and plugging the USB stick back in, or power cycling the whole computer.

I have read that it is possible to programmatically cycle power to a USB device using a USB hub. So I have tried this with my inland 4 Port USB 2.0 Hub based on the information in this posting:


But the lights on the USB WiFi stick stay glowing even after issuing the command below, although it does make the wlan0 device disappear. I tried it on a Belkin 4-Port Hub with the same results. Anybody have any ideas?

echo '1-1.2.3' | tee /sys/bus/usb/drivers/usb/unbind

Details of my usb connections:

pi@fpi-16 ~ $ sudo lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/3p, 480M
        |__ Port 1: Dev 3, If 0, Class=vend., Driver=smsc95xx, 480M
        |__ Port 2: Dev 4, If 0, Class=hub, Driver=hub/4p, 480M
            |__ Port 1: Dev 5, If 0, Class=vend., Driver=rt2800usb, 480M
            |__ Port 3: Dev 6, If 0, Class=vend., Driver=ath9k_htc, 480M

If your USB host driver is compiled as a kernel module you can try to unload it and reload it. This should usually also power off totally the USB (I did it on other devices with faulty USB hardware that need to be electrically reset, not specifically on the Rasperry Pi which I don't have sorry). So check if you see it as a module (lsmod) or compile it as a module and later on rmmod it (and all the dependencies eventually) and reload it again, it should do the trick.


Here is an app that can do just what you need: https://github.com/codazoda/hub-ctrl.c

For installation and usage instructions see README.md.

It may take some trial and error to figure out which hub and port does correspond to each USB port, which seems to vary depending on the Raspberry Pi model.

Power cycling can be achieved in a single command by sending a p 0 command (power off) followed by a p 1 (power on).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.