scsicdrom: Check Lun for INQUIRY.

INQUIRY now returns 0x7f for device type if LUN doesn't match. INQUIRY can get LUN from CDB or from IDENTIFY message.
This commit is contained in:
joevt 2024-03-10 04:10:32 -07:00 committed by dingusdev
parent 2d1616894d
commit bfd3077bd0
1 changed files with 11 additions and 1 deletions

View File

@ -210,7 +210,17 @@ void ScsiCdrom::inquiry() {
LOG_F(ERROR, "%s: more than 36 bytes requested in INQUIRY", this->name.c_str());
}
this->data_buf[0] = 5; // device type: CD-ROM
int lun;
if (this->last_selection_has_atention) {
LOG_F(INFO, "%s: INQUIRY (%d bytes) with ATN LUN = %02x & 7", this->name.c_str(), alloc_len, this->last_selection_message);
lun = this->last_selection_message & 7;
}
else {
LOG_F(INFO, "%s: INQUIRY (%d bytes) with NO ATN LUN = %02x >> 5", this->name.c_str(), alloc_len, cmd_buf[1]);
lun = cmd_buf[1] >> 5;
}
this->data_buf[0] = (lun == this->lun) ? 5 : 0x7f; // device type: CD-ROM
this->data_buf[1] = 0x80; // removable media
this->data_buf[2] = 2; // ANSI version: SCSI-2
this->data_buf[3] = 1; // response data format