NetBSD Problem Report #37948

From martin@duskware.de  Mon Feb  4 09:32:52 2008
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 73BE063B853
	for <gnats-bugs@gnats.netbsd.org>; Mon,  4 Feb 2008 09:32:52 +0000 (UTC)
Message-Id: <20080204085512.877EE63B853@narn.NetBSD.org>
Date: Mon,  4 Feb 2008 08:55:12 +0000 (UTC)
From: yuo@nui.org
Reply-To: yuo@nui.org
To: netbsd-bugs-owner@NetBSD.org
Subject: [Patch] add new quirks for umass to support Sony's portable GPS device
X-Send-Pr-Version: www-1.0

>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:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 04 09:35:00 +0000 2008
>Closed-Date:    Sat Sep 06 21:57:30 +0000 2008
>Last-Modified:  Sat Sep 06 21:57:30 +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:/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

>Release-Note:

>Audit-Trail:
From: Mindaugas Rasiukevicius <rmind@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/37948 CVS commit: src/sys/dev/usb
Date: Sat,  6 Sep 2008 21:49:00 +0000 (UTC)

 Module Name:	src
 Committed By:	rmind
 Date:		Sat Sep  6 21:49:00 UTC 2008

 Modified Files:
 	src/sys/dev/usb: umass.c umass_quirks.c umassvar.h usbdevs

 Log Message:
 PR/37948: Yojiro UO: Support for Sony GPS GPS-CS1 devices.  Check the support
 of UR_BBB_GET_MAX_LUN, and disable the logic, if needed.


 To generate a diff of this commit:
 cvs rdiff -r1.128 -r1.129 src/sys/dev/usb/umass.c
 cvs rdiff -r1.74 -r1.75 src/sys/dev/usb/umass_quirks.c
 cvs rdiff -r1.26 -r1.27 src/sys/dev/usb/umassvar.h
 cvs rdiff -r1.509 -r1.510 src/sys/dev/usb/usbdevs

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: rmind@NetBSD.org
State-Changed-When: Sat, 06 Sep 2008 21:57:30 +0000
State-Changed-Why:
Patch applied.  Thank you!


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.