Ok, unfortunately, another person who tested the fix has pointed out that while it works when you load the module and then plug the device in, it fails if you plug the device in and load the module later.

So we're going to need to fix this another way, which probably means doing the device detection at a later stage.

Infact there are some cleanups I can probably do in the initialization routine, but I didn't want to do them previously incase it broke the driver for HP8200 users. (I spent some time looking for HP8200 owners when I was making the flash adaptations to the driver, and found nobody)

I'd be grateful if people could test the attached patch. It temporarily hardcodes the detection as a HP8200 so there's no chance of it being detected as a disk at this stage. Testing reading of a cdrom should be sufficient.

This process will probably take a few patches to complete, as I'm trying not to alter the behaviour too much in any one patch.

Thanks!
Daniel
--- linux/drivers/usb/storage/shuttle_usbat.c.orig	2005-08-02 12:48:33.000000000 +0100
+++ linux/drivers/usb/storage/shuttle_usbat.c	2005-08-02 13:07:28.000000000 +0100
@@ -836,39 +836,7 @@ static int usbat_identify_device(struct 
 	if (!us || !info)
 		return USB_STOR_TRANSPORT_ERROR;
 
-	rc = usbat_device_reset(us);
-	if (rc != USB_STOR_TRANSPORT_GOOD)
-		return rc;
-
-	/*
-	 * By examining the device signature after a reset, we can identify
-	 * whether the device supports the ATAPI packet interface.
-	 * The flash-devices do not support this, whereas the HP CDRW's obviously
-	 * do.
-	 *
-	 * This method is not ideal, but works because no other devices have been
-	 * produced based on the USBAT/USBAT02.
-	 *
-	 * Section 9.1 of the ATAPI-4 spec states (amongst other things) that
-	 * after a device reset, a Cylinder low of 0x14 indicates that the device
-	 * does support packet commands.
-	 */
-	rc = usbat_read(us, USBAT_ATA, USBAT_ATA_LBA_ME, &status);
-	if (rc != USB_STOR_XFER_GOOD)
-		return USB_STOR_TRANSPORT_ERROR;
-
-	US_DEBUGP("usbat_identify_device: Cylinder low is %02X\n", status);
-
-	if (status == 0x14) {
-		// Device is HP 8200
-		US_DEBUGP("usbat_identify_device: Detected HP8200 CDRW\n");
-		info->devicetype = USBAT_DEV_HP8200;
-	} else {
-		// Device is a CompactFlash reader/writer
-		US_DEBUGP("usbat_identify_device: Detected Flash reader/writer\n");
-		info->devicetype = USBAT_DEV_FLASH;
-	}
-
+	info->devicetype = USBAT_DEV_HP8200;
 	return USB_STOR_TRANSPORT_GOOD;
 }
 
@@ -1340,30 +1308,6 @@ int init_usbat(struct us_data *us)
 
 	US_DEBUGP("INIT 4\n");
 
-	if (usbat_get_device_type(us) == USBAT_DEV_HP8200) {
-		msleep(250);
-
-		// Write 0x80 to ISA port 0x3F
-		rc = usbat_write(us, USBAT_ISA, 0x3F, 0x80);
-		if (rc != USB_STOR_XFER_GOOD)
-			return USB_STOR_TRANSPORT_ERROR;
-
-		US_DEBUGP("INIT 5\n");
-
-		// Read ISA port 0x27
-		rc = usbat_read(us, USBAT_ISA, 0x27, status);
-		if (rc != USB_STOR_XFER_GOOD)
-			return USB_STOR_TRANSPORT_ERROR;
-
-		US_DEBUGP("INIT 6\n");
-
-		rc = usbat_read_user_io(us, status);
-		if (rc != USB_STOR_XFER_GOOD)
-			return USB_STOR_TRANSPORT_ERROR;
-
-		US_DEBUGP("INIT 7\n");
-	}
-
 	rc = usbat_select_and_test_registers(us);
 	if (rc != USB_STOR_TRANSPORT_GOOD)
 		return rc;

Reply via email to