git: d45fa9f42406 - stable/13 - Add devices and quirks for some Olympus cameras.

From: Greg Lehey <grog_at_FreeBSD.org>
Date: Wed, 13 Apr 2022 23:43:46 UTC
The branch stable/13 has been updated by grog:

URL: https://cgit.FreeBSD.org/src/commit/?id=d45fa9f42406121e34ea265969663d812fa57e13

commit d45fa9f42406121e34ea265969663d812fa57e13
Author:     Greg Lehey <grog@FreeBSD.org>
AuthorDate: 2022-03-23 01:40:28 +0000
Commit:     Greg Lehey <grog@FreeBSD.org>
CommitDate: 2022-04-13 23:40:37 +0000

    Add devices and quirks for some Olympus cameras.
    
    Reviewed by:    hps@
    Fixes:          Problems attaching Olympus cameras.
    
    (cherry picked from commit 31e076d70b5fc06e9cd9ecfe19296d4fe6a8a5a5)
---
 sys/dev/usb/quirk/usb_quirk.c | 35 ++++++++++++++++++++++++++++++++++-
 sys/dev/usb/usbdevs           | 14 ++++++++++++++
 2 files changed, 48 insertions(+), 1 deletion(-)

diff --git a/sys/dev/usb/quirk/usb_quirk.c b/sys/dev/usb/quirk/usb_quirk.c
index cab6f1b7c074..d86ca5643515 100644
--- a/sys/dev/usb/quirk/usb_quirk.c
+++ b/sys/dev/usb/quirk/usb_quirk.c
@@ -353,6 +353,39 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRKS_MAX] = {
 	USB_QUIRK(OLYMPUS, C1, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_WRONG_CSWSIG),
 	USB_QUIRK(OLYMPUS, C700, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN),
+        /* Selected Olympus DSLR and EVIL models.  See ../usbdevs for more
+	 * details.
+	 *
+	 * Not all quirks apply to all models.  The commented-out entries are
+	 * correct for that model.
+	 */
+	USB_QUIRK(OLYMPUS, E_1, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN,
+	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW,
+            UQ_MSC_NO_SYNC_CACHE),
+	/*
+	 * Product code 0x118.
+	 * USB_QUIRK(OLYMPUS, E_300, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN,
+	 *     UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW,
+         *     UQ_MSC_NO_SYNC_CACHE),
+	 * USB_QUIRK(OLYMPUS, E_30, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN,
+	 *     UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW,
+         *     UQ_MSC_NO_SYNC_CACHE), */
+	USB_QUIRK(OLYMPUS, E_330, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN,
+	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW,
+            UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_START_STOP),
+	USB_QUIRK(OLYMPUS, E_PM1, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN,
+	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW,
+            UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_START_STOP),
+        /* Product code 0x12e.
+	 * USB_QUIRK(OLYMPUS, E_PM2, 0x0000, 0xffff, 0),
+	 * USB_QUIRK(OLYMPUS, E_M1MarkII, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN,
+	 *     UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW,
+	 *     UQ_MSC_NO_SYNC_CACHE),
+	 * USB_QUIRK(OLYMPUS, E_M5MarkIII, 0x0000, 0xffff, 0),
+	 */
+	USB_QUIRK(OLYMPUS, E_M1, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN,
+	    UQ_MSC_NO_TEST_UNIT_READY, UQ_MSC_NO_PREVENT_ALLOW,
+            UQ_MSC_NO_SYNC_CACHE, UQ_MSC_NO_START_STOP),
 	USB_QUIRK(ONSPEC, SDS_HOTFIND_D, 0x0000, 0xffff, UQ_MSC_FORCE_WIRE_BBB,
 	    UQ_MSC_FORCE_PROTO_SCSI, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_SYNC_CACHE),
 	USB_QUIRK(ONSPEC, CFMS_RW, 0x0000, 0xffff, UQ_MSC_FORCE_PROTO_SCSI),
@@ -1042,7 +1075,7 @@ usb_quirk_init(void *arg)
 {
 	char envkey[sizeof(USB_QUIRK_ENVROOT) + 2];	/* 2 digits max, 0 to 99 */
 	int i;
-  
+
 	/* initialize mutex */
 	mtx_init(&usb_quirk_mtx, "USB quirk", NULL, MTX_DEF);
 
diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs
index 84ff3598750a..b07be3edd241 100644
--- a/sys/dev/usb/usbdevs
+++ b/sys/dev/usb/usbdevs
@@ -3533,6 +3533,20 @@ product OLIMEX ARM_USB_OCD_H		0x002b	FTDI compatible adapter
 /* Olympus products */
 product OLYMPUS C1		0x0102	C-1 Digital Camera
 product OLYMPUS C700		0x0105	C-700 Ultra Zoom
+/* Current Olympus DSLRs and EVIL cameras reuse the same product code and
+ * bcdDevice for multiple models.  This may result in problems with newer
+ * cameras. */
+/* Olympus DSLRs */
+product OLYMPUS E_1		0x0102
+product OLYMPUS E_300		0x0118
+product OLYMPUS E_330		0x0118
+product OLYMPUS E_30		0x0118
+/* Olympus EVIL cameras */
+product OLYMPUS E_PM1		0x012c
+product OLYMPUS E_PM2		0x012e
+product OLYMPUS E_M1		0x012e
+product OLYMPUS E_M1MarkII	0x012e
+product OLYMPUS E_M5MarkIII	0x012e
 
 /* OmniVision Technologies, Inc. products */
 product OMNIVISION OV511	0x0511	OV511 Camera