While the comment was correct with regards to collecting the semaphore after
the cancel, it wasn't actually done. This could bring a device out of sync in the case timeouts actually happened (which shouldn't be a commen case). Fixed that and increased the timeout to 2 seconds in favor of slower devices. Might need some fine tuning later still. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26197 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -142,7 +142,7 @@ usb_disk_transfer_data(disk_device *device, bool directionIn, void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
result = acquire_sem_etc(device->notify, 1, B_RELATIVE_TIMEOUT, 1000000);
|
result = acquire_sem_etc(device->notify, 1, B_RELATIVE_TIMEOUT, 2000000);
|
||||||
if (result == B_TIMED_OUT) {
|
if (result == B_TIMED_OUT) {
|
||||||
// Cancel the transfer and collect the sem that should now be
|
// Cancel the transfer and collect the sem that should now be
|
||||||
// released through the callback on cancel. Handling of device
|
// released through the callback on cancel. Handling of device
|
||||||
@@ -150,7 +150,7 @@ usb_disk_transfer_data(disk_device *device, bool directionIn, void *data,
|
|||||||
// the transfer failed.
|
// the transfer failed.
|
||||||
gUSBModule->cancel_queued_transfers(directionIn ? device->bulk_in
|
gUSBModule->cancel_queued_transfers(directionIn ? device->bulk_in
|
||||||
: device->bulk_out);
|
: device->bulk_out);
|
||||||
continue;
|
acquire_sem_etc(device->notify, 1, B_RELATIVE_TIMEOUT, 0);
|
||||||
}
|
}
|
||||||
} while (result == B_INTERRUPTED);
|
} while (result == B_INTERRUPTED);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user