Ticket #9589: usb_disk_retry_2.patch

File usb_disk_retry_2.patch, 910 bytes (added by markh, 11 years ago)

This patch should work for both the WD Elements drive and the SD card reader

  • src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp

    diff --git a/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp b/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp
    index 87383f0..f77a59e 100644
    a b usb_disk_request_sense(device_lun *lun)  
    485485            TRACE("request_sense: device not ready (asc 0x%02x ascq 0x%02x)\n",
    486486                parameter.additional_sense_code,
    487487                parameter.additional_sense_code_qualifier);
    488             lun->media_present = false;
    489             usb_disk_reset_capacity(lun);
    490             return B_DEV_NOT_READY;
     488            if (parameter.additional_sense_code == SCSI_ASC_MEDIUM_NOT_PRESENT) {
     489                lun->media_present = false;
     490                usb_disk_reset_capacity(lun);
     491                return B_DEV_NO_MEDIA;
     492            }
     493            else
     494                return B_DEV_NOT_READY;
    491495
    492496        case SCSI_SENSE_KEY_DATA_PROTECT:
    493497            TRACE_ALWAYS("request_sense: write protected\n");