linux-kernel usb – USB Device Not Responding to Set Address

linux-kernelusb

I have a built-in USB device that is not responding to setup address. It tries to set the device up continuously and fails continuously: wasting battery, CPU, disk space, etc.

Is there a way to kill the USB port or otherwise stop the kernel from trying to configure it?

I've tried rebooting, using uhubctl (not known as a smart hub), playing with port's power/autosuspend_delay_ms (gets input/output error), playing with the port's power/control (already auto), playing with the hub's power/level (invalid argument). Of course, I cannot try another cable–it is an embedded device.

And I would prefer to not disable the hub entirely, but I'd be willing to try it. I can virtually remove the PCI card via Linux, but that takes out stuff I actually need (the high speed USB hub).

I'm going to guess that the device is actually a laptop fingerprint reader that I've never used or been able to use, but I remember being around.

[ 7283.684834] usb usb1-port7: attempt power cycle
[ 7284.312659] usb 1-7: new full-speed USB device number 41 using xhci_hcd
[ 7284.312858] usb 1-7: Device not responding to setup address.
[ 7284.516966] usb 1-7: Device not responding to setup address.
[ 7284.724647] usb 1-7: device not accepting address 41, error -71
[ 7284.838653] usb 1-7: new full-speed USB device number 42 using xhci_hcd
[ 7284.838852] usb 1-7: Device not responding to setup address.
[ 7285.044852] usb 1-7: Device not responding to setup address.
[ 7285.252760] usb 1-7: device not accepting address 42, error -71
[ 7285.252861] usb usb1-port7: unable to enumerate USB device
[ 7285.366647] usb 1-7: new full-speed USB device number 43 using xhci_hcd
[ 7285.480810] usb 1-7: device descriptor read/64, error -71
[ 7285.702811] usb 1-7: device descriptor read/64, error -71
[ 7285.918653] usb 1-7: new full-speed USB device number 44 using xhci_hcd
[ 7286.032729] usb 1-7: device descriptor read/64, error -71
[ 7286.254780] usb 1-7: device descriptor read/64, error -71
[ 7286.356717] usb usb1-port7: attempt power cycle
Repeat forever

Running lsusb of course does not report the device. However, the upstream hub is:

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
00:14.0 USB controller: Intel Corporation 100 Series/C230 Series Chipset Family USB 3.0 xHCI Controller (rev 31)

Best Answer

While, as the OP told, some USB hubs have an additional protocol allowing to power off a single port, thus easily solving the problem with the use of uhubctl, most USB hubs, internal included, have no such control.

What is still possible in Linux is to ask the kernel to disable the use of an USB device by writing 0 to the authorized control file of this device in the /sys/bus/usb/devices tree. For a device that behaves normally, this would solve the problem, but not for a device that is disconnecting and connecting back all the time.

Still, when any USB hub is thus disabled, it will disable and power off all its ports. So disabling the USB hub where the device is connected will effectively disable and power off the misconducting device. If the loss of any other connected device to this hub is acceptable then that's a possible method.

Writing back 1 to the authorized file will again enable the device, and for a hub, power back on its ports, powering back any connected device.

Example:

# cat /sys/bus/usb/devices/2-1/product
USB2.0 Hub
# echo 0 > /sys/bus/usb/devices/2-1/authorized
# dmesg|tail -1
[226616.900051] usb 2-1.3: USB disconnect, device number 30

usb 2-1.3 was a keyboard and its LEDs go off.

# echo 1 > /sys/bus/usb/devices/2-1/authorized
# dmesg|fgrep 2-1|tail -10
[227055.203089] hub 2-1:1.0: USB hub found
[227055.204441] hub 2-1:1.0: 4 ports detected
[227055.213891] usb 2-1: authorized to connect
[227055.405342] usb 2-1.3: new low-speed USB device number 41 using xhci_hcd
[227055.511969] usb 2-1.3: New USB device found, idVendor=413c, idProduct=2113, bcdDevice= 1.08
[227055.511975] usb 2-1.3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[227055.511978] usb 2-1.3: Product: Dell KB216 Wired Keyboard
[227055.520754] input: Dell KB216 Wired Keyboard as /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1.3/2-1.3:1.0/0003:413C:2113.001A/input/input136
[227055.583032] input: Dell KB216 Wired Keyboard System Control as /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1.3/2-1.3:1.1/0003:413C:2113.001B/input/input137
[227055.641748] input: Dell KB216 Wired Keyboard Consumer Control as /devices/pci0000:00/0000:00:14.0/usb2/2-1/2-1.3/2-1.3:1.1/0003:413C:2113.001B/input/input138
Related Question