mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-06-25 23:29:33 +00:00
scsihd: Allow INQUIRY allocation length != 36.
Truncate for < 36 and zero fill for > 36.
This commit is contained in:
parent
92dea0e404
commit
2968645f2e
|
@ -265,27 +265,35 @@ void ScsiHardDisk::inquiry() {
|
||||||
ABORT_F("%s: invalid page number in INQUIRY", this->name.c_str());
|
ABORT_F("%s: invalid page number in INQUIRY", this->name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (alloc_len >= 36) {
|
if (alloc_len > 36) {
|
||||||
|
LOG_F(INFO, "%s: %d bytes requested in INQUIRY", this->name.c_str(), alloc_len);
|
||||||
|
}
|
||||||
|
|
||||||
this->data_buf[0] = 0; // device type: Direct-access block device
|
this->data_buf[0] = 0; // device type: Direct-access block device
|
||||||
this->data_buf[1] = 0; // non-removable media
|
this->data_buf[1] = 0; // non-removable media; 0x80 = removable media
|
||||||
this->data_buf[2] = 2; // ANSI version: SCSI-2
|
this->data_buf[2] = 2; // ANSI version: SCSI-2
|
||||||
this->data_buf[3] = 1; // response data format
|
this->data_buf[3] = 1; // response data format
|
||||||
this->data_buf[4] = 0; // additional length
|
this->data_buf[4] = 0x1F; // additional length
|
||||||
this->data_buf[5] = 0;
|
this->data_buf[5] = 0;
|
||||||
this->data_buf[6] = 0;
|
this->data_buf[6] = 0;
|
||||||
this->data_buf[7] = 0x18; // supports synchronous xfers and linked commands
|
this->data_buf[7] = 0x18; // supports synchronous xfers and linked commands
|
||||||
std::memcpy(data_buf + 8, vendor_info, 8);
|
std::memcpy(&this->data_buf[8], vendor_info, 8);
|
||||||
std::memcpy(data_buf + 16, prod_info, 16);
|
std::memcpy(&this->data_buf[16], prod_info, 16);
|
||||||
std::memcpy(data_buf + 32, rev_info, 4);
|
std::memcpy(&this->data_buf[32], rev_info, 4);
|
||||||
|
//std::memcpy(&this->data_buf[36], serial_number, 8);
|
||||||
|
//etc.
|
||||||
|
|
||||||
this->bytes_out = 36;
|
if (alloc_len < 36) {
|
||||||
|
LOG_F(ERROR, "%s: allocation length too small: %d", this->name.c_str(),
|
||||||
this->switch_phase(ScsiPhase::DATA_IN);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LOG_F(WARNING, "%s: allocation length too small: %d", this->name.c_str(),
|
|
||||||
alloc_len);
|
alloc_len);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
bzero(&this->data_buf[36], alloc_len - 36);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->bytes_out = alloc_len;
|
||||||
|
|
||||||
|
this->switch_phase(ScsiPhase::DATA_IN);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScsiHardDisk::send_diagnostic() {
|
int ScsiHardDisk::send_diagnostic() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user