unbinded USB device get automatically bind on linux

3k views Asked by At

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
0

There are 0 answers