Bug 220127 - USB devices sometimes(!) not seen at boot time
Summary: USB devices sometimes(!) not seen at boot time
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: usb (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Only Me
Assignee: freebsd-usb (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-19 07:33 UTC by Matthias Apitz
Modified: 2017-06-30 10:33 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Apitz 2017-06-19 07:33:14 UTC
This is on CURRENT (r314251, amd64) on an Acer C720 Chromebook. I have two USB devices (small sticks designed to hold a GnuPG CCID cards, see https://gnupg.org/howtos/card-howto/en/smartcard-howto-single.html#id2503306 )which both show the following problem:

steps to reproduce
1. power-off the system
2. insert the USB device (the stick) into any USB port of the machine
3. power-on and let the system boot

Sometimes (statistically in two of three boots) the USB device is not seen by the kernel, i.e. it takes 2-3 reboots to get it seen.

When the device was seen during boot, one can withdraw it and re-attach it again. It is always seen again and works fine with the pcscd, the card daemon from ports.

When the device was NOT seen during boot, it does not help to re-attach. It is never seen by the kernel. Only re-boot helps.

When the device is seen, it shows the following lines during boot:

dmesg:

ugen0.2: <HID Global OMNIKEY 6121 Smart Card Reader> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)

ugen0.2: <Identiv uTrust 3512 SAM slot Token> at usbus0

The latter shows, when it was seen on boot, the following usbconfig output:

# usbconfig dump_device_desc

ugen0.2: <Identiv uTrust 3512 SAM slot Token> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (76mA)

  bLength = 0x0012 
  bDescriptorType = 0x0001 
  bcdUSB = 0x0200 
  bDeviceClass = 0x0000  <Probed by interface class>
  bDeviceSubClass = 0x0000 
  bDeviceProtocol = 0x0000 
  bMaxPacketSize0 = 0x0008 
  idVendor = 0x04e6 
  idProduct = 0x5816 
  bcdDevice = 0x0202 
  iManufacturer = 0x0001  <Identiv>
  iProduct = 0x0002  <uTrust 3512 SAM slot Token>
  iSerialNumber = 0x0005  <55511514602745>
  bNumConfigurations = 0x0001 



There is another issue, maybe related to this one here https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219220 which should be closed in favor of this new one or resolved later, when this one here is solved.
Comment 1 Matthias Apitz 2017-06-28 18:46:19 UTC
I'm saving after any failed boot (i.e. the card was not detected) the output of "dmesg" and it seems that there is a rule of failing: when the "13 ports ..." is on uhub1, the card is not detected, when it is on uhub0, it is detected; see below the diff of a good and a bad boot; 

why this order is changing between boots on the same hardware?

$ diff dmesg-20170628-202351-bad.txt dmesg-20170628-202601-good.txt
10c10
< CPU: Intel(R) Celeron(R) 2955U @ 1.40GHz (1396.79-MHz K8-class CPU)
---
> CPU: Intel(R) Celeron(R) 2955U @ 1.40GHz (1396.80-MHz K8-class CPU)
29c29
< Timecounter "TSC" frequency 1396794584 Hz quality 1000
---
> Timecounter "TSC" frequency 1396799544 Hz quality 1000
127d126
< ugen1.1: <Intel EHCI root HUB> at usbus1
129,130c128,130
< uhub0: <Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
< uhub1: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
---
> ugen1.1: <Intel EHCI root HUB> at usbus1
> uhub0: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
> uhub1: <Intel EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
140,145c140,144
< uhub1: 13 ports with 13 removable, self powered
^^^^^^^^^^^
< uhub0: 2 ports with 2 removable, self powered
< ugen1.2: <vendor 0x8087 product 0x8000> at usbus1
< uhub2 on uhub0
< uhub2: <vendor 0x8087 product 0x8000, class 9/0, rev 2.00/0.04, addr 2> on usbus1
< uhub2: 8 ports with 8 removable, self powered
---
> uhub0: 13 ports with 13 removable, self powered
^^^^^^^^^^^
> uhub1: 2 ports with 2 removable, self powered
> ugen0.2: <Identiv uTrust 3512 SAM slot Token> at usbus0
> ugen0.3: <SunplusIT Inc HD WebCam> at usbus0
> ugen0.4: <vendor 0x0489 product 0xe056> at usbus0
Comment 2 Matthias Apitz 2017-06-30 10:33:26 UTC
I followed a hints from Hans (HPS) and removed the conflicting USB devices from the kernel, esp. the EHCI device.

> Thanks for the hint. I disabled the three entries for uhci, ohci and ehci:
> 
> # USB support
> options         USB_DEBUG               # enable debug msgs
> # device                uhci            # UHCI PCI->USB interface
> # device                ohci            # OHCI PCI->USB interface
> # device                ehci            # EHCI PCI->USB interface (USB 2.0)
> device          xhci                    # XHCI PCI->USB interface (USB 3.0)
> device          usb                     # USB Bus (required)
> device          ukbd                    # Keyboard
> device          umass                   # Disks/Mass storage - Requires scbus and da
> 
> and maybe this will help already. I will let you know and update the PR
> later the day.

The new kernel now detects fine the uTrust Token on USB:

$ dmesg | egrep 'ugen|uhub|xhci|ehci'
xhci0: <Intel Panther Point USB 3.0 controller> mem 0xe0500000-0xe050ffff at device 20.0 on pci0
xhci0: 32 bytes context size, 64-bit DMA
xhci0: Port routing mask set to 0xffffffff
usbus0 on xhci0
ugen0.1: <0x8086 XHCI root HUB> at usbus0
uhub0: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
uhub0: 13 ports with 13 removable, self powered
ugen0.2: <SunplusIT Inc HD WebCam> at usbus0
ugen0.3: <vendor 0x0489 product 0xe056> at usbus0
ugen0.4: <Identiv uTrust 3512 SAM slot Token> at usbus0