git: 64e05e90657f - main - usb: Fix quirks list
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 11 May 2024 19:36:49 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=64e05e90657fc4054797efc2b2a1848e4ba56c54 commit 64e05e90657fc4054797efc2b2a1848e4ba56c54 Author: Ahmad Khalifa <ahmadkhalifa570@gmail.com> AuthorDate: 2024-04-20 00:51:25 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-05-11 19:32:37 +0000 usb: Fix quirks list In some cases, the USB_QUIRK_VP macro was being misused. Instead of setting quirks to the intended value, the first two supplied quirks would go into lo_rev and hi_rev. Replace it with USB_QUIRK_VO which only takes the needed args. This also makes the Dummy products, which where being used to correctly set vendor only quirks, not necessary. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1153 --- sys/dev/usb/quirk/usb_quirk.c | 36 +++++++++++++++++++----------------- sys/dev/usb/usbdevs | 10 ---------- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c index a0a7b3fc75a5..2a88f901b674 100644 --- a/sys/dev/usb/quirk/usb_quirk.c +++ b/sys/dev/usb/quirk/usb_quirk.c @@ -74,11 +74,16 @@ struct usb_quirk_entry { static struct mtx usb_quirk_mtx; -#define USB_QUIRK_VP(v,p,l,h,...) \ - { .vid = (v), .pid = (p), .lo_rev = (l), .hi_rev = (h), \ - .quirks = { __VA_ARGS__ } } -#define USB_QUIRK(v,p,l,h,...) \ - USB_QUIRK_VP(USB_VENDOR_##v, USB_PRODUCT_##v##_##p, l, h, __VA_ARGS__) +#define USB_QUIRK(v, p, l, h, ...) { \ + .vid = USB_VENDOR_##v, .pid = USB_PRODUCT_##v##_##p, .lo_rev = l, \ + .hi_rev = h, .quirks = { __VA_ARGS__ } \ +} + +/* Vendor only */ +#define USB_QUIRK_VO(v, ...) { \ + .vid = USB_VENDOR_##v, .pid = 0x0000, .lo_rev = 0x0000, .hi_rev = 0xffff, \ + .quirks = { UQ_MATCH_VENDOR_ONLY, __VA_ARGS__ } \ +} static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { USB_QUIRK(ASUS, LCM, 0x0000, 0xffff, UQ_HID_IGNORE), @@ -191,8 +196,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { USB_QUIRK(BALTECH, SMARTCARDREADER, 0x0000, 0xffff, UQ_IGNORE_CDC_CM), /* USB Mass Storage Class Quirks */ - USB_QUIRK_VP(USB_VENDOR_ASAHIOPTICAL, 0, UQ_MSC_NO_RS_CLEAR_UA, - UQ_MATCH_VENDOR_ONLY), + USB_QUIRK_VO(ASAHIOPTICAL, UQ_MSC_NO_RS_CLEAR_UA), USB_QUIRK(ADDON, ATTACHE, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE), USB_QUIRK(ADDON, A256MB, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, @@ -337,8 +341,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { USB_QUIRK(MOTOROLA2, E398, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_FORCE_SHORT_INQ, UQ_MSC_NO_INQUIRY_EVPD, UQ_MSC_NO_GETMAXLUN), - USB_QUIRK_VP(USB_VENDOR_MPMAN, 0, UQ_MSC_NO_SYNC_CACHE, - UQ_MATCH_VENDOR_ONLY), + USB_QUIRK_VO(MPMAN, UQ_MSC_NO_SYNC_CACHE), USB_QUIRK(MSYSTEMS, DISKONKEY, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_IGNORE_RESIDUE, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_RS_CLEAR_UA), @@ -425,8 +428,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { UQ_MSC_NO_START_STOP), USB_QUIRK(PROLIFIC, PL2506, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_PREVENT_ALLOW), - USB_QUIRK_VP(USB_VENDOR_SAMSUNG_TECHWIN, - USB_PRODUCT_SAMSUNG_TECHWIN_DIGIMAX_410, UQ_MSC_FORCE_WIRE_BBB, + USB_QUIRK(SAMSUNG_TECHWIN, DIGIMAX_410, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_INQUIRY), USB_QUIRK(SANDISK, SDDR05A, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_CBI, UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_READ_CAP_OFFBY1, @@ -624,11 +626,11 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { * Quirks for manufacturers which USB devices does not respond * after issuing non-supported commands: */ - USB_QUIRK(ALCOR, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_TEST_UNIT_READY, UQ_MATCH_VENDOR_ONLY), - USB_QUIRK(APPLE, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), - USB_QUIRK(FEIYA, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), - USB_QUIRK(REALTEK, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), - USB_QUIRK(INITIO, DUMMY, 0x0000, 0xffff, UQ_MSC_NO_SYNC_CACHE, UQ_MATCH_VENDOR_ONLY), + USB_QUIRK_VO(ALCOR, UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_TEST_UNIT_READY), + USB_QUIRK_VO(APPLE, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK_VO(FEIYA, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK_VO(REALTEK, UQ_MSC_NO_SYNC_CACHE), + USB_QUIRK_VO(INITIO, UQ_MSC_NO_SYNC_CACHE), /* DYMO LabelManager Pnp */ USB_QUIRK(DYMO, LABELMANAGERPNP, 0x0000, 0xffff, UQ_MSC_DYMO_EJECT), @@ -639,7 +641,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = { /* This works much better with if_cdce than if_ure */ USB_QUIRK(LENOVO, TBT3LAN, 0x0000, 0xffff, UQ_CFG_INDEX_1), }; -#undef USB_QUIRK_VP +#undef USB_QUIRK_VO #undef USB_QUIRK static const char *usb_quirk_str[USB_QUIRK_MAX] = { diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index 65dcb06c2f3f..6820e8b4025a 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -1047,7 +1047,6 @@ product ALCATEL OT535 0x02df One Touch 535/735 /* Alcor Micro, Inc. products */ product ALCOR2 KBD_HUB 0x2802 Kbd Hub -product ALCOR DUMMY 0x0000 Dummy product product ALCOR SDCR_6335 0x6335 SD/MMC Card Reader product ALCOR SDCR_6362 0x6362 SD/MMC Card Reader product ALCOR SDCR_6366 0x6366 SD/MMC Card Reader @@ -1137,7 +1136,6 @@ product ANYDATA ADU_500A 0x6502 CDMA 2000 EV-DO USB Modem product AOX USB101 0x0008 Ethernet /* Apple Computer products */ -product APPLE DUMMY 0x0000 Dummy product product APPLE IMAC_KBD 0x0201 USB iMac Keyboard product APPLE KBD 0x0202 USB Keyboard M2452 product APPLE EXT_KBD 0x020c Apple Extended USB Keyboard @@ -1862,7 +1860,6 @@ product EGALAX TPANEL2 0x0002 Touch Panel product EGALAX2 TPANEL 0x0001 Touch Panel /* EGO Products */ -product EGO DUMMY 0x0000 Dummy Product product EGO M4U 0x1020 ESI M4U /* Eicon Networks */ @@ -1986,7 +1983,6 @@ product FALCOM TWIST 0x0001 USB GSM/GPRS Modem product FALCOM SAMBA 0x0005 FTDI compatible adapter /* FEIYA products */ -product FEIYA DUMMY 0x0000 Dummy product product FEIYA 5IN1 0x1132 5-in-1 Card Reader product FEIYA ELANGO 0x6200 MicroSDHC Card Reader product FEIYA AC110 0x6300 AC-110 Card Reader @@ -2601,7 +2597,6 @@ product IDTECH IDT1221U 0x0300 FTDI compatible adapter product IMAGINATION DBX1 0x2107 DBX1 DSP core /* Initio Corporation products */ -product INITIO DUMMY 0x0000 Dummy product product INITIO INIC_1610P 0x1e40 USB to SATA Bridge /* Inside Out Networks products */ @@ -2874,7 +2869,6 @@ product LINKSYS4 RT3070 0x0078 RT3070 product LINKSYS4 WUSB600NV2 0x0079 WUSB600N v2 /* Logilink products */ -product LOGILINK DUMMY 0x0000 Dummy product product LOGILINK U2M 0x0101 LogiLink USB MIDI Cable /* Logitech products */ @@ -4053,7 +4047,6 @@ product RATOC REXUSB60F 0xb020 USB serial adapter REX-USB60F /* Realtek products */ /* Green House and CompUSA OEM this part */ -product REALTEK DUMMY 0x0000 Dummy product product REALTEK USB20CRW 0x0158 USB20CRW Card Reader product REALTEK RTL8188ETV 0x0179 RTL8188ETV product REALTEK RTL8188CTV 0x018a RTL8188CTV @@ -4098,7 +4091,6 @@ product REALTEK RTL8192SU 0xc512 RTL8192SU product REALTEK RTW8821CU 0xc811 RTW8821CU /* RedOctane products */ -product REDOCTANE DUMMY 0x0000 Dummy product product REDOCTANE GHMIDI 0x474b GH MIDI INTERFACE /* Renesas products */ @@ -4668,7 +4660,6 @@ product TECLAST TLC300 0x3203 USB Media Player product TESTO USB_INTERFACE 0x0001 FTDI compatible adapter /* TexTech products */ -product TEXTECH DUMMY 0x0000 Dummy product product TEXTECH U2M_1 0x0101 Textech USB MIDI cable product TEXTECH U2M_2 0x1806 Textech USB MIDI cable @@ -4909,7 +4900,6 @@ product WAVESENSE JAZZ 0xaaaa Jazz blood glucose meter /* WCH products */ product WCH CH341SER 0x5523 CH341/CH340 USB-Serial Bridge -product WCH2 DUMMY 0x0000 Dummy product product WCH2 CH341SER_2 0x5523 CH341/CH340 USB-Serial Bridge product WCH2 CH341SER_3 0x7522 CH341/CH340 USB-Serial Bridge product WCH2 CH341SER 0x7523 CH341/CH340 USB-Serial Bridge