Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Apr 2004 09:48:24 -0400 (EDT)
From:      "Peter D. Quilty" <pdquilty@adelphia.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/65438: [patch] to add support for SanDisk Cruzer Mini 256MB USB 2.0 Flash Drive
Message-ID:  <200404111348.i3BDmOY9010876@pdq-laptop.nextel.com>
Resent-Message-ID: <200404111400.i3BE0dbu065734@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         65438
>Category:       kern
>Synopsis:       [patch] to add support for SanDisk Cruzer Mini 256MB USB 2.0 Flash Drive
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 11 07:00:39 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Peter D. Quilty <pdquilty@adelphia.net>
>Release:        FreeBSD 4.10-BETA i386
>Organization:
>Environment:
System: FreeBSD pdq-laptop 4.10-BETA FreeBSD 4.10-BETA #7: Sat Apr 10 10:16:29 EDT 2004 root@pdq-laptop:/usr/obj/usr/src/sys/PDQ.8200 i386

>Description:
I recently purchased a 256MB SanDisk Cruzer Mini USB 2.0 Flash Drive and it was not recognized by
4.9-RELEASE-p4.  The problem persisted after upgrading to 4-STABLE with the following error messages:
/kernel: umass0: SanDisk Corporation  Cruzer Mini , rev 2.00/10.33, addr 3
/kernel: (da0:umass-sim0:0:0:0): got CAM status 0x4
/kernel: (da0:umass-sim0:0:0:0): fatal error, failed to attach to device
/kernel: (da0:umass-sim0:0:0:0): lost device
/kernel: (da0:umass-sim0:0:0:0): removing device entry
/kernel: umass0: BBB reset failed, IOERROR
/kernel: umass0: BBB bulk-in clear stall failed, IOERROR
/kernel: umass0: BBB bulk-out clear stall failed, IOERROR

After running "/usr/sbin/usbd -d" I found the following information.
usbd: device-attach event at 1081687446.284314000, Cruzer Mini, SanDisk Corporation:
  vndr=0x0781 prdct=0x7104 rlse=0x1033 clss=0x0000 subclss=0x0000 prtcl=0x0000
  device names: umass0

/usr/src/sys/dev/usb/usbdevs does not list product 0x7104 from SanDisk.  The patches below seemed to fix
everything and I am able to use the drive properly.  The kernel now recognizes and attaches it correctly.
umass0: SanDisk Corporation Cruzer Mini, rev 2.00/10.33, addr 2
da0 at umass-sim0 bus 0 target 0 lun 0
da0: <Generic STORAGE DEVICE 1033> Removable Direct Access SCSI-0 device
da0: 650KB/s transfers
da0: 250MB (512000 512 byte sectors: 64H 32S/T 250C)

>How-To-Repeat:
The 4-STABLE code as of Apr 10, 2004 still lacks support for this device.  Simply plug in the drive with a
kernel with USB, SCSI and umass support and the problem should be readily apparent.

>Fix:

--- patch-umass.c begins here ---
--- sys/dev/usb/umass.c.orig	Wed Apr  7 16:32:08 2004
+++ sys/dev/usb/umass.c	Sun Apr 11 08:56:31 2004
@@ -730,6 +730,11 @@
 		sc->proto = UMASS_PROTO_SCSI | UMASS_PROTO_BBB;
 		sc->quirks |= IGNORE_RESIDUE;
 	}
+	if (UGETW(dd->idVendor) == USB_VENDOR_SANDISK &&
+	     UGETW(dd->idProduct) == USB_PRODUCT_SANDISK_SDCZ2_256) {
+		sc->proto = UMASS_PROTO_SCSI | UMASS_PROTO_BBB;
+		sc->quirks |= IGNORE_RESIDUE;
+	}
 
 	switch (id->bInterfaceSubClass) {
 	case UISUBCLASS_SCSI:
--- patch-umass.c ends here ---

--- patch-usbdevs begins here ---
--- sys/dev/usb/usbdevs.orig	Wed Apr  7 16:32:20 2004
+++ sys/dev/usb/usbdevs	Sun Apr 11 08:56:41 2004
@@ -1136,6 +1136,7 @@
 product SANDISK SDDR12		0x0100	ImageMate SDDR-12
 product SANDISK SDDR09		0x0200	ImageMate SDDR-09
 product SANDISK SDDR75		0x0810	ImageMate SDDR-75
+product SANDISK SDCZ2_256	0x7104	Cruzer Mini 256MB
 
 /* Sanyo Electric products */
 product SANYO SCP4900 		0x0701	Sanyo SCP-4900 USB Phone
--- patch-usbdevs ends here ---


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404111348.i3BDmOY9010876>