1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-21 17:16:44 +00:00

Takes a first shot at INQUIRY.

This commit is contained in:
Thomas Harte
2019-09-07 22:04:44 -04:00
parent 6e0e9afe2f
commit 00ce7f8ae0
5 changed files with 51 additions and 20 deletions
@@ -24,3 +24,26 @@ bool DirectAccessDevice::read(const Target::CommandState &state, Target::Respond
return true;
}
bool DirectAccessDevice::inquiry(const Target::CommandState &state, Target::Responder &responder) {
if(!device_) return false;
std::vector<uint8_t> response = {
0x00, /* Peripheral device type: directly addressible. */
0x00, /* Non-removeable (0x80 = removeable). */
0x00, /* Version: does not claim conformance to any standard. */
0x00, /* Response data format: 0 for SCSI-1? */
0x00, /* Additional length. */
};
const auto allocated_bytes = state.allocated_inquiry_bytes();
if(allocated_bytes < response.size()) {
response.resize(allocated_bytes);
}
responder.send_data(std::move(response), [] (const Target::CommandState &state, Target::Responder &responder) {
responder.terminate_command(Target::Responder::Status::Good);
});
return true;
}