mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
add ReadFormatCapacities
this is required by Windows for the driver to work.
This commit is contained in:
parent
93e3bc29b3
commit
1f3c16aea8
2 changed files with 32 additions and 2 deletions
|
|
@ -16,7 +16,24 @@ pub struct ReadFormatCapacitiesCommand {
|
|||
#[pkd(7, 0, 7, 8)]
|
||||
pub allocation_length: u16,
|
||||
|
||||
#[pkd(7, 0, 11, 11)]
|
||||
#[pkd(7, 0, 9, 9)]
|
||||
pub control: Control,
|
||||
}
|
||||
impl ParsePackedStruct for ReadFormatCapacitiesCommand {}
|
||||
impl ParsePackedStruct for ReadFormatCapacitiesCommand {}
|
||||
|
||||
#[derive(Clone, Copy, Eq, PartialEq, Debug, Packed)]
|
||||
#[packed(big_endian, lsb0)]
|
||||
pub struct ReadFormatCapacitiesResponse {
|
||||
#[pkd(7, 0, 3, 3)]
|
||||
pub capacity_list_length: u8,
|
||||
|
||||
#[pkd(7, 0, 4, 7)]
|
||||
pub number_of_blocks: u32,
|
||||
|
||||
#[pkd(1, 0, 8, 8)]
|
||||
pub descriptor_code: u8,
|
||||
|
||||
#[pkd(7, 0, 9, 11)]
|
||||
pub block_length: u32,
|
||||
}
|
||||
impl ParsePackedStruct for ReadFormatCapacitiesResponse {}
|
||||
|
|
@ -251,6 +251,19 @@ impl<B: UsbBus, BD: BlockDevice> Scsi<'_, B, BD> {
|
|||
}
|
||||
},
|
||||
|
||||
Command::ReadFormatCapacities(_rfc) => {
|
||||
log::info!("got rfc");
|
||||
let rfc_resp = ReadFormatCapacitiesResponse {
|
||||
capacity_list_length: 1 * 8, // 1 entry by 8 bytes
|
||||
number_of_blocks: self.block_device.max_lba(),
|
||||
descriptor_code: 1, // 1 - unformatted media; 2 - formatted media; 3 - no cartridge in drive
|
||||
block_length: BD::BLOCK_BYTES as u32,
|
||||
};
|
||||
let mut buf = self.inner.take_buffer_space(ReadFormatCapacitiesResponse::BYTES)?;
|
||||
rfc_resp.pack(&mut buf)?;
|
||||
Done
|
||||
},
|
||||
|
||||
_ => Err(Error::UnhandledOpCode)?,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue