diff options
| author | Alexander von Gluck IV <kallisti5@unixzen.com> | 2011-06-08 18:45:22 +0000 |
|---|---|---|
| committer | Alexander von Gluck IV <kallisti5@unixzen.com> | 2011-06-08 18:45:22 +0000 |
| commit | ea9b910a269e39fb24e9bdec7f9e1cd4436ebddd (patch) | |
| tree | 5f1395890b3f21148a6351104780eae394b9d8fd | |
| parent | 5cb190eda296ba1f5b0ca1d3933eadb27f77f0af (diff) | |
* change overly large uint32 to uint8 as we only count to 12 maxhrev42058
* add additional tracing to usb_disk lun inquiry
* cd and other optical disk devices can take some time to spin up
when plugged. Now we give them some time to do so to ensure we
can detect the media type properly if there is a cd in the drive.
Things non-mechanical (flash drives) will continue almost immediately
as there is no spin up time. The more attempts, the longer the wait.
We now try 7 times (28 seconds total), my modern usb cdrom takes
about 6 (21 seconds) of those cycles to be ready on power up and 4
(10 seconds) on media change while powered up.
* tested with usb media and cd media. Doesn't introduce any visible
delay to the user.
* the write protected status in lun is now correct for my usb cd device
on plug (it wasn't previously)
* still seeing it though as read/write. Looking at this now.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42058 a95241bf-73f2-0310-859d-f6bbb57e9c96
| -rw-r--r-- | src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
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 2a7cb7447b..316805272d 100644 --- 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 @@ -769,7 +769,8 @@ usb_disk_device_added(usb_device newDevice, void **cookie) // initialize this lun result = usb_disk_inquiry(lun); - for (uint32 tries = 0; tries < 3; tries++) { + for (uint8 tries = 0; tries < 8; tries++) { + TRACE("usb lun %d inquiry attempt %d begin\n", i, tries); status_t ready = usb_disk_test_unit_ready(lun); if (ready == B_OK || ready == B_DEV_NO_MEDIA) { if (ready == B_OK) { @@ -779,12 +780,19 @@ usb_disk_device_added(usb_device newDevice, void **cookie) // some devices lock up when getting the mode sense else if (/*usb_disk_mode_sense(lun) != B_OK*/true) lun->write_protected = false; - } - break; + TRACE("usb lun %d ready. write protected = %c\n", i, + lun->write_protected ? 'y' : 'n'); + + break; + } + TRACE("usb lun %d not ready, attempt %d\n", i, tries); } + TRACE("usb lun %d inquiry attempt %d failed\n", i, tries); - snooze(10000); + uint32_t snoozeTime = 1000000 * tries; + TRACE("snoozing %u microseconds for usb lun\n", snoozeTime); + snooze(snoozeTime); } if (result != B_OK) |
