Friday, June 1, 2012

Unable to enumerate USB device

SkyHi @ Friday, June 01, 2012

Some hardware just don’t work with ehci_hcd on Karmic Koala. My memory stick from transcend refused to work no matter what I did. After plugging the device nothing happened, doing dmesg showed me the following error:
Apr 18 10:59:04 dpac-laptop kernel: [73668.388060] usb 1-2: new high speed USB device using ehci_hcd and address 5
Apr 18 10:59:04 dpac-laptop kernel: [73668.473034] hub 1-0:1.0: unable to enumerate USB device on port 2
After searching a lot, I came to a conclusion that my device doesn’t work with USB 2.0. So I disabled the ehci_hcd to make it work.
Since Karmic doesn’t use ehci_hcd as a module, modprobe -r ehci_hcd no longer works. The module is compiled into kernel. To disable it execute the following commands in terminal:
1
2
cd /sys/bus/pci/drivers/ehci_hcd
ls
You will see a file with 0000:00:xx.x format. Execute the following command:
1
sudo sh -c 'echo -n "0000:00:xx.x" > unbind'
Replace the xx.x with the numbers displayed on your file. It should disable the ehci_hcd.
I plugged in my memory stick, and it worked.
Please note that you’ll have to do all this each time you restart.
UPDATE
You can now use the following script to disable ehci_hcd. It is far more simpler since it just needs you copy pasting the commands instead of a manual action. Here it goes:
1
2
cd /sys/bus/pci/drivers/ehci_hcd/
sudo sh -c 'find ./ -name "0000:00:*" -print| sed "s/\.\///">unbind'



At some moment, my USB WLAN stick stopped working, and the log was polluted by messages like:
usb 6-1: new high speed USB device using ehci_hcd and address 62
hub 6-0:1.0: unable to enumerate USB device on port 1
hub 6-0:1.0: unable to enumerate USB device on port 1
At first, I decided that the stick had broken after years of work, but out of curiousity tried to connect it to every USB port I found. It worked. The stick worked again when plugged into the keyboard, which in term was connected to the KVM.
What is funny, I did nothing, but after a few days the stick worked again correctly in its original port. I forgot about the problem. But after yet another vacations, the problem appeared again, and again disappeared in a few days.
I have no idea why.
But I finally found a solution here: [Solved] Unable to enumerate USB device (Disabling ehci_hcd). I need to disable ehci_hcd. In my case, the commands is:
# cd /sys/bus/pci/drivers/ehci_hcd
# echo -n "0000:00:1a.7" > unbind
As a side effect, I do not have USB 2.0 on this bus anymore, but it is not a problem.

24.02.2010, update

To issue the command automatically on boot, one could edit/etc/rc.local, but in my case I need to have network loaded before. The best solution (I hope) is based on advice here:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/354832
You can disable this on boot by creating a /etc/udev/rules.d/disable-ehci.rules file containing:
ACTION=="add", SUBSYSTEM=="pci", DRIVER=="ehci_hcd", \
        RUN+="/bin/sh -c 'echo -n %k > %S%p/driver/unbind'"





REFERENCES
http://www.geekdevs.com/2010/04/solved-unable-to-enumerate-usb-device-disabling-ehci_hcd/
http://uucode.com/blog/2011/01/18/solved-unable-to-enumerate-usb-device-on-port-1/