From nobody Sat May 11 19:36:49 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VcGGV0JHyz5Kfxj; Sat, 11 May 2024 19:36:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VcGGT6tKPz4TKQ; Sat, 11 May 2024 19:36:49 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715456210; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QM5JQieAsHS+rTF3fHMkiBAnoFp+LtHtRvvWQFcz0Ik=; b=u4tSG5PT6fd6linP3kcZl1mxb9kaXzAmZiDU31MrT+T1dSU855U/f1coQvI1ZhSh8NT5V5 7hBpnm5RVJp8nS+pEE8gP5tJ6Zihxjwx1yRLweB+xjGGP2zCmwMLH67u0eIc+b3ukTk4p+ Dy6UF3j4tktCQ5tGWoKpLJ1momSf8RSEAyQNyrXg4/rfoL2mkg3ew1OJduuI17DGzj+mW5 HRFuTVpgYnFlT0GZ9zTcqlvfrcG1q8DT/krmOE04YKO5+iaKi6q4hAmD067d3vxXtzqveq EbIoR6EHsXDdsrD4LiLyCKgCsaOT++ulxbRgi0z8SlaI1hSgYANf7l20NnV2hg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715456210; a=rsa-sha256; cv=none; b=w2KiK2puPRRtY/7EOOqpzE0W2ZB5V4mvR/Fd2vSvmyvaasaSlxXWz1kbx9Nh5O/kfEw9HZ SfOTSIoLCBbWcJ1Sd21OXKbL4m+rTprdUWIbpotUElb2bkxGTUqv6daYDf9OzgiKwq/8bk 2tjE/evCIjBDblccFwo03z+aoh8f+BJPP2TNQSPodhL+uxEgFKGhPgFKBBBP2CdJgllvfM AAkyVZn59SSzpULPF2cQ21igqgX8dmaetsALLRqJMz3gdzW6bvHQukYM9nSW7htAbZxwMe /a9+C7pllZY+UUEXQHbnxPonkXxwi/8R67dBIf+DyIII8YolbkyrcBWGiGu4bw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715456210; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QM5JQieAsHS+rTF3fHMkiBAnoFp+LtHtRvvWQFcz0Ik=; b=Fre01bmHNdLgXxijmTiGheufdbrcbCM2ylHj+3L41nEXH5Q0069EoXgnc3LsRG2tX+N/ct rcKfW3P6ouEQd5TdW+8GxTjaAj+cnKxV93mzhuuXlojdXzwxq667Al1vuDmlvnIr5VNBIV lsvM5Fi/r63W6yMJVLKEvFODugYFD34zuYNOw8DiQJF0iv2Lh9hiNEQc4E5YgfxVnrs0T4 0gpkKAcRRFtOsY3ebfQJ2RTnl+uRlbdckuOVS+kR+fLezY9GGGT/JY5WaPhkYAs1jhz8v1 Yf+V8+0BOZmtTqMGuW85Q9IasdBufhVCrgv0nmIulxG6F33Hu/RaEW/zC4SMYQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VcGGT6T31zZ90; Sat, 11 May 2024 19:36:49 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44BJanGM045262; Sat, 11 May 2024 19:36:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44BJan2q045259; Sat, 11 May 2024 19:36:49 GMT (envelope-from git) Date: Sat, 11 May 2024 19:36:49 GMT Message-Id: <202405111936.44BJan2q045259@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 64e05e90657f - main - usb: Fix quirks list List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 64e05e90657fc4054797efc2b2a1848e4ba56c54 Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=64e05e90657fc4054797efc2b2a1848e4ba56c54 commit 64e05e90657fc4054797efc2b2a1848e4ba56c54 Author: Ahmad Khalifa AuthorDate: 2024-04-20 00:51:25 +0000 Commit: Warner Losh 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