tiny bit of cleanup & docs

This commit is contained in:
bunnie 2023-01-11 04:09:13 +08:00
parent 1f3c16aea8
commit 55b940fe74
3 changed files with 10 additions and 10 deletions

View file

@ -342,9 +342,7 @@ pub(crate) fn main_hw() -> ! {
if matches!(view, Views::MassStorage) {
if ums_device.poll(&mut [&mut ums]) {
log::debug!("ums device had something to do!")
//Some(fido_class.interface::<RawFidoInterface<'_, _>, _>())
}
continue;
}

View file

@ -12,10 +12,10 @@ pub struct ReadFormatCapacitiesCommand {
#[pkd(7, 5, 1, 1)]
pub logical_unit_number: u8,
#[pkd(7, 0, 7, 8)]
pub allocation_length: u16,
#[pkd(7, 0, 9, 9)]
pub control: Control,
}

View file

@ -407,15 +407,16 @@ impl<B: UsbBus, BD: BlockDevice> Scsi<'_, B, BD> {
self.request_sense_response.additional_sense_code = additional_sense_code;
}
/// Update is called by the IRQ handler, whenever a new event is available on one of
/// the endpoints allocated to the USB mass storage device.
fn update(&mut self) -> Result<(), Error> {
// Send anything that's already queued
//accept_would_block(
// self.inner.write()
// .map_err(|e| e.into())
//)?;
let mut i = 0;
// This loop will automatically re-poll for read data after a single update
// originating from an incoming IRQ. This is necessary because when a new packet
// comes in while processing the current packet, a second IRQ is not fired.
//
// The loop exits if it polls twice and finds no new packets pending.
loop {
// print!("p{}", i);
// Read new data if available
match accept_would_block(
self.inner.read()
@ -435,6 +436,7 @@ impl<B: UsbBus, BD: BlockDevice> Scsi<'_, B, BD> {
self.inner.write()
.map_err(|e| e.into())
)?;
// exit the loop if we blocked more than twice
if i > 1 {
break;
}