Subject: kern/35385: sony dsc usb quirk
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <kefren@netbsd.ro>
List: netbsd-bugs
Date: 01/08/2007 23:50:01
>Number: 35385
>Category: kern
>Synopsis: [patch] Sony Cybershot USB quirk
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jan 08 23:50:00 +0000 2007
>Originator: Mihai Chelaru
>Release: NetBSD 4.0_BETA2
>Organization:
>Environment:
System: NetBSD kefren64.netbsd.ro 4.0_BETA2 NetBSD 4.0_BETA2 (Kefren.ACPI) #35: Sun Jan 7 10:14:21 EET 2007 root@kefren64.netbsd.ro:/disk2/src/sys/arch/amd64/compile/Kefren.ACPI amd64
Architecture: x86_64
Machine: amd64
>Description:
before:
umass0 at uhub4 port 8 configuration 1 interface 0
umass0: Sony Sony DSC, rev 2.00/6.00, addr 2
umass0: using SCSI over CBI
scsibus0 at umass0: 2 targets, 1 lun per target
umass0: CBI reset failed, STALLED
after:
umass0 at uhub4 port 4 configuration 1 interface 0
umass0: Sony Sony DSC, rev 2.00/6.00, addr 2
umass0: using RBC over CBI
scsibus0 at umass0: 2 targets, 1 lun per target
sd0 at scsibus0 target 0 lun 0: <Sony, Sony DSC, 6.00> disk removable
sd0: fabricating a geometry
sd0: 951 MB, 951 cyl, 64 head, 32 sec, 512 bytes/sect x 1947648 sectors
From FreeBSD
References:
http://archive.netbsd.se/?ml=freebsd-mobile&a=2006-03&t=1811031
http://archive.netbsd.se/?ml=netbsd-current-users&a=2007-01&t=2881468
>How-To-Repeat:
>Fix:
Index: umass.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umass.c,v
retrieving revision 1.122
diff -u -r1.122 umass.c
--- umass.c 16 Nov 2006 01:33:27 -0000 1.122
+++ umass.c 7 Jan 2007 08:20:39 -0000
@@ -1311,17 +1311,26 @@
umass_cbi_adsc(struct umass_softc *sc, char *buffer, int buflen,
usbd_xfer_handle xfer)
{
+ int blen = buflen;
KASSERT(sc->sc_wire & (UMASS_WPROTO_CBI|UMASS_WPROTO_CBI_I),
("sc->sc_wire == 0x%02x wrong for umass_cbi_adsc\n",
sc->sc_wire));
+/* Sony Cameras */
+ if ((sc->sc_cmd == UMASS_CPROTO_RBC) &&
+ (sc->sc_quirks & UMASS_QUIRK_RBC_PAD_TO_12) &&
+ (blen < 12)) {
+ blen = 12;
+ bzero(buffer + buflen, 12 - buflen);
+ }
+
sc->sc_req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
sc->sc_req.bRequest = UR_CBI_ADSC;
USETW(sc->sc_req.wValue, 0);
USETW(sc->sc_req.wIndex, sc->sc_ifaceno);
- USETW(sc->sc_req.wLength, buflen);
+ USETW(sc->sc_req.wLength, blen);
return umass_setup_ctrl_transfer(sc, &sc->sc_req, buffer,
- buflen, 0, xfer);
+ blen, 0, xfer);
}
Index: umass_quirks.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umass_quirks.c,v
retrieving revision 1.70
diff -u -r1.70 umass_quirks.c
--- umass_quirks.c 11 Dec 2005 12:24:01 -0000 1.70
+++ umass_quirks.c 7 Jan 2007 08:20:39 -0000
@@ -149,7 +149,7 @@
*/
{ { USB_VENDOR_SONY, USB_PRODUCT_SONY_DSC },
UMASS_WPROTO_UNSPEC, UMASS_CPROTO_UNSPEC,
- 0,
+ UMASS_QUIRK_RBC_PAD_TO_12,
0,
UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO,
NULL, umass_fixup_sony
@@ -242,5 +242,5 @@
id = usbd_get_interface_descriptor(sc->sc_iface);
if (id->bInterfaceSubClass == 0xff)
- sc->sc_cmd = UMASS_CPROTO_SCSI;
+ sc->sc_cmd = UMASS_CPROTO_RBC;
}
Index: umassvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umassvar.h,v
retrieving revision 1.24
diff -u -r1.24 umassvar.h
--- umassvar.h 11 Dec 2005 12:24:01 -0000 1.24
+++ umassvar.h 7 Jan 2007 08:20:39 -0000
@@ -178,6 +178,7 @@
u_int32_t sc_quirks;
#define UMASS_QUIRK_WRONG_CSWSIG 0x00000001
#define UMASS_QUIRK_WRONG_CSWTAG 0x00000002
+#define UMASS_QUIRK_RBC_PAD_TO_12 0x00000004
u_int32_t sc_busquirks;
>Unformatted: