usb: Respect NO_INQUIRY quirk during device enumeration

Both usb_iface_is_cdrom and usb_msc_auto_quirk functions use SCSI INQUIRY
command to probe various properties of usb mass storage devices.
The problem here is that some very broken devices don't like this command.
Check if UQ_MSC_NO_INQUIRY quirk is set and skip cdrom and quirk
autodetection in that case.

Sponsored by: Stormshield
Obtained from: Semihalf
Reviewed by: hps, wma
Differential Revision: https://reviews.freebsd.org/D35075
This commit is contained in:
Kornel Duleba 2022-04-26 14:07:21 +02:00 committed by Wojciech Macek
parent 404f001161
commit 3ee943868c

View File

@ -2031,7 +2031,8 @@ usb_alloc_device(device_t parent_dev, struct usb_bus *bus,
goto repeat_set_config;
}
#if USB_HAVE_MSCTEST
if (config_index == 0) {
if (config_index == 0 &&
usb_test_quirk(&uaa, UQ_MSC_NO_INQUIRY) == 0) {
/*
* Try to figure out if we have an
* auto-install disk there:
@ -2051,7 +2052,8 @@ usb_alloc_device(device_t parent_dev, struct usb_bus *bus,
usb_test_quirk(&uaa, UQ_MSC_NO_PREVENT_ALLOW) == 0 &&
usb_test_quirk(&uaa, UQ_MSC_NO_SYNC_CACHE) == 0 &&
usb_test_quirk(&uaa, UQ_MSC_NO_TEST_UNIT_READY) == 0 &&
usb_test_quirk(&uaa, UQ_MSC_NO_GETMAXLUN) == 0) {
usb_test_quirk(&uaa, UQ_MSC_NO_GETMAXLUN) == 0 &&
usb_test_quirk(&uaa, UQ_MSC_NO_INQUIRY) == 0) {
/*
* Try to figure out if there are any MSC quirks we
* should apply automatically: