Resetting USB device

Hey guys.

I need help with resetting a hanging UDB device programmatically. The problem seems common, but none of the solution worked for me on this device. Ideally I’d like to be able to depowerer a plugged device regardless it detected as plugged or not (it hangs both ways).

PS. uhubctl seems doing what’s needed, but it doesn’t see the USB3 hub. Only USB2. So, the device remains hanging.

You could try someting like this (as root):

echo -n 0 > /sys/bus/usb/drivers/usb/1-5/authorized
echo -n 1 > /sys/bus/usb/drivers/usb/1-5/authorized

It will restart the usb hub port, therefore it acts the same as unplug and plugging in.

Hi Eric,

I tried this. It doesn’t seem to make the device reset (or even disappear from lsusb).

The “1-5” device represents the remote device. I thought it may work with a usb-hub device (“usb1”). Indeed, it made the device disappear, but I couldn’t make it appear again.

1-5 probably is not the correct address of your device, if so you are lucky, it was just an example. You need to find it, try using:

lsusb -tvv

Ni Eric,

I did so with my device address, not the example one.

If I disable the device but it still searchable through lsusb (even if not accessible), it means the device is still powered, right?

Doing so with the hub device might actually do the job of depowering, but if I then can’t make the device back accessible, it is not very useful.

Sergei

There are very very few usb hubs that actually switch power. On 99% the power does not get switched. The hardware simply is not capable of switching it.

What it does is restarting the driver. In most cases it resets the device. It should be similar to:

echo '1-5' > /sys/bus/usb/drivers/usb/unbind
echo '1-5' > /sys/bus/usb/drivers/usb/bind

But it could not hurt to try this version.

Check this repo:

mvp/uhubctl: uhubctl - USB hub per-port power control (github.com)