• Andries E. Brouwer's avatar
    [PATCH] Feiya 5-in-1 Card Reader · 2cb4a05f
    Andries E. Brouwer authored
    I have a USB 5-in-1 Card Reader, that will read CF and SM and SD/MMC.
    Under Linux it appears as three SCSI devices.
    For today, the report is on the CF part.
    
    The CF part works fine under ordinary usb-storage SCSI simulation,
    with one small problem: 8 and 32 MB cards, that are detected as
    having 15872 and 63488 sectors by other readers, are detected as
    having 15873 and 63489 sectors by this Feiya reader
    (0x090c / 0x1132).
    In the good old days probably nobody would have noticed, but these
    days the partition reading code also wants to read the last sector.
    This results in the SCSI code taking the device off line:
    
    [USB storage does a READ_10, which fails since the sector is past
    the end of the disk. Then it tries a READ_6 and nothing ever happens,
    probably because the device does not support READ_6. Then the
    error handler does an abort which triggers some bugs in scsiglue.c
    and transport.c, then the error handler does a device reset, then
    a host reset, then a bus reset, and finally the device is taken offline.]
    
    The patch below does not address any bugs in the SCSI error code
    (a big improvement would be just to rip it all out - this error code
    never achieves anything useful but has crashed many a machine)
    and does not fix the USB code either.
    It just adds a flag to the unusual_devices section mentioning that
    this device (my revision is 1.00) has this bug.
    
    Without the patch the kernel crashes, or insmod usb-storage hangs.
    With the patch the CF part of the device works perfectly.
    
    (Another change is to only print "Fixing INQUIRY data" when
    really something is changed, not when the data was OK already.)
    
    Andries
    2cb4a05f
unusual_devs.h 15.7 KB