1

I tried to use echo -n '2-2' > /sys/bus/usb/drivers/usb/unbind to unbind a USB device that connects to FTDI chip, but I found that it get auto binded right after I run the command.

My lsusb -t looks like:

/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 2: Dev 6, If 0, Class=Vendor Specific Class, Driver=usbfs, 5000M
    |__ Port 2: Dev 6, If 1, Class=Vendor Specific Class, Driver=usbfs, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/10p, 480M

My lsusb looks like:

Bus 002 Device 006: ID 0403:**** Future Technology Devices International, Ltd 
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

ls /sys/bus/usb/devices has:

1-0:1.0  2-0:1.0  2-2  2-2:1.0  2-2:1.1  usb1  usb2

After I run sudo bash -c 'echo "2-2" > unbind', my dmesg outputs following new messages

[Jan15 11:03] usb 2-2: USB disconnect, device number 3
[  +0.272120] usb 2-2: new SuperSpeed USB device number 4 using xhci_hcd
[  +0.020880] usb 2-2: New USB device found, idVendor=0403, idProduct=***
[  +0.000006] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  +0.000003] usb 2-2: Product: FTDI **********
[  +0.000003] usb 2-2: Manufacturer: FTDI
[  +0.000002] usb 2-2: SerialNumber: 000000000001

You can see that USB is disconnected, but then new USB is found and get assigned a new device number. It feels like my USB device is rebinded instead of unbind. Does anyone know the reason? Thanks!

More information: I tried run echo -n usb2 > /sys/bus/usb/drivers/usb/unbind to unbind bus 2, it works and dmesg shows:

[Jan15 12:33] usb 2-2: USB disconnect, device number 8

My ls /sys/bus/usb/devices changed to:

1-0:1.0  usb1  usb2

which I feel incorrect. From my understand 2-0:1.0 should alaways be there? Then I tried to add bus2 back by echo -n usb2 > /sys/bus/usb/drivers/usb/bind, I got error in dmesg

[Jan15 12:48] usb usb2: can't set config #1, error -22
Ling Li
  • 11
  • 2
  • @vssher Thanks. I tried **echo -n 2-2 > /sys/bus/usb/drivers/usb/unbind** with sudo privilege but it produces same result. USB disconnects then new device is found again. – Ling Li Jan 15 '20 at 16:52
  • Sorry about that last post, have a look at this, please : __the contents of /sys/bus/usb/devices/ are__ 1-0:1.0 1-1:1.0 1-2:1.0 1-2:1.2 2-0:1.0 4-0:1.0 4-1:1.0 6-0:1.0 8-0:1.0 8-2:1.0 usb2 usb4 usb6 usb8 -- & -- 1-1 1-2 1-2:1.1 1-2:1.3 3-0:1.0 4-1 5-0:1.0 7-0:1.0 8-2 usb1 usb3 usb5 usb7 https://stackoverflow.com/questions/18765725/turning-off-a-single-usb-device-again – vssher Jan 15 '20 at 17:07
  • If it turns back on it sounds like something has a connection with it that is turning back on. – vssher Jan 15 '20 at 17:42
  • @vssher, maybe you are right. I've also added more information in my post. Can you take a look?Why can I disconnect bus2 but can't added it back? Thanks! – Ling Li Jan 15 '20 at 17:54
  • You might have a try at this software which helps you read what is going on with the device at a low level _LibUSB_ (Linux, Windows, MacOS) https://libusb.info/ – vssher Jan 15 '20 at 18:07
  • The path to the real page (today is here: very complicated, but I'm sure you can handle this software) https://github.com/libusb – vssher Jan 15 '20 at 18:29
  • @vssher Thank you, I will give it a try! – Ling Li Jan 16 '20 at 21:41

0 Answers0