USB slots stop working suddenly from time to time

Power issues for USB 2.0

USB 2.0 has a maximum current draw available of 500mA, however it should be noted that the +5V on several ports may actually be on the same bus. For example on a desktop case the USB ports on the front of the machine may all be on the same bus, while the ports on the back of the machine will normally be a a different bus, or have completely separate +5V supplies for each group of USB 2.0 sockets.

A low current device as defined by the USB 2.0 standards can draw up to 100mA (1 unit) while high current devices can draw up to 5 units (500mA). Hard drives with no external source of supply are typically high current devices.

Devices should stop working if the +5V line drops below 4.75V and this is why many high power devices can cause problems on some computers.

In addition to this the circuit that supplies +5V to each bus may refuse to re-negotiate high power capability if the device is drawing enough current to pull the +5V line too low. This is why high power devices will need to be removed and re-attached before they will work if they have failed due to a power problem, and also why a reboot does not allow them to re-attach while a full power down/up cycle may do so.

Note that if one or more low power devices are already plugged into a USB bus, there may not be enough capacity available to also run a high power device such as an external hard drive.

Using high power devices therefore needs to be planned for, and if problems exist the device needs to be used on it's own on any one bus or given a separate +5V supply.

While the USB 2.0 standards document might be a little difficult to read, there is some very good information and explanations in the wikipedia page on the subject of USB 2.0

Also note that plugging in many low power devices such as through an external USB hub device can also cause a voltage drop on the bus supply line, causing some or all of the devices to be disabled.

The types of cables used may also affect the reliability of high power devices. For example an external hard drive plugged in via a regular long USB cable may see enough of a voltage drop at 500mA to disable itself to prevent damage to its circuitry or drive motors. These devices are typically supplied with a special short cable, or a 'Y' cable that plugs into two USB ports to help with the power problem. Note that this only a partial solution to the problem relating specifically to the cabling issue, it's doesn't actually allow more than 500mA to be supplied since adjacent USB ports are likely to be on the same 5V 500mA supply internally in the computer. Even where a separate bus is used for the second plug on the 'Y' cable it won't be able to get a high current supply since it has no data connection to request it from the USB bus. Only one of the ports will be enabled as a high current supply.

Since the very common use of USB keyboards and mice, problems can sometimes occur when these are both plugged into the same bus. Peak load currents at power-on can exceed the design specification of the USB bus and cause one or both of the devices to be disabled or to malfunction.

Solutions to these problems usually involve using only a minimum of low power devices, using only well designed and made low power devices, making sure they are plugged into different buses with separate +5V lines, and where high power devices are involved using a powered hub to help with the supply problems seen on many USB 2.0 bus supplies. If it's not possible to use a powered hub, then the high power device should only be plugged in after the computer is powered up and the current drain from low power devices has stabilised.

It should also be noted here that computers such as laptops and netbooks may have low power USB devices incorporated internally. Hardware such as internal card readers, wireless 3G adapters, and webcams are often connected internally to a USB bus. This may be a dedicated bus with it's own +5V power, or it may be shared with one or more external USB ports.


Something similar to this was happening to me. This blog post provided a partial solution.

This is what worked for me:

sudo -s
cd /sys/bus/pci/drivers/xhci_hcd/
for file in ????:??:??.? ; do
 echo -n "$file" > unbind
 echo -n "$file" > bind
done

As noted at that block post, different systems get hung up in different places, so if the above doesn't work, you might want to try replacing /sys/bus/pci/drivers/xhci_hcd/ with /sys/bus/pci/drivers/ehci_hcd/, or /sys/bus/pci/drivers/uhci_hcd/, if one of those exists.


Old post, and replies are not relevant to USB 3.0. So here's how to reset a 3.0 Bus that stopped serving data:

su -

and as root:

echo -n "0000:06:00.0" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
echo -n "0000:06:00.0" | tee /sys/bus/pci/drivers/xhci_hcd/bind

After this, USB should start to work correctly again, just like after a restart.


Explanation

In case you're using a different driver, this is how I found what to do, use it as a reference:

A lsusb -t will output this - take a note of the xhci_hcd driver for the fast bus, it's the 3.0 driver name:

$ lsusb -t
        /:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 5000M
        /:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/2p, 480M
            |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=dvb_usb_it913x, 480M
        /:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/2p, 480M
            |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/6p, 480M
            ...etc

The directory to look for is /sys/bus/pci/drivers/xhci_hcd

        drwxr-xr-x  2 root root    0   5 21:48 ./
        drwxr-xr-x 28 root root    0   1 00:21 ../
        lrwxrwxrwx  1 root root    0   6 00:29 0000:06:00.0 -> ../../../../devices/pci0000:00/0000:00:1c.3/0000:06:00.0/
        --w-------  1 root root 4096   5 22:33 bind
        lrwxrwxrwx  1 root root    0   5 22:32 module -> ../../../../module/xhci_hcd/
        --w-------  1 root root 4096   5 22:32 new_id
        --w-------  1 root root 4096   5 22:32 remove_id
        --w-------  1 root root 4096   5 22:32 uevent
        --w-------  1 root root 4096   5 22:33 unbind

In my case I needed to unbind "0000:06:00.0".

ps. If you need to rebind the USB 2.0 driver, follow the above instructions but with ehci-pci, or look here (deserves a credit).