From rick@kiwi-computer.com  Tue Oct 14 21:41:10 2003
Return-Path: <rick@kiwi-computer.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 0E62816A4B3
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 14 Oct 2003 21:41:10 -0700 (PDT)
Received: from kiwi-computer.com (megan.kiwi-computer.com [63.224.10.3])
	by mx1.FreeBSD.org (Postfix) with SMTP id 1AF5F43F85
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 14 Oct 2003 21:41:07 -0700 (PDT)
	(envelope-from rick@kiwi-computer.com)
Received: (qmail 18651 invoked by uid 2001); 15 Oct 2003 04:41:06 -0000
Message-Id: <20031015044106.18650.qmail@kiwi-computer.com>
Date: 15 Oct 2003 04:41:06 -0000
From: Rick C.Petty <rick@kiwi-computer.com>
Reply-To: Rick C.Petty <rick@kiwi-computer.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] to add PNY Attache Flash Drive to umass(4)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         58045
>Category:       kern
>Synopsis:       [patch] to add PNY Attache Flash Drive to umass(4)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Oct 14 21:50:09 PDT 2003
>Closed-Date:    Wed Dec 17 21:57:46 PST 2003
>Last-Modified:  Wed Feb 18 13:50:13 PST 2004
>Originator:     Rick C. Petty
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
>Environment:
System: FreeBSD 5.1-CURRENT FreeBSD 5.1-CURRENT #1: Tue Oct 14 13:27:42 EDT 2003 root@:/usr/src/sys/i386/compile/GENERIC i386

>Description:
	PNY's Attache USB 2.0 Flash Drive is a solid-state memory storage
device.  However neither the device nor the vendor are listed in
dev/usb/usbdevs and the drive fails to operate correctly.  The kernel
reports "Phase Errors" with varying sizes of residue (1024, 512, 0) as well
as numerous "Synchronize cache failed" errors.  fdisk(8) does not report
correctly and attempts to write the partition map or mount the drive fail.

The following patches were applied to a CVSup'd 5-CURRENT as of today (adds
the PNY vendor and the product ID which match my flash drive).  I guessed
at the command protocol and "ignore residue" quirk; the patches allowed
fdisk, mount, and read/write to work correctly.  The kernel still reports:

umass0: Phase Error, residue = 0
(da0:umass-sim0:0:0:0): Synchronize cache failed, status == 0x4, scsi status == 0x0

repeatedly, but otherwise it seems to work correctly.  Someone with USB/CAM
knowledge might suggest a better fix; at least this is a [working] start.

>How-To-Repeat:
	CVS to 5.1-CURRENT as of Oct 14 2003, use GENERIC or a kernel
configured with umass & friends.  Plug in USB 2.0 PNY Attache Flash Drive
and try to fdisk(8) or mount da0s1.  Kernel will report numerous Phase
Errors with residue and the operation will not succeed.  With the following
patches, fdisk reported the correct partition table and mount succeeded.

>Fix:

--- usbdevs.patch begins here ---
--- /sys/dev/usb/usbdevs.orig	Fri Oct 10 16:58:46 2003
+++ /sys/dev/usb/usbdevs	Tue Oct 14 18:10:45 2003
@@ -346,6 +346,7 @@ vendor AGATE		0x0c08	Agate Technologies
 vendor DMI		0x0c0b	DMI
 vendor LUWEN		0x0c76	Luwen
 vendor SMC3		0x0d5c  Standard Microsystems
+vendor PNY		0x0d7d	PNY
 vendor HAWKING		0x0e66	Hawking Technologies
 vendor MOTOROLA		0x1063	Motorola
 vendor PLX		0x10b5	PLX
@@ -999,6 +1000,9 @@ product PIENGINEERING PS2USB	0x020b	PS2 
 
 /* PLX products */
 product PLX TESTBOARD		0x9060	test board
+
+/* PNY products */
+product PNY ATTACHE		0x1300	USB 2.0 Flash Drive
 
 /* Primax products */
 product PRIMAX G2X300		0x0300	G2-200 scanner
--- usbdevs.patch ends here ---

--- umass.patch begins here ---
--- /sys/dev/usb/umass.c.orig	Tue Oct 14 07:46:22 2003
+++ /sys/dev/usb/umass.c	Tue Oct 14 18:22:54 2003
@@ -358,6 +358,10 @@ Static struct umass_devdescr_t umass_dev
 	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
 	  WRONG_CSWSIG
 	},
+	{ USB_VENDOR_PNY, USB_PRODUCT_PNY_ATTACHE, RID_WILDCARD,
+	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
+	  IGNORE_RESIDUE
+	},
 	{ USB_VENDOR_SCANLOGIC, USB_PRODUCT_SCANLOGIC_SL11R, RID_WILDCARD,
 	  UMASS_PROTO_ATAPI | UMASS_PROTO_CBI_I,
 	  NO_QUIRKS
--- umass.patch ends here ---


>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: sanpei 
State-Changed-When: Wed Dec 17 21:56:59 PST 2003 
State-Changed-Why:  
Committed umass.c in Rev. 1.93. Thanks 

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

From: Naveen Kumar <g_naveen_k@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org, rick@kiwi-computer.com
Cc: g_naveen_k@yahoo.com
Subject: Re: kern/58045: [patch] to add PNY Attache Flash Drive to umass(4)
Date: Wed, 18 Feb 2004 13:43:07 -0800 (PST)

 Hi,
   I have a PNY-ATTACHE USB 2.0 128MB flash drive. I am
 running FreeBSD-5.0-RELEASE. The fix that was
 suggested doesn't seem to work for me. 
 
 +	{ USB_VENDOR_PNY, USB_PRODUCT_PNY_ATTACHE,
 RID_WILDCARD,
 +	  UMASS_PROTO_SCSI | UMASS_PROTO_BBB,
 +	  IGNORE_RESIDUE
 +	},
 
 Only when I changed the proto to UMASS_PROTO_ATAPI was
 I able to mount, read, etc from the device. The
 IGNORE_RESIDUE didn't seem to have any consequence. I
 changed it to NO_QUIRKS and the device still worked. 
 Note: I still get the Phase Error, residue = 0
 statement regardless.
 
 
 Naveen
 
 __________________________________
 Do you Yahoo!?
 Yahoo! Mail SpamGuard - Read only the mail you want.
 http://antispam.yahoo.com/tools
>Unformatted:
