add missing feature flags to usb device crate

This commit is contained in:
bunnie 2023-01-31 03:19:17 +08:00
parent b7c4587505
commit 215f15f138
3 changed files with 16 additions and 9 deletions

View file

@ -33,8 +33,11 @@ pub(crate) enum Opcode {
/// Query if the HID driver was able to start /// Query if the HID driver was able to start
IsSocCompatible, IsSocCompatible,
#[cfg(feature="mass-storage")]
SetBlockDevice, SetBlockDevice,
#[cfg(feature="mass-storage")]
SetBlockDeviceSID, SetBlockDeviceSID,
#[cfg(feature="mass-storage")]
ResetBlockDevice, ResetBlockDevice,
/// Handle the USB interrupt /// Handle the USB interrupt

View file

@ -24,7 +24,7 @@ impl UsbHid {
conn conn
} }
} }
#[cfg(feature="mass-storage")]
pub fn set_block_device(&self, read_id: usize, write_id: usize, max_lba_id: usize) { pub fn set_block_device(&self, read_id: usize, write_id: usize, max_lba_id: usize) {
send_message(self.conn, send_message(self.conn,
Message::new_blocking_scalar( Message::new_blocking_scalar(
@ -36,7 +36,7 @@ impl UsbHid {
) )
).unwrap(); ).unwrap();
} }
#[cfg(feature="mass-storage")]
pub fn set_block_device_sid(&self, app_sid: xous::SID) { pub fn set_block_device_sid(&self, app_sid: xous::SID) {
let sid = app_sid.to_u32(); let sid = app_sid.to_u32();
send_message(self.conn, send_message(self.conn,
@ -49,7 +49,7 @@ impl UsbHid {
) )
).unwrap(); ).unwrap();
} }
#[cfg(feature="mass-storage")]
pub fn reset_block_device(&self) { pub fn reset_block_device(&self) {
send_message(self.conn, send_message(self.conn,
Message::new_blocking_scalar( Message::new_blocking_scalar(

View file

@ -226,8 +226,9 @@ pub(crate) fn main_hw() -> ! {
let ums_alloc = UsbBusAllocator::new(ums_dev); let ums_alloc = UsbBusAllocator::new(ums_dev);
#[cfg(feature="mass-storage")] #[cfg(feature="mass-storage")]
let abd = apps_block_device::AppsBlockDevice::new(); let abd = apps_block_device::AppsBlockDevice::new();
#[cfg(feature="mass-storage")]
let abdcid = abd.conn(); let abdcid = abd.conn();
#[cfg(feature="mass-storage")]
let mut ums = usbd_scsi::Scsi::new( let mut ums = usbd_scsi::Scsi::new(
&ums_alloc, &ums_alloc,
64, 64,
@ -352,6 +353,7 @@ pub(crate) fn main_hw() -> ! {
let opcode: Option<Opcode> = FromPrimitive::from_usize(msg.body.id()); let opcode: Option<Opcode> = FromPrimitive::from_usize(msg.body.id());
log::debug!("{:?}", opcode); log::debug!("{:?}", opcode);
match opcode { match opcode {
#[cfg(feature="mass-storage")]
Some(Opcode::SetBlockDevice) => msg_blocking_scalar_unpack!(msg, read_id, write_id, max_lba_id, _, { Some(Opcode::SetBlockDevice) => msg_blocking_scalar_unpack!(msg, read_id, write_id, max_lba_id, _, {
xous::send_message( xous::send_message(
abdcid, abdcid,
@ -361,6 +363,7 @@ pub(crate) fn main_hw() -> ! {
).unwrap(); ).unwrap();
xous::return_scalar(msg.sender, 0).unwrap(); xous::return_scalar(msg.sender, 0).unwrap();
}), }),
#[cfg(feature="mass-storage")]
Some(Opcode::SetBlockDeviceSID) => msg_blocking_scalar_unpack!(msg, sid1, sid2, sid3, sid4, { Some(Opcode::SetBlockDeviceSID) => msg_blocking_scalar_unpack!(msg, sid1, sid2, sid3, sid4, {
xous::send_message(abdcid, xous::send_message(abdcid,
xous::Message::new_blocking_scalar( xous::Message::new_blocking_scalar(
@ -369,6 +372,7 @@ pub(crate) fn main_hw() -> ! {
).unwrap(); ).unwrap();
xous::return_scalar(msg.sender, 0).unwrap(); xous::return_scalar(msg.sender, 0).unwrap();
}), }),
#[cfg(feature="mass-storage")]
Some(Opcode::ResetBlockDevice) => msg_blocking_scalar_unpack!(msg, 0, 0, 0, 0, { Some(Opcode::ResetBlockDevice) => msg_blocking_scalar_unpack!(msg, 0, 0, 0, 0, {
xous::send_message(abdcid, xous::send_message(abdcid,
xous::Message::new_blocking_scalar( xous::Message::new_blocking_scalar(