git: d3a659a338cb - stable/14 - usb-msctest: Be more conservative setting GETMAXLUN quirk
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 25 Mar 2025 03:02:26 UTC
The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=d3a659a338cbad72bd205e6fc8787a9fb3fb485b commit d3a659a338cbad72bd205e6fc8787a9fb3fb485b Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2025-03-16 19:20:09 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2025-03-25 03:01:56 +0000 usb-msctest: Be more conservative setting GETMAXLUN quirk Only set the GETMAXLUN quirk when it causes an error, but don't set it when it returns 0. Since we reset the device when we set any quirk, only set this quirk when it generates an error so umass will avoid it. When the command works, there's no reason for umass to avoid it at all. MFC After: 1 week Sponsored by: Netflix (cherry picked from commit b0375f78e32acd7947d28126a5e165f8139a5a23) --- sys/dev/usb/usb_msctest.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/sys/dev/usb/usb_msctest.c b/sys/dev/usb/usb_msctest.c index d31baabcf875..7b31d9dadfab 100644 --- a/sys/dev/usb/usb_msctest.c +++ b/sys/dev/usb/usb_msctest.c @@ -741,11 +741,10 @@ usb_iface_is_cdrom(struct usb_device *udev, uint8_t iface_index) return (is_cdrom); } -static uint8_t +static int usb_msc_get_max_lun(struct usb_device *udev, uint8_t iface_index) { struct usb_device_request req; - usb_error_t err; uint8_t buf = 0; /* The Get Max Lun command is a class-specific request. */ @@ -756,11 +755,7 @@ usb_msc_get_max_lun(struct usb_device *udev, uint8_t iface_index) req.wIndex[1] = 0; USETW(req.wLength, 1); - err = usbd_do_request(udev, NULL, &req, &buf); - if (err) - buf = 0; - - return (buf); + return usbd_do_request(udev, NULL, &req, &buf); } #define USB_ADD_QUIRK(udev, any, which) do { \ @@ -803,8 +798,8 @@ usb_msc_auto_quirk(struct usb_device *udev, uint8_t iface_index, usb_pause_mtx(NULL, hz); if (usb_test_quirk(uaa, UQ_MSC_NO_GETMAXLUN) == 0 && - usb_msc_get_max_lun(udev, iface_index) == 0) { - DPRINTF("Device has only got one LUN.\n"); + usb_msc_get_max_lun(udev, iface_index) != 0) { + DPRINTF("Device can't handle GETMAXLUN\n"); USB_ADD_QUIRK(udev, any_quirk, UQ_MSC_NO_GETMAXLUN); }