diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index 6b8cfd92903f..bd3aaa122e5d 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -206,6 +206,7 @@ typedef struct { typedef struct { uDWord dCSWSignature; # define CSWSIGNATURE 0x53425355 +# define CSWSIGNATURE_OLYMPUS_C1 0x55425355 uDWord dCSWTag; uDWord dCSWDataResidue; uByte bCSWStatus; @@ -298,6 +299,8 @@ struct umass_softc { * Yano ATAPI-USB */ # define FORCE_SHORT_INQUIRY 0x08 + /* The device uses a weird CSWSIGNATURE. */ +# define WRONG_CSWSIG 0x10 unsigned int proto; # define PROTO_UNKNOWN 0x0000 /* unknown protocol */ @@ -673,6 +676,15 @@ umass_match_proto(struct umass_softc *sc, usbd_interface_handle iface, */ sc->transfer_speed = 500; } + + if (UGETW(dd->idVendor) == USB_VENDOR_OLYMPUS && + UGETW(dd->idProduct) == USB_PRODUCT_OLYMPUS_C1) { + /* + * The Olympus C-1 camera uses a different command-status + * signature. + */ + sc->quirks |= WRONG_CSWSIG; + } switch (id->bInterfaceSubClass) { case USUBCLASS_SCSI: @@ -1448,6 +1460,11 @@ umass_bbb_state(usbd_xfer_handle xfer, usbd_private_handle priv, DIF(UDMASS_BBB, umass_bbb_dump_csw(sc, &sc->csw)); + /* Translate weird command-status signatures. */ + if ((sc->quirks & WRONG_CSWSIG) && + UGETDW(sc->csw.dCSWSignature) == CSWSIGNATURE_OLYMPUS_C1) + USETDW(sc->csw.dCSWSignature, CSWSIGNATURE); + /* Check CSW and handle any error */ if (UGETDW(sc->csw.dCSWSignature) != CSWSIGNATURE) { /* Invalid CSW: Wrong signature or wrong tag might