usb/81073: [patch] fix umass NO_GETMAXLUN quirk

James E. Flemer jflemer at alum.rpi.edu
Sun May 15 10:00:27 PDT 2005


>Number:         81073
>Category:       usb
>Synopsis:       [patch] fix umass NO_GETMAXLUN quirk
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-usb
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 15 17:00:24 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     James E. Flemer
>Release:        FreeBSD 6.0-CURRENT i386
>Organization:
n/a
>Environment:
System: FreeBSD null.speednaked.com 6.0-CURRENT FreeBSD 6.0-CURRENT #1: Sun May 1 02:34:19 MDT 2005 root at null.speednaked.com:/usr/obj/usr/src/sys/NULL6 i386

>Description:
	The umass NO_GETMAXLUN quirk is not implemented.  The flag is
	defined in umass.c, and several devices are tagged with it, but
	it is not referenced anywhere else.  It would seem that this flag
	is there because some devices seem to get stuck when sent
	UR_BBB_GET_MAX_LUN.

	I have one such USB cd-rom device that seems to be known by the
	following names:
		Sharp CE-CD05
		Panasonic KXL-840AN
		Kyushu Matsushita Electric (KME) UJDB131
		Kyushu Matsushita Electric (KME) CD-ROM11

	Apparently this drive is popular on many ultralight laptops
	in Japan (often rebranded).

>How-To-Repeat:
	Load the umass driver and attach a device that has NO_GETMAXLUN
	as a quirk.

	Devices that need this quirk tend to exhibit the following behavior:

umass0: Kyushu Matsushita Electric Co.,Ltd. UJDB131, rev 1.10/0.81, addr 2
umass0: Get Max Lun not supported (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
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
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
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
umass0: BBB bulk-out clear stall failed, STALLED
(cd0:umass-sim0:0:0:0): got CAM status 0x4
(cd0:umass-sim0:0:0:0): fatal error, failed to attach to device
(cd0:umass-sim0:0:0:0): lost device
umass0: BBB reset failed, STALLED
umass0: BBB bulk-in clear stall failed, STALLED
umass0: BBB bulk-out clear stall failed, STALLED
(cd0:umass-sim0:0:0:0): AutoSense Failed
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
(cd0:umass-sim0:0:0:0): removing device entry

>Fix:
	The patch below enables the NO_GETMAXLUN quirk, and when set
	for a device sets the maxlun to 0.  This patch also adds a
	new device and the appropriate quirks section.

	With this patch my drive attaches and works.

	This patch does not revoke the NO_GETMAXLUN quirk for any
	device that currently has it set.  This patch might change
	how these devices work (hopefully making things better).

--- umass-get-max-lun.diff begins here ---
Index: umass.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/umass.c,v
retrieving revision 1.121
diff -u -r1.121 umass.c
--- umass.c	25 Mar 2005 01:47:01 -0000	1.121
+++ umass.c	15 May 2005 01:32:33 -0000
@@ -399,6 +399,10 @@
 	  UMASS_PROTO_ATAPI | UMASS_PROTO_BBB,
 	  NO_INQUIRY | NO_GETMAXLUN
 	},
+	{ USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXL840AN, RID_WILDCARD,
+	  UMASS_PROTO_ATAPI | UMASS_PROTO_BBB,
+	  NO_GETMAXLUN
+	},
 	{ USB_VENDOR_PANASONIC, USB_PRODUCT_PANASONIC_KXLCB20AN, RID_WILDCARD,
 	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
 	  NO_QUIRKS
@@ -1086,7 +1090,8 @@
 
 	/* Get the maximum LUN supported by the device.
 	 */
-	if ((sc->proto & UMASS_PROTO_WIRE) == UMASS_PROTO_BBB)
+	if ((sc->proto & UMASS_PROTO_WIRE) == UMASS_PROTO_BBB &&
+	    (sc->quirks & NO_GETMAXLUN) == 0)
 		sc->maxlun = umass_bbb_get_max_lun(sc);
 	else
 		sc->maxlun = 0;
Index: usbdevs
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/usbdevs,v
retrieving revision 1.229
diff -u -r1.229 usbdevs
--- usbdevs	18 Apr 2005 18:47:37 -0000	1.229
+++ usbdevs	15 May 2005 01:32:33 -0000
@@ -1252,6 +1252,7 @@
 product PALM ZIRE		0x0070	Palm Zire
 
 /* Panasonic products */
+product PANASONIC KXL840AN	0x0d01	CD-R Drive KXL-840AN
 product PANASONIC KXLRW32AN	0x0d09	CD-R Drive KXL-RW32AN
 product PANASONIC KXLCB20AN	0x0d0a	CD-R Drive KXL-CB20AN
 product PANASONIC KXLCB35AN	0x0d0e	DVD-ROM & CD-R/RW
--- umass-get-max-lun.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-usb mailing list