From ivk@kristal.ru  Thu Oct  3 19:34:56 2002
Return-Path: <ivk@kristal.ru>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 17D4D37B401
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  3 Oct 2002 19:34:56 -0700 (PDT)
Received: from mail.kristal.ru (mail.kristal.ru [195.161.155.118])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 01D7F43E42
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  3 Oct 2002 19:34:55 -0700 (PDT)
	(envelope-from ivk@kristal.ru)
Received: by mail.kristal.ru (Postfix, from userid 1000)
	id CFB511B2; Fri,  4 Oct 2002 12:34:47 +1000 (YAKST)
Message-Id: <20021004023447.CFB511B2@mail.kristal.ru>
Date: Fri,  4 Oct 2002 12:34:47 +1000 (YAKST)
From: Igor Kulemzin <ivk@kristal.ru>
Reply-To:
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: QUIRK: USB drive (kern/37322)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         43649
>Category:       kern
>Synopsis:       QUIRK: USB drive (kern/37322)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    njl
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Oct 03 19:40:06 PDT 2002
>Closed-Date:    Fri Oct 18 12:16:55 PDT 2002
>Last-Modified:  Fri Oct 18 12:20:01 PDT 2002
>Originator:     Igor Kulemzin <ivk@kristal.ru>
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
>Environment:
System: FreeBSD mail.kristal.ru 4.6-STABLE FreeBSD 4.6-STABLE #0: Mon Aug 26 11:46:57 YAKST 2002 ivk@mail.kristal.ru:/usr/obj/usr/src/sys/HOLD i386

camcontrol inquiry 0:0:0
pass0: < USB DISK 1.05> Removable Direct Access SCSI-0 device
pass0: Serial Number 
pass0: 650KB/s transfers

No brand disk, without name (maybe china)
usbd -d -v:
usbd: attach event at 1033639123.015733000, product 0x0100, vendor 0x0d7d:
  vndr=0x0d7d prdct=0x0100 rlse=0x0100 clss=0x0000 subclss=0x0000 prtcl=0x0000
  device names: umass0

Transport type: USB

dmesg output for failed attach attempts:
umass0:          USB Disk    , rev 1.00/1.00, addr 2
da0 at umass-sim0 bus 0 target 0 lun 0
da0: < USB DISK 1.05> Removable Direct Access SCSI-0 device
da0: 650KB/s transfers
da0: 62MB (128000 512 byte sectors: 64H 32S/T 62C)
umass0: BBB reset failed, TIMEOUT
umass0: BBB bulk-in clear stall failed, TIMEOUT
umass0: BBB bulk-out clear stall failed, TIMEOUT
umass0: BBB reset failed, TIMEOUT
umass0: BBB bulk-in clear stall failed, TIMEOUT
umass0: BBB bulk-out clear stall failed, TIMEOUT
msdos: /dev/da0s1: Input/output error

dmesg output for successful attach attempts:
umass0:          USB Disk    , rev 1.00/1.00, addr 2
da0 at umass-sim0 bus 0 target 0 lun 0
da0: < USB DISK 1.05> Removable Direct Access SCSI-0 device
da0: 650KB/s transfers
da0: 62MB (128000 512 byte sectors: 64H 32S/T 62C)
Re-scan of bus 0 was successful

ivk@kristal.ru

--- scsi_da.c.orig	Sat Jun  1 02:18:45 2002
+++ scsi_da.c	Sun Aug 11 15:43:37 2002
@@ -317,6 +317,13 @@
 		{T_DIRECT, SIP_MEDIA_REMOVABLE, "NO BRAND", "PEN DRIVE", "*"},
 		/*quirks*/ DA_Q_NO_6_BYTE|DA_Q_NO_SYNC_CACHE
  	},
+	{
+		/*
+		 * Nonamed USB Pen Drive
+		 */
+		{T_DIRECT, SIP_MEDIA_REMOVABLE, "", "USB DISK", "*"},
+		/*quirks*/ DA_Q_NO_6_BYTE|DA_Q_NO_SYNC_CACHE
+	},
  	{
 		/*
 		 * FujiFilm Camera

>Description:
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->njl 
Responsible-Changed-By: njl 
Responsible-Changed-When: Thu Oct 17 10:19:32 PDT 2002 
Responsible-Changed-Why:  
quirk maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=43649 

From: Nate Lawson <nate@root.org>
To: Igor Kulemzin <ivk@kristal.ru>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: kern/43649
Date: Thu, 17 Oct 2002 10:42:56 -0700 (PDT)

 Thanks for submitting the information.  Please only respond to this PR
 from now on.  I have two questions:
 
 1. What happens if you remove the NO_SYNC_CACHE quirk but leave the
 NO_6_BYTE one in?  Please report dmesg output from that.
 
 2. Is there any possible marking on the box or case or anything to
 identify it?  We don't want the quirk to match devices it shouldn't.
 
 -Nate
 
 
State-Changed-From-To: open->closed 
State-Changed-By: njl 
State-Changed-When: Fri Oct 18 12:12:55 PDT 2002 
State-Changed-Why:  
I have analyzed the situation and will not be adding the quirk.  The reason 
is the device reports a NULL vendor id and is called "USB DISK" which would 
match too many other potential devices.  I am very sorry we cannot solve 
this as easily as adding the quirk but the potential risk in adding such 
a broadly-matching quirk is too high. 

Igor, if you wish to use the device, you can maintain your local patch 
against scsi_da.c.  We have been working on a new CAM which will also 
fix this problem without requiring a quirk, but it will be a long time before 
this work is complete.  Thank you for being helpful and I am sorry that 
I cannot commit this as is. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=43649 

From: Nate Lawson <nate@root.org>
To: Igor Kulemzin <ivk@kristal.ru>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: kern/43649
Date: Fri, 18 Oct 2002 12:18:20 -0700 (PDT)

 On Fri, 18 Oct 2002, Igor Kulemzin wrote:
 >   dmesg output the same if I include NO_SYNC_CACHE quirk and without
 >   them. I've tested with and without and don't found any differencies.
 >   But I've don't test for a long time. In w2k for this device "disk
 >   properties" showed with disabled "Write cache enabled".
 > 
 >   Please wait for next week. I verify that. And can you say me, what
 >   the NO_SYNC_CACHE means. I'd read about that but don't fully
 >   understand.
 
 Windows disables the write cache for all removable media, including your
 USB pen drive.  This is different from the SYNC CACHE SCSI command.
 
 Again, thank you for all your info and I'm sorry I cannot add this.
 
 -Nate
 
>Unformatted:
