I have a USB hard disk. When I plug it in onto my xhci_hcd bus then usually it won't be listed by
lsusb. If I do
udevadm monitor --kernel --property, no sign of the device being plugged in appears.
There are two things that will eventually succeed in making the device visible either in combination or alone:
- shutting the lid (and thus sending the system into suspend to RAM state)
- unbinding and rebinding the USB driver to the USB bus:
echo -n 0000:19:00.0 > /sys/bus/pci/drivers/xhci_hcd/unbind echo -n 0000:19:00.0 > /sys/bus/pci/drivers/xhci_hcd/bind
I would like to understand, how detection works, i.e. which layer is it, that is "malfunctioning" here and why?
As far as I know:
the first step in the communication between device and host is that the device inserts a resistance into the electrical loop which makes the host (or the hub?), aware of the physical (electrical) presence of the device. Is this correct? Does the HW (the hub/the bus?) signal this electrical event (to the bus driver)? Should
udevadm monitor --kernel --propertyshow me this event? If not is there anything else that can show me this event on the host side?
what happens next? Should this be visible in
the "transport layer" of the USB stack takes over and the host sends a USB control packet to the device, asking it for its Vendor and Product IDs. Who is responsible to do this? Is this already the bus driver software doing this or is this still in "hardware" (i.e. software on the laptop's USB hub/bus)? Should this be visible in
the host receives the answer from the device and now knows what VID/PID the device has. Does this necessarily mean that the device would be visible on
lsusbat this point?
I have scoured the internets, but haven't found a "how does device (function) detection work with USB" document yet. Short of reading the 670+ pages of the USB specification - can anybody maybe tell me:
- which steps above are executed by hardware (the hub and it's internal SW)?
- at which point does the driver get notified (an event, interrupt, it polls or whatever)?
- are there (better? more specialized?) tools that would be able to tell me earlier in the process what is going on (short of adding debug statements to the USB bus driver)?
- the bus is a
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
- and the device is a
Bus 002 Device 002: ID 1e68:001b TrekStor GmbH & Co. KG DataStation maxi g.udrive
- Debian kernel 3.16.0-4-amd64