Thursday, November 8, 2012

Reset USB ports in Ubuntu 12.10

From http://davidjb.com/blog/2012/06/restartreset-usb-in-ubuntu-12-04-without-rebooting

If your USB port gets mangled and a device isn't working as it should:

  tward $ lspci | grep USB 
  00:1a.0 USB controller: ...
  00:1d.0 USB controller: ...

Then do the following:

  tward $ echo -n "00:1a.0" | \
          sudo tee /sys/bus/pci/drivers/ehci_hcd/unbind
  tward $ echo -n "00:1a.0" | \
          sudo tee /sys/bus/pci/drivers/ehci_hcd/bind

For each of the above controllers. 

Be aware that after you write to unbind, anything connected to that particular USB controller will be unavailable until you write to bind on the next command. So if your keyboard is connected to one of those, you may be in trouble.

Note: See the comment below for an updated procedure.

3 comments:

  1. I have do it and matching nomber/id into my devices but not reset my USB. My mouse is still unrecognized when my USB 3 is hang. But thank you for command. I love to learn ;)

    ReplyDelete
  2. Its been a while since I did this, its possible USB 3 has changed or uses different virtual devices under sys/bus...
    I don't have USB3, and I'm using Arch now, so I can't really investigate...

    ReplyDelete
  3. Just did this on Saucy (13.10), and the EHCI folder had moved, so I had to run:

    echo -n "0000:00:1a.0" | sudo tee /sys/bus/pci/drivers/ehci-pci/unbind
    echo -n "0000:00:1a.0" | sudo tee /sys/bus/pci/drivers/ehci-pci/bind
    echo -n "0000:00:1d.0" | sudo tee /sys/bus/pci/drivers/ehci-pci/unbind
    echo -n "0000:00:1d.0" | sudo tee /sys/bus/pci/drivers/ehci-pci/bind

    ReplyDelete