Date: Fri, 25 Mar 2005 00:46:39 +0100 From: Michal Mertl <mime@traveller.cz> To: current@freebsd.org Subject: problem with usb memory stick (with patch) Message-ID: <1111707999.640.26.camel@genius2.i.cz>
next in thread | raw e-mail | index | archive | help
--=-RH/Gcw+2JLJqZi/bhsS5
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Hello all,
I've got a USB 2.0 memory stick which doesn't attach correctly.
On failed attach I get the following in the messages:
--------
Mar 24 23:44:13 genius2 kernel: umass0: M-SysT5 Dell Memory Key, rev
2.00/2.00, addr 2
Mar 24 23:44:13 genius2 kernel: umass0: SCSI over Bulk-Only; quirks =
0x0
Mar 24 23:44:13 genius2 kernel: umass0:0:0:-1: Attached to scbus0
Mar 24 23:44:14 genius2 kernel: pass0 at umass-sim0 bus 0 target 0 lun 0
Mar 24 23:44:14 genius2 kernel: pass0: <M-SysT5 Dell Memory Key 5.00>
Removable Direct Access SCSI-0 device
Mar 24 23:44:14 genius2 kernel: pass0: Serial Number u
Mar 24 23:44:14 genius2 kernel: pass0: 40.000MB/s transfers
Mar 24 23:44:14 genius2 kernel: GEOM: new disk da0
Mar 24 23:44:14 genius2 kernel: (da0:umass-sim0:0:0:0): Retrying Command
Mar 24 23:44:14 genius2 last message repeated 3 times
Mar 24 23:44:14 genius2 kernel: (da0:umass-sim0:0:0:0): error 6
Mar 24 23:44:14 genius2 kernel: (da0:umass-sim0:0:0:0): Unretryable
Error
Mar 24 23:44:14 genius2 kernel: da0 at umass-sim0 bus 0 target 0 lun 0
Mar 24 23:44:14 genius2 kernel: da0: <M-SysT5 Dell Memory Key 5.00>
Removable Direct Access SCSI-0 device
Mar 24 23:44:14 genius2 kernel: da0: Serial Number u
Mar 24 23:44:14 genius2 kernel: da0: 40.000MB/s transfers
Mar 24 23:44:14 genius2 kernel: da0: Attempt to query device size
failed: UNIT ATTENTION, Medium not present
Mar 24 23:44:14 genius2 kernel: (da0:umass-sim0:0:0:0): READ CAPACITY.
CDB: 25 0 0 0 0 0 0 0 0 0
Mar 24 23:44:14 genius2 kernel: (da0:umass-sim0:0:0:0): CAM Status: SCSI
Status Error
Mar 24 23:44:14 genius2 kernel: (da0:umass-sim0:0:0:0): SCSI Status:
Check Condition
Mar 24 23:44:14 genius2 kernel: (da0:umass-sim0:0:0:0): UNIT ATTENTION
asc:3a,0
Mar 24 23:44:14 genius2 kernel: (da0:umass-sim0:0:0:0): Medium not
present
Mar 24 23:44:14 genius2 kernel: (da0:umass-sim0:0:0:0):
(da0:umass-sim0:0:0:0): READ CAPACITY. CDB: 25 0 0 0 0 0 0 0 0 0
Mar 24 23:44:14 genius2 kernel: (da0:umass-sim0:0:0:0): UNIT ATTENTION
asc:3a,0
Mar 24 23:44:14 genius2 kernel: (da0:umass-sim0:0:0:0): Medium not
present
.
.
.
Mar 24 23:44:14 genius2 kernel: Retries Exhausted
Mar 24 23:44:14 genius2 kernel: (da0:umass-sim0:0:0:0): error 6
Mar 24 23:44:14 genius2 kernel: (da0:umass-sim0:0:0:0): Unretryable
Error
Mar 24 23:44:14 genius2 kernel: Opened disk da0 -> 6
---------
Quite a long time ago I found out that the stick works when I delay the
attachment a bit - increasing USB_PORT_POWERUP_DELAY (in
src/sys/dev/usb/usb.h) from 300 to 1000 helps. I found another, probably
a bit more elegant, solution - I invented a new quirk and put it into
use in umass.c which delays the scsi attachment in umass_cam_attach.
There's a comment just above the callout (which firing after longer
delay is the main part of the "fix") which reads:
/* Notify CAM of the new device after a short delay. Any
* failure is benign, as the user can still do it byhand
* (camcontrol rescan <busno>). Only do this if we are not
* booting, because CAM does a scan after booting has
* completed, when interrupts have been enabled.
*/
The comment isn't probably correct - no 'eject', 'stop', 'rescan' or
'reset' will ever fix the stick for me.
I don't know if the problem is specific to my USB device. If it is than
the quirk might be appropriate solution but if other devices need the
pause too (and maybe even much longer) than fixing the code some other
way (to make the comment true?) might be better.
Michal Mertl
--=-RH/Gcw+2JLJqZi/bhsS5
Content-Disposition: attachment; filename=usb-umass.patch
Content-Type: text/x-patch; name=usb-umass.patch; charset=ISO-8859-2
Content-Transfer-Encoding: 7bit
Index: umass.c
===================================================================
RCS file: /home/fcvs/cvs/src/sys/dev/usb/umass.c,v
retrieving revision 1.119
diff -u -3 -r1.119 umass.c
--- umass.c 14 Feb 2005 02:17:53 -0000 1.119
+++ umass.c 24 Mar 2005 23:17:55 -0000
@@ -314,6 +314,8 @@
# define NO_INQUIRY 0x0400
/* Device cannot handle INQUIRY EVPD, return CHECK CONDITION */
# define NO_INQUIRY_EVPD 0x0800
+ /* Device needs time to settle down /2s/ XXX */
+# define UMASS_ADD_DELAY 0x1000
};
Static struct umass_devdescr_t umass_devdescrs[] = {
@@ -387,6 +389,10 @@
UMASS_PROTO_ATAPI | UMASS_PROTO_BBB,
NO_QUIRKS
},
+ { USB_VENDOR_MSYSTEMS, USB_PRODUCT_MSYSTEMS_DELLMEMKEY, RID_WILDCARD,
+ UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
+ UMASS_ADD_DELAY
+ },
{ USB_VENDOR_NEODIO, USB_PRODUCT_NEODIO_ND3260, RID_WILDCARD,
UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
FORCE_SHORT_INQUIRY
@@ -891,6 +897,7 @@
(void) umass_match_proto(sc, sc->iface, uaa->device);
id = usbd_get_interface_descriptor(sc->iface);
+
#ifdef USB_DEBUG
printf("%s: ", USBDEVNAME(sc->sc_dev));
switch (sc->proto&UMASS_PROTO_COMMAND) {
@@ -2262,6 +2269,7 @@
Static int
umass_cam_attach(struct umass_softc *sc)
{
+ int delay_len;
#ifndef USB_DEBUG
if (bootverbose)
#endif
@@ -2278,7 +2286,11 @@
* completed, when interrupts have been enabled.
*/
- usb_callout(sc->cam_scsi_rescan_ch, MS_TO_TICKS(200),
+ if (sc->quirks && UMASS_ADD_DELAY)
+ delay_len = 2000;
+ else
+ delay_len = 200;
+ usb_callout(sc->cam_scsi_rescan_ch, MS_TO_TICKS(delay_len),
umass_cam_rescan, sc);
}
Index: usbdevs
===================================================================
RCS file: /home/fcvs/cvs/src/sys/dev/usb/usbdevs,v
retrieving revision 1.226
diff -u -3 -r1.226 usbdevs
--- usbdevs 21 Mar 2005 08:43:54 -0000 1.226
+++ usbdevs 24 Mar 2005 22:39:48 -0000
@@ -1188,6 +1188,7 @@
/* M-Systems products */
product MSYSTEMS DISKONKEY 0x0010 DiskOnKey
product MSYSTEMS DISKONKEY2 0x0011 DiskOnKey
+product MSYSTEMS DELLMEMKEY 0x0015 Dell Memory Key
/* National Semiconductor */
product NATIONAL BEARPAW1200 0x1000 BearPaw 1200
--=-RH/Gcw+2JLJqZi/bhsS5--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1111707999.640.26.camel>
