Browse Source

[PATCH] USB Storage: HP8200: Another device type detection fix

There appears to be one more case where the HP8200 CD writer devices are
detected as flash readers - when the USB cable is replugged after use, with
the power cable still connected.

Oddly enough, the identify device command appears to 'fall through' when the
devices are in this state, the status register reading exactly the same opcode
as the command (0xA1) that was just executed.

I think it's safe to label this behaviour as specific to HP8200 devices, I
can't get the flash devices to respond like this.

This patch should solve the last of the HP8200 issues which have cropped up
recently.

Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

 drivers/usb/storage/shuttle_usbat.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
Daniel Drake 19 years ago
parent
commit
a8798533c1
1 changed files with 6 additions and 6 deletions
  1. 6 6
      drivers/usb/storage/shuttle_usbat.c

+ 6 - 6
drivers/usb/storage/shuttle_usbat.c

@@ -855,15 +855,15 @@ static int usbat_identify_device(struct us_data *us,
  	if (rc != USB_STOR_XFER_GOOD)
  	if (rc != USB_STOR_XFER_GOOD)
  		return USB_STOR_TRANSPORT_ERROR;
  		return USB_STOR_TRANSPORT_ERROR;
 
 
-	// Check for error bit
-	if (status & 0x01) {
-		 // Device is a CompactFlash reader/writer
-		US_DEBUGP("usbat_identify_device: Detected Flash reader/writer\n");
-		info->devicetype = USBAT_DEV_FLASH;
-	} else {
+	// Check for error bit, or if the command 'fell through'
+	if (status == 0xA1 || !(status & 0x01)) {
 		// Device is HP 8200
 		// Device is HP 8200
 		US_DEBUGP("usbat_identify_device: Detected HP8200 CDRW\n");
 		US_DEBUGP("usbat_identify_device: Detected HP8200 CDRW\n");
 		info->devicetype = USBAT_DEV_HP8200;
 		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;
 	}
 	}
 
 
 	return USB_STOR_TRANSPORT_GOOD;
 	return USB_STOR_TRANSPORT_GOOD;