Bug 263868 - usb_msc_auto_quirk and usb memory card readers
Summary: usb_msc_auto_quirk and usb memory card readers
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: 2022-05-08 17:55 UTC by Mazin Fadl
Modified: 2022-05-08 19:51 UTC (History)
2 users (show)

See Also:


Attachments
Genesys GL3220 AiO card reader usb quirk (1.30 KB, patch)
2022-05-08 19:46 UTC, Mazin Fadl
no flags Details | Diff
NOREL Systems NS1081 flash card reader usb quirk (1.53 KB, patch)
2022-05-08 19:49 UTC, Mazin Fadl
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mazin Fadl 2022-05-08 17:55:13 UTC
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>
...
Comment 1 Hans Petter Selasky freebsd_committer 2022-05-08 18:07:52 UTC
Which version of FreeBSD is this?

Feel free to attach a patch for usb_quirk.c in sys/dev/usb/quirk/

--HPS
Comment 2 Mazin Fadl 2022-05-08 19:46:50 UTC
Created attachment 233812 [details]
Genesys GL3220 AiO card reader usb quirk
Comment 3 Mazin Fadl 2022-05-08 19:49:26 UTC
Created attachment 233813 [details]
NOREL Systems NS1081 flash card reader usb quirk
Comment 4 Mazin Fadl 2022-05-08 19:51:29 UTC
This was on 14.0-CURRENT main-n255113-9b4c606b96ce.

I just verified that the broken behaviour is the same on main-n255391-c6df21760381.

I created usb_quirk.c (and usbdevs) patches for both devices.

Thank you