NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/37948: [Patch] add new quirks for umass to support Sony's portable GPS device



>Number:         37948
>Category:       kern
>Synopsis:       [Patch] add new quirks for umass to support Sony's portable 
>GPS device
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 04 09:35:00 +0000 2008
>Originator:     Yojiro UO
>Release:        NetBSD 4.99.52
>Organization:
>Environment:
System: NetBSD netbsd.nui.org 4.99.52 NetBSD 4.99.52 (ALIX) #293: Thu Jan 31 
21:22:45 PST 2008 
root%netbsd.nui.org@localhost:/usr/src/sys/arch/i386/compile/ALIX i386
Architecture: i386
Machine: i386
>Description:
        some USB mass strage device can not response UR_BBB_GET_MAX_LUN request.
        Current umass driver will give up  attach operation when the request 
fails.
        This patch add new quirks "UMASS_QURIK_NOGETMAXLUN" for umass driver to
        omit the query to protect such (broken?) umass device.

        Note:
        for example, the SONY's portable GPS device GPS-CS1 almost hangs up
        when once issued the UR_BBB_GET_MAX_LUN request. Therefore, this
        patch disable issue this request.. 

         umass0: Sony Corporation Sony DI Accessory, rev 2.00/1.00, addr 2
         umass0: using SCSI over Bulk-Only
         umass0: Get Max Lun failed: IOERROR
         umass0: unable to get Max Lun: IOERROR (force set to 0)
         scsibus1 at umass0: 2 targets, 1 lun per target
         sd0 at scsibus1 target 0 lun 0: <GENERIC, Card Memory R/W, 1.00> disk 
removable
         sd0: fabricating a geometry
         sd0: 32760 KB, 31 cyl, 64 head, 32 sec, 512 bytes/sect x 65521 sectors
         umass0: BBB bulk-out stall clear failed, STALLED
         sd0: fabricating a geometry
         usbd_transfer_cb: short transfer 0<13
         umass0: BBB reset failed, IOERROR
         umass0: BBB reset failed, IOERROR
         umass0: BBB reset failed, STALLED
         umass0: BBB bulk-in clear stall failed, STALLED
         umass0: BBB bulk-out clear stall failed, STALLED
         umass0: BBB reset failed, STALLED
         umass0: BBB bulk-in clear stall failed, STALLED
         umass0: BBB bulk-out clear stall failed, STALLED
         umass0: BBB reset failed, STALLED
         umass0: BBB bulk-in clear stall failed, STALLED
>How-To-Repeat:
attach USB strage device that has no capability of UR_BBB_GET_MAX_LUN query.
>Fix:
        apply following patch

Index: umass.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umass.c,v
retrieving revision 1.126
diff -u -r1.126 umass.c
--- umass.c     21 Jan 2008 12:11:21 -0000      1.126
+++ umass.c     1 Feb 2008 06:58:04 -0000
@@ -477,7 +477,8 @@
        /*
         * Get the maximum LUN supported by the device.
         */
-       if (sc->sc_wire == UMASS_WPROTO_BBB) {
+       if (sc->sc_wire == UMASS_WPROTO_BBB &&
+           (sc->sc_quirks & UMASS_QUIRK_NOGETMAXLUN) == 0) {
                err = umass_bbb_get_max_lun(sc, &sc->maxlun);
                if (err) {
                        printf("%s: unable to get Max Lun: %s\n",
Index: umass_quirks.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umass_quirks.c,v
retrieving revision 1.72
diff -u -r1.72 umass_quirks.c
--- umass_quirks.c      21 Jan 2008 11:36:47 -0000      1.72
+++ umass_quirks.c      1 Feb 2008 06:58:04 -0000
@@ -169,6 +169,19 @@
        },
 
        /*
+        * The SONY Portable GPS strage device almost hangs up
+        * when request UR_BBB_GET_MAX_LUN.
+        * disable the query logic.
+        */
+       { { USB_VENDOR_SONY, USB_PRODUCT_SONY_GPS_CS1 },
+         UMASS_WPROTO_BBB, UMASS_CPROTO_UNSPEC,
+         UMASS_QUIRK_NOGETMAXLUN,
+         0,
+         UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO,
+         NULL, NULL
+       },
+
+       /*
         * The DiskOnKey does not reject commands it doesn't recognize in a
         * sane way -- rather than STALLing the bulk pipe, it continually NAKs
         * until we time out.  To prevent being screwed by this, for now we
Index: umassvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/umassvar.h,v
retrieving revision 1.26
diff -u -r1.26 umassvar.h
--- umassvar.h  21 Jan 2008 12:11:21 -0000      1.26
+++ umassvar.h  1 Feb 2008 06:58:04 -0000
@@ -179,6 +179,7 @@
 #define        UMASS_QUIRK_WRONG_CSWSIG        0x00000001
 #define        UMASS_QUIRK_WRONG_CSWTAG        0x00000002
 #define        UMASS_QUIRK_RBC_PAD_TO_12       0x00000004
+#define        UMASS_QUIRK_NOGETMAXLUN         0x00000008
 
 #define UMASS_QUIRK_USE_DEFAULTMATCH   -1
 
Index: usbdevs
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usbdevs,v
retrieving revision 1.492
diff -u -r1.492 usbdevs
--- usbdevs     15 Dec 2007 12:50:12 -0000      1.492
+++ usbdevs     1 Feb 2008 06:58:04 -0000
@@ -2076,6 +2080,7 @@
 product SONY PS2EYETOY4                0x0154  PlayStation2 EyeToy v154
 product SONY PS2EYETOY5                0x0155  PlayStation2 EyeToy v155
 product SONY CLIE_TJ25         0x0169  Sony Clie tj25
+product SONY GPS_CS1           0x0298  Sony GPS GPS-CS1
 
 /* SOURCENEXT products */
 product SOURCENEXT KEIKAI8_CHG 0x012e  KeikaiDenwa 8 with charger




Home | Main Index | Thread Index | Old Index