Subject: kern/19971: USB HDD(MELCO DUB-P Series) works with patch
To: None <gnats-bugs@gnats.netbsd.org>
From: None <nabe@nabechan.org>
List: netbsd-bugs
Date: 01/20/2003 18:36:14
>Number:         19971
>Category:       kern
>Synopsis:       USB HDD(MELCO DUB-P Series) works with patch
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 20 18:37:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Shingo WATANABE
>Release:        NetBSD/i386 1.6K
>Organization:
nabechan.org
>Environment:
NetBSD 1.6K (CTPMDK) #6: Wed Nov 20 13:49:35 EST 2002 madoka@ctpmadoka:/usr/src/sys/arch/i386/compile/CTPMDK
>Description:
MELCO USB-HDD works with the patch. MELCO DUB-P is a one of the USB Strage Class Device, but it does not works with plain NetBSD. Data Phase in INQUIRY command fails by IOERROR. To solve the problem the length in the Data Phase must be SHORT_INQUIRY_LENGTH(36bytes) and use UMASS_QUIRK_FORCE_SHORT_INQUIRY.

[before patch]
umass0 at uhub1 port 1 configuration 1 interface 0
umass0: MELCO INC. MELCO USB-IDE Bridge, rev 1.10/1.13, addr 2
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, 1 lun per target
scsibus0: waiting 10 seconds for devices to settle...
umass0: BBB reset failed, IOERROR
umass0: BBB bulk-in clear stall failed, IOERROR
umass0: BBB bulk-out clear stall failed, IOERROR
umass0: BBB reset failed, IOERROR
umass0: BBB bulk-in clear stall failed, IOERROR
umass0: BBB bulk-out clear stall failed, IOERROR
umass0: BBB reset failed, IOERROR
umass0: BBB bulk-in clear stall failed, IOERROR
umass0: BBB bulk-out clear stall failed, IOERROR
umass0: BBB reset failed, IOERROR
umass0: BBB bulk-in clear stall failed, IOERROR
umass0: BBB bulk-out clear stall failed, IOERROR
umass0: BBB reset failed, IOERROR
umass0: BBB bulk-in clear stall failed, IOERROR
umass0: BBB bulk-out clear stall failed, IOERROR

[after patch]
umass0 at uhub0 port 1 configuration 1 interface 0
umass0: MELCO INC. MELCO USB-IDE Bridge, rev 1.10/1.13, addr 2
umass0: using SCSI over Bulk-Only
umass0: umass_attach_bus: SCSI
scsibus0 at umass0: 2 targets, 1 lun per target
scsibus0: waiting 10 seconds for devices to settle...
sd0 at scsibus0 target 1 lun 0: <Generic, STORAGE DEVICE, 0.01> disk fixed
sd0: 38154 MB, 38154 cyl, 64 head, 32 sec, 512 bytes/sect x 78140161 sectors

>How-To-Repeat:
just plug the USB-HDD(MELCO DUB-P Seriese).

>Fix:
use following patch.


diff --exclude *~ -ur /home/nabe/work/cvs/NetBSD/src/sys/dev/usb/umass_quirks.c usb/umass_quirks.c
--- /home/nabe/work/cvs/NetBSD/src/sys/dev/usb/umass_quirks.c	Tue Dec 10 13:01:00 2002
+++ usb/umass_quirks.c	Fri Dec 13 04:09:29 2002
@@ -313,6 +313,14 @@
 	  UMATCH_VENDOR_PRODUCT_REV,
 	  NULL, umass_fixup_yedata
 	},
+
+	{ { USB_VENDOR_MELCO, 0x001c /* XXX: USB-IDE Bridge: DUB-PxxG */ },
+	  UMASS_WPROTO_UNSPEC, UMASS_CPROTO_UNSPEC,
+	  UMASS_QUIRK_FORCE_SHORT_INQUIRY | UMASS_QUIRK_NO_START_STOP,
+	  PQUIRK_NOMODESENSE,
+	  UMATCH_DEVCLASS_DEVSUBCLASS_DEVPROTO,
+	  NULL, NULL
+	},
 };
 
 const struct umass_quirk *
diff --exclude *~ -ur /home/nabe/work/cvs/NetBSD/src/sys/dev/usb/umass_scsipi.c usb/umass_scsipi.c
--- /home/nabe/work/cvs/NetBSD/src/sys/dev/usb/umass_scsipi.c	Fri Oct 25 00:45:48 2002
+++ usb/umass_scsipi.c	Mon Dec  9 14:16:01 2002
@@ -298,6 +298,7 @@
 			memcpy(&trcmd, cmd, sizeof trcmd);
 			trcmd.bytes[4] = SHORT_INQUIRY_LENGTH;
 			cmd = &trcmd;
+			xs->datalen = SHORT_INQUIRY_LENGTH;
 		}
 
 		dir = DIR_NONE;

>Release-Note:
>Audit-Trail:
>Unformatted: