[PATCH] USB Storage: Update unusual_devs entry for Datafab KECF-USB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This device suffers from the off-by-one error when reporting the capacity,
so add US_FL_FIX_CAPACITY to the existing entry.

Signed-off-by: Nick Holloway <Nick.Holloway@xxxxxxxxxxxxxx>
---
In changing hardware and distribution, I have switched from using a 2.6.18
derived kernel, to a 2.6.27 derived kernel, and I found that I was no
longer able to read compact flash cards in the Datafab KECF-USB reader.

Inserting the reader with a 16MB card reports:

    scsi 5:0:0:0: Direct-Access     Datafab  KECF-USB         0113 PQ: 0 ANSI: 2
    sd 5:0:0:0: [sdd] 31233 512-byte hardware sectors (16 MB)
    sd 5:0:0:0: [sdd] Test WP failed, assume Write Enabled
    sd 5:0:0:0: [sdd] Assuming drive cache: write through
    sd 5:0:0:0: [sdd] 31233 512-byte hardware sectors (16 MB)
    sd 5:0:0:0: [sdd] Test WP failed, assume Write Enabled
    sd 5:0:0:0: [sdd] Assuming drive cache: write through
     sdd: sdd1
    sd 5:0:0:0: [sdd] Attached SCSI removable disk

I can't mount the device at this point, as udev hasn't created the
/dev/sdd1 device.

A little while later, I then get reported:

    sd 5:0:0:0: timing out command, waited 180s
    sd 5:0:0:0: [sdd] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE,SUGGEST_OK
    sd 5:0:0:0: [sdd] Sense Key : Hardware Error [current] 
    sd 5:0:0:0: [sdd] Add. Sense: Data phase error
    end_request: I/O error, dev sdd, sector 31232
    Buffer I/O error on device sdd, logical block 31232

After this, udev creates the /dev/sdd1 device (but not /dev/sdd).  Attempting
to mount it hangs (with more of the I/O errors for sector 31232 again).

Inserting the same reader and CF into a PCI adapter reports the correct
capacity:

    scsi 2:0:0:0: Direct-Access     ATA      LEXAR ATA FLASH  V1.0 PQ: 0 ANSI: 5
    sd 2:0:0:0: [sdb] 31232 512-byte hardware sectors (16 MB)
    sd 2:0:0:0: [sdb] Write Protect is off
    sd 2:0:0:0: [sdb] Mode Sense: 00 3a 00 00
    sd 2:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
    sd 2:0:0:0: [sdb] 31232 512-byte hardware sectors (16 MB)
    sd 2:0:0:0: [sdb] Write Protect is off
    sd 2:0:0:0: [sdb] Mode Sense: 00 3a 00 00
    sd 2:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
     sdb: sdb1
    sd 2:0:0:0: [sdb] Attached SCSI removable disk

Looking back at the logs for the 2.6.18 kernel, it also appears to have
over-reported the capacity, but I guess that there wasn't something
attempting to read the last sector of the device.

I have applied the following patch on top of a 2.6.28-rc3 kernel, and
it now reports the correct capacity.  The devices are created by udev
without delay, and the partition is able to be mounted.

    scsi 4:0:0:0: Direct-Access     Datafab  KECF-USB         0113 PQ: 0 ANSI: 2
    sd 4:0:0:0: [sdd] 31232 512-byte hardware sectors: (15.9 MB/15.2 MiB)
    sd 4:0:0:0: [sdd] Test WP failed, assume Write Enabled
    sd 4:0:0:0: [sdd] Assuming drive cache: write through
    sd 4:0:0:0: [sdd] 31232 512-byte hardware sectors: (15.9 MB/15.2 MiB)
    sd 4:0:0:0: [sdd] Test WP failed, assume Write Enabled
    sd 4:0:0:0: [sdd] Assuming drive cache: write through
     sdd: sdd1
    sd 4:0:0:0: [sdd] Attached SCSI removable disk
    sd 4:0:0:0: Attached scsi generic sg3 type 0

 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
index fb9e20e..f32f36b 100644
--- a/drivers/usb/storage/unusual_devs.h
+++ b/drivers/usb/storage/unusual_devs.h
@@ -1225,7 +1225,7 @@ UNUSUAL_DEV(  0x07c4, 0xa400, 0x0000, 0xffff,
 		"Datafab",
 		"KECF-USB",
 		US_SC_DEVICE, US_PR_DEVICE, NULL,
-		US_FL_FIX_INQUIRY ),
+		US_FL_FIX_INQUIRY | US_FL_FIX_CAPACITY ),
 
 /* Reported by Rauch Wolke <rauchwolke@xxxxxxx> */
 UNUSUAL_DEV(  0x07c4, 0xa4a5, 0x0000, 0xffff,
-- 
1.5.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux