Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Sep 2011 20:24:32 +0200
From:      Hans Petter Selasky <hselasky@freebsd.org>
To:        Alex Kozlov <spam@rm-rf.kiev.ua>
Cc:        "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r225350 - in head/sys: dev/usb dev/usb/quirk dev/usb/storage sys
Message-ID:  <201109032024.32323.hselasky@freebsd.org>
In-Reply-To: <20110903163238.GA38118@ravenloft.kiev.ua>
References:  <20110903163238.GA38118@ravenloft.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-00=_gDnYO7OrlsvGf8Z
Content-Type: Text/Plain;
  charset="windows-1252"
Content-Transfer-Encoding: 7bit

On Saturday 03 September 2011 18:32:38 Alex Kozlov wrote:
> On Fri, Sep 02, 2011 at 06:50:44PM +0000, Hans Petter Selasky wrote:
> > Log:
> >   This patch adds automatic detection of USB mass storage devices
> >   which does not support the no synchronize cache SCSI command.
> >   
> >   The __FreeBSD_version version macro has been bumped and
> >   external kernel modules needs to be recompiled after
> >   this patch.
> >   
> >   Approved by:    re (kib)
> >   MFC after:      1 week
> >   PR:		usb/160299
> > 
> > Modified:
> >   head/sys/dev/usb/quirk/usb_quirk.c
> >   head/sys/dev/usb/storage/umass.c
> >   head/sys/dev/usb/usb_device.c
> >   head/sys/dev/usb/usb_device.h
> >   head/sys/dev/usb/usb_dynamic.c
> >   head/sys/dev/usb/usb_dynamic.h
> >   head/sys/dev/usb/usb_freebsd.h
> >   head/sys/dev/usb/usb_msctest.c
> >   head/sys/dev/usb/usb_msctest.h
> >   head/sys/dev/usb/usbdi.h
> >   head/sys/sys/param.h
> 
> This change broke the detection of one of my flash cards:
> 
> Root mount waiting for: usbus7
> ugen7.2: <vendor 0x1221> at usbus7
> umass0: <vendor 0x1221 Flsah Disk. class 0/0, rev 2.00/0.00, addr 2> on
> usbus7 Root mount waiting for: usbus7
> (probe0:umass-sim0:0:0:0): INQUIRY. CDB: 12 0 0 0 24 0
> (probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
> (probe0:umass-sim0:0:0:0): SCSI status: Check Condition
> (probe0:umass-sim0:0:0:0): SCSI sense: ILLEGAL REQUEST asc:24.0 (Invalid
> field in CDB) field replaceable unit 6 Root mount waiting for: usbus7
> Trying to mount root from ufs:/dev/da0a [ro]...
> mountroot: waiting for device /dev/da0a ...
> Mounting from ufs:/dev/da0a failed with error 19.
> 
> 
> --
> Adios

Hi,

Can you try the attached patch?

Also add:

options USB_DEBUG

to kernel config and set hw.usb.debug=1 during boot.

--HPS

--Boundary-00=_gDnYO7OrlsvGf8Z
Content-Type: text/x-patch; charset="windows-1252"; name="msc_auto_quirk.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
	filename="msc_auto_quirk.patch"

=== sys/dev/usb/usb_msctest.c
==================================================================
--- sys/dev/usb/usb_msctest.c	(revision 225354)
+++ sys/dev/usb/usb_msctest.c	(local)
@@ -605,6 +605,7 @@
 	uint8_t is_no_direct;
 	uint8_t sid_type;
 	int err;
+	int failed = 0;
 
 	sc = bbb_attach(udev, iface_index);
 	if (sc == NULL)
@@ -645,6 +646,8 @@
 
 		if (err != ERR_CSW_FAILED)
 			goto error;
+
+		failed = 1;
 	}
 
 	err = bbb_command_start(sc, DIR_IN, 0, NULL, 0,
@@ -659,11 +662,13 @@
 		DPRINTF("Device doesn't handle synchronize cache\n");
 
 		usbd_add_dynamic_quirk(udev, UQ_MSC_NO_SYNC_CACHE);
+
+		failed = 1;
 	}
 
 done:
 	bbb_detach(sc);
-	return (0);
+	return (failed ? USB_ERR_STALLED : 0);
 
 error:
  	bbb_detach(sc);

--Boundary-00=_gDnYO7OrlsvGf8Z--



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