usb/120572: quirk to support ASUS P535 as umass (and inquiry fixup)

Andriy Gapon avg at icyb.net.ua
Tue Feb 12 14:20:02 PST 2008


>Number:         120572
>Category:       usb
>Synopsis:       quirk to support ASUS P535 as umass (and inquiry fixup)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-usb
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 12 22:20:00 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Andriy Gapon
>Release:        FreeBSD 7.0-RC1 i386
>Organization:
>Environment:
System: FreeBSD 7.0-RC1 i386


	
>Description:
History and details of the issue can be found in the following post:
http://docs.freebsd.org/cgi/mid.cgi?47AEFFAF.1010403

Short summary:
ASUS P535 smart phone configured to act as a umass storage requires
DA_Q_NO_SYNC_CACHE quirk in da(4). The problem is that da(4) quirks
are set based on inquiry information, but the device in question
provides entirely empty inquiry information (bytes for vendor, product
and revision are all zeroes). The only way in current infrastructure
to provide a quirk for such a device is to have a wildcard quirk
("*", "*", "*"). But that quirk would be applied to all da(4) devices,
which can not be good.

Proposed patch has two parts. umass part detects inquiry responses that
have empty vendor and product info and sets product and vendor info
to the corresponding USB device parameters (as hexadecimal numbers).
scsi_da part provides the quirk for the ASUS device in question.

Note that the umass.c part of teh patch might provide help to supporting
more similarly impaired devices.

>How-To-Repeat:
1. Get ASUS P535 device with miniSD memory card
2. configure the device to act as umass for USB connection (Setting/Connection/USB)
3. plug into PC
4. observe info and error messages like the following:
kernel: umass0: ASUS Generic Mass Storage, rev 2.00/0.00, addr 3
kernel: da0 at umass-sim0 bus 0 target 0 lun 0
kernel: da0: <  > Removable Direct Access SCSI-0 device
kernel: da0: 1.000MB/s transfers
kernel: da0: 1952MB (3998720 512 byte sectors: 255H 63S/T 248C)
umass0: Invalid CSW: tag 7 should be 8
(da0:umass-sim0:0:0:0): Synchronize cache failed, status == 0x0, scsi status == 0x4

>Fix:

	

--- p535.diff begins here ---
--- sys/dev/usb/umass.c	2008-02-10 15:30:23.000000000 +0200
+++ sys/dev/usb/umass.c	2008-02-10 15:02:43.000000000 +0200
@@ -3063,6 +3059,12 @@
 			maxsector = scsi_4btoul(rcap->addr) - 1;
 			scsi_ulto4b(maxsector, rcap->addr);
 		}
+		else if (csio->cdb_io.cdb_bytes[0] == INQUIRY &&
+		         csio->data_ptr[8] == '\0' && csio->data_ptr[16] == '\0') {
+			usb_device_descriptor_t *dd = usbd_get_device_descriptor(sc->sc_udev);
+			sprintf(&csio->data_ptr[8],  "%04x", UGETW(dd->idVendor));
+			sprintf(&csio->data_ptr[16], "%04x", UGETW(dd->idProduct));
+		}
 		xpt_done(ccb);
 		break;
 
--- sys/cam/scsi/scsi_da.c	2008-02-10 12:40:43.000000000 +0200
+++ sys/cam/scsi/scsi_da.c	2008-02-10 15:09:05.000000000 +0200
@@ -535,6 +535,13 @@
 		{T_DIRECT, SIP_MEDIA_REMOVABLE, "ChipsBnk", "USB*",
 		 "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE
 	},
+	{
+		/*
+		 * ASUS P535 in umass device mode
+		 */
+		{T_DIRECT, SIP_MEDIA_REMOVABLE, "0b05*", "422f*",
+		 "*"}, /*quirks*/ DA_Q_NO_SYNC_CACHE
+	},
 };
 
 static	disk_strategy_t	dastrategy;
--- p535.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-usb mailing list