tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Reboot resistant USB bug



On 11/10/2018 15:11, Emmanuel Dreyfus wrote:
Hello

On both netbsd-8 and -current, I have a problem with USB devices that
get stuck in a non-functionning state even after a reboot.

This happens after interrupting transfer with different NFC readers
from different vendors, and the only way to recover the device is
to power-cycle it. I wonder if there could be a missing step in the
way we initialize USB devices that could explain that situation.

Once I have a device in bad state, on reboot I get (usb0 chilren omitted):
xhci0 at pci0 dev 20 function 0: vendor 8086 product a36d (rev. 0x10)
xhci0: interrupting at msi0 vec 0
xhci0: xHCI version 1.10 not known to be supported
usb0 at xhci0: USB revision 3.0
usb1 at xhci0: USB revision 2.0
uhub1 at usb1: vendor 8086 (0x8086) xHCI Root Hub (0000), class 9/0, rev 2.00/1.00, addr 0
uhub1: 16 ports with 16 removable, self powered
uhub1: port 5, set config at addr 2 failed
uhub1: device problem, disabling port 5

I do not think the problem is specific to xhci, since I also observed it
on a uhci based system.

The calling stack leading to the set config failed is:
usbd_reattach_device() at netbsd:usbd_reattach_device
xhci_new_device() at netbsd:xhci_new_device+0xfb2
usbd_new_device() at netbsd:usbd_new_device+0x83
uhub_explore() at netbsd:uhub_explore+0xca3
usb_discover() at netbsd:usb_discover+0x82
usb_event_thread() at netbsd:usb_event_thread+0x55

I have a huge trace of usb/uhub/xhci debug output, where I can see
that the kernale is able to pull descriptors from the device:
000004.188673 usbd_reload_device_desc#4@1: bLength                18
000004.188673 usbd_reload_device_desc#4@1: bDescriptorType         1
000004.188673 usbd_reload_device_desc#4@1: bcdUSB               2.00
000004.188673 usbd_reload_device_desc#4@1: bDeviceClass            0
000004.188673 usbd_reload_device_desc#4@1: bDeviceSubClass         0
000004.188673 usbd_reload_device_desc#4@1: bDeviceProtocol         0
000004.188673 usbd_reload_device_desc#4@1: bMaxPacketSize0         8
000004.188673 usbd_reload_device_desc#4@1: idVendor            0xcc 0x4
000004.188673 usbd_reload_device_desc#4@1: idProduct           0x33 0x25
000004.188673 usbd_reload_device_desc#4@1: bcdDevice            1.00
000004.188673 usbd_reload_device_desc#4@1: iManufacturer           1
000004.188673 usbd_reload_device_desc#4@1: iProduct                2
000004.188673 usbd_reload_device_desc#4@1: iSerial                 0
000004.188673 usbd_reload_device_desc#4@1: bNumConfigurations      1

But the trace finishes with:
000004.195189 usbd_get_config_desc#4@1: confidx=0, bad desc len=120 type=120
000004.195189 usbd_set_config_index#4@1: get_config_desc=4
000004.195189 usbd_probe_and_attach#2@1: port 5, set config at addr 2 failed, er
ror=4

Any hint?

Can you make the trace available somewhere, please?

Nick



Home | Main Index | Thread Index | Old Index