From 35761b145be66c57b4106e70e560cf6cba031133 Mon Sep 17 00:00:00 2001 From: iedowse Date: Sat, 26 Nov 2005 17:11:31 +0000 Subject: [PATCH] Revision 5.0 of the Sony DSC camera appears to require RBC commands to be padded to 12 bytes in length. Otherwise the requests just time out. Reported by: anders MFC after: 1 week --- sys/dev/usb/umass.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sys/dev/usb/umass.c b/sys/dev/usb/umass.c index 71b9f6410c8f..b13a047ee68c 100644 --- a/sys/dev/usb/umass.c +++ b/sys/dev/usb/umass.c @@ -314,6 +314,8 @@ struct umass_devdescr_t { # define NO_INQUIRY 0x0400 /* Device cannot handle INQUIRY EVPD, return CHECK CONDITION */ # define NO_INQUIRY_EVPD 0x0800 + /* Pad all RBC requests to 12 bytes. */ +# define RBC_PAD_TO_12 0x1000 }; Static struct umass_devdescr_t umass_devdescrs[] = { @@ -435,6 +437,10 @@ Static struct umass_devdescr_t umass_devdescrs[] = { UMASS_PROTO_SCSI | UMASS_PROTO_BBB, IGNORE_RESIDUE }, + { USB_VENDOR_SONY, USB_PRODUCT_SONY_DSC, 0x0500, + UMASS_PROTO_RBC | UMASS_PROTO_CBI, + RBC_PAD_TO_12 + }, { USB_VENDOR_SONY, USB_PRODUCT_SONY_DSC, RID_WILDCARD, UMASS_PROTO_RBC | UMASS_PROTO_CBI, NO_QUIRKS @@ -2907,8 +2913,14 @@ umass_rbc_transform(struct umass_softc *sc, unsigned char *cmd, int cmdlen, * appears to support those as well */ case REQUEST_SENSE: case PREVENT_ALLOW: - *rcmd = cmd; /* We don't need to copy it */ - *rcmdlen = cmdlen; + if ((sc->quirks & RBC_PAD_TO_12) && cmdlen < 12) { + *rcmdlen = 12; + bcopy(cmd, *rcmd, cmdlen); + bzero(*rcmd + cmdlen, 12 - cmdlen); + } else { + *rcmd = cmd; /* We don't need to copy it */ + *rcmdlen = cmdlen; + } return 1; /* All other commands are not legal in RBC */ default: