mirror of https://github.com/akuker/RASCSI.git
Implement ModeSelect for scsicd
and honor sector size setting. DEC's VMS can't handle 2k sector sizes and uses ModeSelect6 to set the sector size to 512 bytes. Fixes #1397 Signed-off-by: Klaus Kämpf <kkaempf@gmail.com>
This commit is contained in:
parent
1fc2c09130
commit
e0cb5d4d0d
|
@ -165,6 +165,25 @@ vector<uint8_t> SCSICD::InquiryInternal() const
|
|||
return HandleInquiry(device_type::cd_rom, scsi_level, true);
|
||||
}
|
||||
|
||||
void SCSICD::ModeSelect(scsi_command cmd, cdb_t cdb, span<const uint8_t> buf, int length)
|
||||
{
|
||||
int sector_size = 1 << GetSectorSizeShiftCount();
|
||||
int wanted_sector_size;
|
||||
// skip Block Descriptor
|
||||
int offset = 4;
|
||||
// evaluate Mode Parameter Block Descriptor, sector size
|
||||
wanted_sector_size = scsi_command_util::GetInt16(buf, offset + 6);
|
||||
if (wanted_sector_size != sector_size) {
|
||||
LogDebug("Changing sector size from " + to_string(sector_size) + " to " + to_string(wanted_sector_size));
|
||||
SetSectorSizeInBytes(wanted_sector_size);
|
||||
}
|
||||
|
||||
if (const string result = scsi_command_util::ModeSelect(cmd, cdb, buf, length, sector_size);
|
||||
!result.empty()) {
|
||||
LogWarn(result);
|
||||
}
|
||||
}
|
||||
|
||||
void SCSICD::SetUpModePages(map<int, vector<byte>>& pages, int page, bool changeable) const
|
||||
{
|
||||
Disk::SetUpModePages(pages, page, changeable);
|
||||
|
|
|
@ -34,6 +34,7 @@ public:
|
|||
|
||||
vector<uint8_t> InquiryInternal() const override;
|
||||
int Read(span<uint8_t>, uint64_t) override;
|
||||
void ModeSelect(scsi_defs::scsi_command, cdb_t, span<const uint8_t>, int) override;
|
||||
|
||||
protected:
|
||||
|
||||
|
|
Loading…
Reference in New Issue