[Bug 263868] usb_msc_auto_quirk and usb memory card readers

From: <bugzilla-noreply_at_freebsd.org>
Date: Sun, 08 May 2022 17:55:13 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263868

            Bug ID: 263868
           Summary: usb_msc_auto_quirk and usb memory card readers
           Product: Base System
           Version: CURRENT
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: usb
          Assignee: usb@FreeBSD.org
          Reporter: mazen@illumed.net

Patch D30919 broke a couple of USB card readers I use, a Genesys GL3220 USB3.1
AiO flash card reader, and a Norelsys NS1081 USB 3.0 flash card reader.

Using Patch D35075's hatch escape for the usb_msc_auto_quirk code I've been
able to get them working by setting UQ_MSC_NO_INQUIRY, and adding the specific
quirk they seem to need: UQ_MSC_NO_RS_CLEAR_UA. Without adding this quirk,
flash card
hotplugging did not work on the Genesys, and the Norelsys did not work at all.

My loader conf for these devices:
# GENESYS GL3220 USB3.1 AiO Card Reader
hw.usb.quirk.0="0x05e3 0x0732 0 0xffff UQ_MSC_NO_INQUIRY"
hw.usb.quirk.1="0x05e3 0x0732 0 0xffff UQ_MSC_NO_RS_CLEAR_UA"
hw.usb.quirk.2="0x05e3 0x0732 0 0xffff UQ_MSC_NO_SYNC_CACHE"
# Norelsys NS1081 USB 3.0 Flash Card Reader
hw.usb.quirk.3="0x2537 0x1081 0 0xffff UQ_MS_NO_INQUIRY"
hw.usb.quirk.4="0x2537 0x1081 0 0xffff UQ_MSC_NO_RS_CLEAR_UA"

dmesg logs for the devices before manually setting UQ_MSC_NO_INQUIRY:
# Genesys
usb_msc_auto_quirk: UQ_MSC_NO_TEST_UNIT_READY set for USB mass storage device
vendor 0x05e3 USB Storage (0x05e3:0x0732)
usb_msc_auto_quirk: UQ_MSC_NO_PREVENT_ALLOW set for USB mass storage device
vendor 0x05e3 USB Storage (0x05e3:0x0732)
usb_msc_auto_quirk: UQ_MSC_NO_SYNC_CACHE set for USB mass storage device vendor
0x05e3 USB Storage (0x05e3:0x0732)
ugen2.5: <vendor 0x05e3 USB Storage> at usbus2
umass0 on uhub7
umass0: <vendor 0x05e3 USB Storage, class 0/0, rev 3.00/0.03, addr 4> on usbus2
umass0:  SCSI over Bulk-Only; quirks = 0xc001
umass0:7:0: Attached to scbus7
(probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00
00
(probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(probe0:umass-sim0:0:0:0): SCSI status: Check Condition
(probe0:umass-sim0:0:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
(probe0:umass-sim0:0:0:0): Error 6, Unretryable error
...
da2 at umass-sim0 bus 0 scbus7 target 0 lun 2
da2: <Generic STORAGE DEVICE DP03> Removable Direct Access SPC-3 SCSI device
da2: Serial Number 00000000DP03
da2: 400.000MB/s transfers
da2: Attempt to query device size failed: NOT READY, Medium not present
da2: quirks=0x3<NO_SYNC_CACHE,NO_6_BYTE>
...

# Norelsys NS1081 USB 3.0 Flash Card Reader
usb_msc_auto_quirk: UQ_MSC_NO_PREVENT_ALLOW set for USB mass storage device UGR
EEN USB3.0 Card Reader (0x2537:0x1081)
ugen0.2: <UGREEN USB3.0 Card Reader> at usbus0
umass1 on uhub0
umass1: <UGREEN USB3.0 Card Reader, class 0/0, rev 3.00/1.00, addr 1> on usbus0
umass1:  SCSI over Bulk-Only; quirks = 0x8000
umass1:8:1: Attached to scbus8
(probe0:umass-sim1:1:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 0
0
(probe0:umass-sim1:1:0:0): CAM status: Auto-Sense Retrieval Failed
(probe0:umass-sim1:1:0:0): Error 5, Unretryable error
(da5:umass-sim1:1:0:0): got CAM status 0x450
(da5:umass-sim1:1:0:0): fatal error, failed to attach to device
g_dev_taste: g_dev_taste(da5) failed to g_attach, error=6
(da5:umass-sim1:1:0:1): got CAM status 0x450
(da5:umass-sim1:1:0:1): fatal error, failed to attach to device
g_dev_taste: g_dev_taste(da5) failed to g_attach, error=6
umass1: at uhub0, port 8, addr 1 (disconnected)
umass1: detached

dmesg logs for the devices after setting the above configuration:
# Norelsys NS1081 with one SD card plugged in the two available slots
ugen0.2: <UGREEN USB3.0 Card Reader> at usbus0
umass1 on uhub0
umass1: <UGREEN USB3.0 Card Reader, class 0/0, rev 3.00/1.00, addr 3> on usbus0
umass1:  SCSI over Bulk-Only; quirks = 0x440a
umass1:8:1: Attached to scbus8
da5 at umass-sim1 bus 1 scbus8 target 0 lun 0
da5: <  > Removable Direct Access SCSI-2 device
da5: 400.000MB/s transfers
da5: 244816MB (501383168 512 byte sectors)
da5: quirks=0x2<NO_6_BYTE>
(da6:umass-sim1:1:0:1): got CAM status 0x450 # empty card slot
(da6:umass-sim1:1:0:1): fatal error, failed to attach to device

# GENESYS GL3220 USB3.1 AiO Card Reader with one SD card plugged in
ugen2.5: <vendor 0x05e3 USB Storage> at usbus2
umass0 on uhub7
umass0: <vendor 0x05e3 USB Storage, class 0/0, rev 3.00/0.03, addr 4> on usbus2
umass0:  SCSI over Bulk-Only; quirks = 0x4000
umass0:7:0: Attached to scbus7
(probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00
00 
(probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(probe0:umass-sim0:0:0:0): SCSI status: Check Condition
(probe0:umass-sim0:0:0:0): SCSI sense: NOT READY asc:3a,0 (Medium not present)
(probe0:umass-sim0:0:0:0): Error 6, Unretryable error
....
da2 at umass-sim0 bus 0 scbus7 target 0 lun 2
da2: <Generic STORAGE DEVICE DP03> Removable Direct Access SPC-3 SCSI device
da2: Serial Number 00000000DP03
da2: 400.000MB/s transfers
da2: 244816MB (501383168 512 byte sectors)
da2: quirks=0x3<NO_SYNC_CACHE,NO_6_BYTE>
...

-- 
You are receiving this mail because:
You are the assignee for the bug.