* scsi_read_write_6() was incorrectly translating 6-byte requests with a length

of 0 (as this means 256 blocks).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26839 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-08-06 08:54:49 +00:00
parent f8a59924e5
commit 6568215497
@@ -1,12 +1,11 @@
/* /*
* Copyright 2004-2007, Axel Dörfler, [email protected]. All rights reserved. * Copyright 2004-2008, Axel Dörfler, [email protected].
* Copyright 2002/03, Thomas Kurschel. All rights reserved. * Copyright 2002/03, Thomas Kurschel. All rights reserved.
* *
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
/* /*! Emulation of SCSI commands that a device cannot handle.
Emulation of SCSI commands that a device cannot handle.
Some SCSI devices don't support all SCSI commands, especially Some SCSI devices don't support all SCSI commands, especially
those connected via ATAPI, USB or FireWire. These commands are those connected via ATAPI, USB or FireWire. These commands are
@@ -102,8 +101,7 @@ scsi_init_emulation_buffer(scsi_device_info *device, size_t buffer_size)
} }
/*! /*! Some ATAPI devices don't like 6 byte read/write commands, so
Some ATAPI devices don't like 6 byte read/write commands, so
we translate them to their 10 byte counterparts; we translate them to their 10 byte counterparts;
USB devices usually don't like 10 bytes either USB devices usually don't like 10 bytes either
*/ */
@@ -122,7 +120,10 @@ scsi_read_write_6(scsi_ccb *request)
cdb->lun = cmd->lun; cdb->lun = cmd->lun;
cdb->lba = B_HOST_TO_BENDIAN_INT32((uint32)cmd->low_lba cdb->lba = B_HOST_TO_BENDIAN_INT32((uint32)cmd->low_lba
| ((uint32)cmd->mid_lba << 8) | ((uint32)cmd->high_lba << 16)); | ((uint32)cmd->mid_lba << 8) | ((uint32)cmd->high_lba << 16));
cdb->length = B_HOST_TO_BENDIAN_INT16((uint16)cmd->length); if (cmd->length == 0)
cdb->length = B_HOST_TO_BENDIAN_INT16(256);
else
cdb->length = B_HOST_TO_BENDIAN_INT16((uint16)cmd->length);
cdb->control = cmd->control; cdb->control = cmd->control;
return true; return true;