Bug 63619

Summary: Add support for SimpleTech UCF-100 USB CompactFlash reader [PATCH]
Product: Base System Reporter: Greg Rivers <gcr>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.2.1-RELEASE   
Hardware: Any   
OS: Any   

Description Greg Rivers 2004-03-01 22:30:15 UTC
	The SimpleTech UCF-100 USB CompactFlash reader
	(http://www.simpletech.com/parts/sti_ucf100.htm) does not work.
	Attaching it wedges the machine.

	These patches make it usable, if not fully functional.

Fix: 

Apply the following patches to usbdevs and umass.c in /usr/src/sys/dev/usb/:

------------------------------------- cut --------------------------------------
--- usbdevs	2004/02/25 23:07:42	1.1
+++ usbdevs	2004/02/26 19:15:35	1.2
@@ -271,6 +271,7 @@
 vendor MICROTECH	0x07af	Microtech
 vendor GENERALINSTMNTS	0x07b2	General Instruments (Motorola)
 vendor OLYMPUS		0x07b4	Olympus
+vendor SIMPLETECH	0x07c4	SimpleTech
 vendor ABOCOM		0x07b8	AboCom Systems
 vendor KEISOKUGIKEN	0x07c1	Keisokugiken
 vendor APG		0x07c5	APG Cash Drawer
@@ -1100,6 +1101,9 @@
 /* Silicon Portals Inc. */
 product SILICONPORTALS YAPPH_NF	0x0200	YAP Phone (no firmware)
 product SILICONPORTALS YAPPHONE	0x0201	YAP Phone
+
+/* SimpleTech products */
+product SIMPLETECH UCF100	0xa400	FlashLink UCF-100 CompactFlash Reader
 
 /* Sirius Technologies products */
 product SIRIUS ROADSTER		0x0001	NetComm Roadster II 56 USB
------------------------------------- cut --------------------------------------

------------------------------------- cut --------------------------------------
--- umass.c	2004/02/25 23:09:55	1.1
+++ umass.c	2004/02/26 19:15:35	1.2
@@ -386,6 +386,10 @@
 	  UMASS_PROTO_ATAPI | UMASS_PROTO_CBI_I,
 	  FORCE_SHORT_INQUIRY
 	},
+	{ USB_VENDOR_SIMPLETECH, USB_PRODUCT_SIMPLETECH_UCF100, RID_WILDCARD,
+          UMASS_PROTO_ATAPI | UMASS_PROTO_BBB,
+	  NO_INQUIRY | NO_GETMAXLUN
+	},
 	{ VID_EOT, PID_EOT, RID_EOT, 0, 0 }
 };
 

------------------------------------- cut --------------------------------------


With the above patches in place, the device attaches and can be used for
DOS file systems.  However, attempting to use UFS, or write blocks bigger
than 16k (eg. with dd) results in SCSI errors and an eventual hang.
I don't know how to tell whether this is due to a problem with the device,
or with the SCSI/CAM driver.  But it shouldn't hang the machine in any
case.
How-To-Repeat: 	Plug the device in.  Errors are generated as follows:

	kernel: umass0: USB Mass Storage, rev 1.10/1.13, addr 2
	kernel: umass0: Get Max Lun not supported (STALLED)
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: GEOM: create disk da0 dp=0xc2e0c450
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	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: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: umass0: BBB reset failed, STALLED
	kernel: umass0: BBB bulk-in clear stall failed, STALLED
	kernel: umass0: BBB bulk-out clear stall failed, STALLED
	kernel: (da0:umass-sim0:0:0:0): removing device entry
	kernel: GEOM: destroy disk da0 dp=0xc2e0c450
	kernel: umass0: at uhub0 port 1 (addr 2) disconnected
	kernel: umass0: detached

	[ machine wedges ]

	syslogd: kernel boot file is /boot/kernel/kernel
	kernel: Copyright (c) 1992-2004 The FreeBSD Project.
	kernel: Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	kernel: The Regents of the University of California. All rights reserved.
	kernel: FreeBSD 5.2.1-RELEASE #0: Wed Feb 25 21:16:35 CST 2004
	...
Comment 1 MIHIRA Sanpei Yoshiro freebsd_committer freebsd_triage 2004-03-04 06:46:10 UTC
State Changed
From-To: open->analyzed

I will commit this changes
Comment 2 MIHIRA Sanpei Yoshiro freebsd_committer freebsd_triage 2004-03-04 07:54:18 UTC
State Changed
From-To: analyzed->patched

Commited, Thanks.I will MFC.
Comment 3 Greg Rivers 2004-03-04 15:33:20 UTC
Thanks for commiting the changes.  The device is fully functional with them.  
I can no longer reproduce the SCSI errors with large block sizes; it works 
fine now.  I think the USB interface was in a bad state, and a power cycle 
cleared it.
-- 
Greg Rivers
Comment 4 MIHIRA Sanpei Yoshiro freebsd_committer freebsd_triage 2004-06-13 08:46:17 UTC
State Changed
From-To: patched->closed

I forgot close this PR.