13

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)
3
  • 1
    writing 0 to authorized in any device within the /sys/bus/usb/devices tree disables it. when it's a hub it disables (and powers off) all its ports. writing back 1 re enables it and rescans devices on it. uhubctl here detects only one hub (internal, intel 8087:8000) where I can disable a single port. I didn't find either how to disable a single port on hubs not shown in uhubctl.
    – A.B
    Jan 11, 2019 at 20:29
  • @A.B: This works to let me remove the upstream hub without removing the other hub. If it were an answer and no-one comes up with something better, I'd accept it. Jan 13, 2019 at 18:32
  • turned my comment into an answer
    – A.B
    Jan 13, 2019 at 23:54

2 Answers 2

7

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
1
  • 1
    I am here because after upgrade to 5.4.05-53 my USB keyboard stopped working (other USB peripherals work). Freak coincidence keyboard that stopped working is Dell KB216 Wired. I got excited that this might be a fix, but no. Yours works. Great debugging info though. Thank you
    – Williams
    Nov 12, 2020 at 0:19
1

Assuming you're using systemd (or a fairly standard Linux distribution), I would think this USB initialization is probably being done by udev, during the boot process. This link explains how udev loads and initializes devices, which based on rules files that are stored in /lib/udev/rules.d and /etc/udev/rules.d.

One of those rules files should deal with USB devices. I can't provide precise details, but I would think it should be possible to change the USB rules to exclude that particular device, based on its device path or another relevant property. You might have to poke around and try a few things.

1
  • 2
    Using udev to disable will not work. udevadm monitor shows nothing. I assume the primary problem is that the kernel cannot get far enough into the device initialization process to inform udev. Jan 13, 2019 at 18:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .