USB mass storage devices slow to be detected

I have recently setup FreeBSD 12.0-RELEASE on my HP Pavilion 15-p051us. Most of the hardware works correctly, however one major exception is USB, most specifically with mass storage devices. When I connect a mass storage device to my laptop (on either one of the two USB 3.0 ports or on the USB 2.0 port) it will take about 1 minute before the device id detected by camcontrol and listed as a da device in /dev. Occasionally, the device is just never detected. I have tried this with various USB drives (Lexars, SanDisks, PNYs, generic unbranded) and they all have the same problem. All of these devices work without issue on other PCs and when running other OSes on the same laptop (Linux, OpenBSD). I also tested many of the same devices in a FreeBSD VM (Virtualbox) and they all worked with no issue (2-3 seconds to be detected by camcontrol).

Upon connecting the device I see something like the following in dmesg
Code:
ugen0.2: <SanDisk Cruzer Facet> at usbus0
umass0 on uhub4
umass0: <SanDisk Cruzer Facet, class 0/0, rev 2.00/1.26, addr 1> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x8100
umass0:4:0: Attached to scbus4

Later I see messages such as the following after the device is enumerated. If this occurs five times (happens fairly often) the device is never detected (never assigned a /dev/da device).
Code:
(probe0:umass-sim0:0:0:0): INQUIRY. CDB: 12 00 00 00 24 00
(probe0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(probe0:umass-sim0:0:0:0): Retrying command, 3 more tries remain

Two to three of the above messages usually show up across about 60 seconds before the device is detected.

Full dmesg related to connecting SanDisk Curzer
Code:
ugen0.2: <SanDisk Cruzer Facet> at usbus0
umass0 on uhub4
umass0: <SanDisk Cruzer Facet, class 0/0, rev 2.00/1.26, addr 1> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x8100
umass0:4:0: Attached to scbus4
(probe0:umass-sim0:0:0:0): INQUIRY. CDB: 12 00 00 00 24 00
(probe0:umass-sim0:0:0:0): CAM status: CCB request completed with an error
(probe0:umass-sim0:0:0:0): Retrying command, 3 more tries remain
da0 at umass-sim0 bus 0 scbus4 target 0 lun 0
da0: <SanDisk Cruzer Facet 1.26> Fixed Direct Access SPC-4 SCSI device
da0: Serial Number 4C532000000728112564
da0: 40.000MB/s transfers
da0: 15267MB (31266816 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>


The problem appears to be with the inquiry sent to the USB device. The usb_quirks module has a way to disable this for individual devices.
Running the following command and then disconnecting and re-connecting the usb device results in the device being detected much quicker (5-10 seconds).
sudo usbconfig ugen0.2 add_quirk UQ_MSC_NO_INQUIRY

This is not an ideal "fix" and I also do not know of a way to automatically apply this quirk to all connected USB mass storage devices. I would like to figure out what the root cause of this problem is, however I don't really know where to start.

If anyone has any ideas the help would be greatly appreciated.
 
Maybe something related. When I boot my 6T external USB drive is also slowly detected. [HP Pavilion desktop]
It takes after going multiuser about 15 seconden before /dev/gpt/mydrive is available and I can mount it.
Any ideas ?
I see in the log:
umass2: SCSI over Bulk-Only; quirks = 0x8100
quirks=0x2<NO_6_BYTE>
devd[659]: Processing event '!system=CAM subsystem=periph type=error device=da2 serial="575831314436373637564559" cam_status="0xcc" scsi_status=2 scsi_sense="70 02 04 01" CDB="00 00 00 00 00 00 " '
(da2:umass-sim2:2:0:0): SCSI sense: NOT READY asc:4,1 (Logical unit is in process of becoming ready)
 
I haven't really been able to figure out anything with this issue. Does anyone have a way to automatically apply the quirk mentioned in the original post to all connected mass storage devices. I can do it manually, but I can't find a way to do it automatically.
 
I saw these same exact results while messing with a Startech USB3 card with a bhyve VM.
When a memstick was inserted the device was detected but cam system took 60 seconds to bring the device up.

Seeing how you are encountering this without VM's I have to wonder if it is something recent? FreeBSD 12 related?
I saw the problems on FreeBSD12 -STABLE

I also know XHCI bios settings might be involved here.
 
I saw these same exact results while messing with a Startech USB3 card with a bhyve VM.
When a memstick was inserted the device was detected but cam system took 60 seconds to bring the device up.

Seeing how you are encountering this without VM's I have to wonder if it is something recent? FreeBSD 12 related?
I saw the problems on FreeBSD12 -STABLE

I also know XHCI bios settings might be involved here.

I just tried FreeBSD 11.2 (live) and the same thing seems to occur. As for the XHCI settings I don't seem to have any real options to configure that in my bios (thanks HP).

The USB 2.0 port is also affected, but I seem to recall something about it requiring the XHCI driver to work on windows 7, so maybe it is done strangely too.

For now just adding commonly used devices to the loader.conf works, but I'd like to find a better solution.
 
Back
Top