Use block read and block write instead of regular read and write commands. Mounting the device read-only now works. Writing
is still not working. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38405 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -837,18 +837,23 @@ usb_disk_block_read(device_lun *lun, uint32 blockPosition, uint16 blockCount,
|
|||||||
uint8 commandBlock[12];
|
uint8 commandBlock[12];
|
||||||
memset(commandBlock, 0, sizeof(commandBlock));
|
memset(commandBlock, 0, sizeof(commandBlock));
|
||||||
|
|
||||||
commandBlock[0] = SCSI_READ_10;
|
commandBlock[0] = 0xA8;
|
||||||
commandBlock[1] = lun->logical_unit_number << 5;
|
commandBlock[1] = lun->logical_unit_number << 5;
|
||||||
commandBlock[2] = blockPosition >> 24;
|
commandBlock[2] = blockPosition >> 24;
|
||||||
commandBlock[3] = blockPosition >> 16;
|
commandBlock[3] = blockPosition >> 16;
|
||||||
commandBlock[4] = blockPosition >> 8;
|
commandBlock[4] = blockPosition >> 8;
|
||||||
commandBlock[5] = blockPosition;
|
commandBlock[5] = blockPosition;
|
||||||
commandBlock[7] = *length >> 8;
|
commandBlock[6] = blockCount >> 24;
|
||||||
commandBlock[8] = *length;
|
commandBlock[7] = blockCount >> 16;
|
||||||
// TODO: blockCount ?
|
commandBlock[8] = blockCount >> 8;
|
||||||
|
commandBlock[9] = blockCount;
|
||||||
|
|
||||||
status_t result = usb_disk_operation(lun, commandBlock, buffer, length,
|
status_t result;
|
||||||
true);
|
do {
|
||||||
|
snooze(10000);
|
||||||
|
result = usb_disk_operation(lun, commandBlock, buffer, length,
|
||||||
|
true);
|
||||||
|
} while (result != B_OK);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -860,18 +865,24 @@ usb_disk_block_write(device_lun *lun, uint32 blockPosition, uint16 blockCount,
|
|||||||
uint8 commandBlock[12];
|
uint8 commandBlock[12];
|
||||||
memset(commandBlock, 0, sizeof(commandBlock));
|
memset(commandBlock, 0, sizeof(commandBlock));
|
||||||
|
|
||||||
commandBlock[0] = SCSI_WRITE_10;
|
commandBlock[0] = 0xAA;
|
||||||
commandBlock[1] = lun->logical_unit_number << 5;
|
commandBlock[1] = lun->logical_unit_number << 5;
|
||||||
commandBlock[2] = blockPosition >> 24;
|
commandBlock[2] = blockPosition >> 24;
|
||||||
commandBlock[3] = blockPosition >> 16;
|
commandBlock[3] = blockPosition >> 16;
|
||||||
commandBlock[4] = blockPosition >> 8;
|
commandBlock[4] = blockPosition >> 8;
|
||||||
commandBlock[5] = blockPosition;
|
commandBlock[5] = blockPosition;
|
||||||
commandBlock[7] = *length >> 8;
|
commandBlock[6] = blockCount >> 24;
|
||||||
commandBlock[8] = *length;
|
commandBlock[7] = blockCount >> 16;
|
||||||
// TOOD: blockCount ?
|
commandBlock[8] = blockCount >> 8;
|
||||||
|
commandBlock[9] = blockCount;
|
||||||
|
|
||||||
|
status_t result;
|
||||||
|
do {
|
||||||
|
snooze(10000);
|
||||||
|
result = usb_disk_operation(lun, commandBlock, buffer, length,
|
||||||
|
true);
|
||||||
|
} while (result != B_OK);
|
||||||
|
|
||||||
status_t result = usb_disk_operation(lun, commandBlock, buffer, length,
|
|
||||||
false);
|
|
||||||
if (result == B_OK)
|
if (result == B_OK)
|
||||||
lun->should_sync = true;
|
lun->should_sync = true;
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
Reference in New Issue
Block a user