mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
fix regression in usb-device
This commit is contained in:
parent
c687f7dc02
commit
0cdd9d9920
1 changed files with 0 additions and 30 deletions
|
|
@ -25,12 +25,9 @@ use hosted::*;
|
||||||
use num_traits::*;
|
use num_traits::*;
|
||||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||||
use usb_device_xous::KeyboardLedsReport;
|
use usb_device_xous::KeyboardLedsReport;
|
||||||
<<<<<<< HEAD
|
|
||||||
use usbd_human_interface_device::device::fido::RawFidoMsg;
|
use usbd_human_interface_device::device::fido::RawFidoMsg;
|
||||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||||
use usbd_human_interface_device::device::fido::RawFidoInterface;
|
use usbd_human_interface_device::device::fido::RawFidoInterface;
|
||||||
=======
|
|
||||||
>>>>>>> origin/dither2
|
|
||||||
use xous::{msg_scalar_unpack, msg_blocking_scalar_unpack};
|
use xous::{msg_scalar_unpack, msg_blocking_scalar_unpack};
|
||||||
use core::num::NonZeroU8;
|
use core::num::NonZeroU8;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
|
|
@ -47,10 +44,6 @@ use usbd_human_interface_device::device::keyboard::NKROBootKeyboardInterface;
|
||||||
use usbd_human_interface_device::prelude::*;
|
use usbd_human_interface_device::prelude::*;
|
||||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||||
use num_enum::FromPrimitive as EnumFromPrimitive;
|
use num_enum::FromPrimitive as EnumFromPrimitive;
|
||||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
|
||||||
use core::ops::{DerefMut, Deref};
|
|
||||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
|
||||||
use usbd_human_interface_device::device::fido::{FidoInterface, FidoMsg};
|
|
||||||
|
|
||||||
use embedded_time::Clock;
|
use embedded_time::Clock;
|
||||||
use std::convert::TryInto;
|
use std::convert::TryInto;
|
||||||
|
|
@ -108,11 +101,7 @@ fn main() -> ! {
|
||||||
None
|
None
|
||||||
).unwrap();
|
).unwrap();
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
let mut fido_listener: Option<xous::MessageEnvelope> = None;
|
let mut fido_listener: Option<xous::MessageEnvelope> = None;
|
||||||
=======
|
|
||||||
let mut fido_blocker: Option<xous::MessageEnvelope> = None;
|
|
||||||
>>>>>>> origin/dither2
|
|
||||||
loop {
|
loop {
|
||||||
let msg = xous::receive_message(usbdev_sid).unwrap();
|
let msg = xous::receive_message(usbdev_sid).unwrap();
|
||||||
match FromPrimitive::from_usize(msg.body.id()) {
|
match FromPrimitive::from_usize(msg.body.id()) {
|
||||||
|
|
@ -120,13 +109,8 @@ fn main() -> ! {
|
||||||
xous::return_scalar2(msg.sender, 0, 1).expect("couldn't return status");
|
xous::return_scalar2(msg.sender, 0, 1).expect("couldn't return status");
|
||||||
}),
|
}),
|
||||||
Some(Opcode::U2fRxDeferred) => {
|
Some(Opcode::U2fRxDeferred) => {
|
||||||
<<<<<<< HEAD
|
|
||||||
// block any rx requests forever
|
// block any rx requests forever
|
||||||
fido_listener = Some(msg);
|
fido_listener = Some(msg);
|
||||||
=======
|
|
||||||
// this will prevent the FIDO stack from ever moving forward
|
|
||||||
fido_blocker = Some(msg);
|
|
||||||
>>>>>>> origin/dither2
|
|
||||||
}
|
}
|
||||||
Some(Opcode::Quit) => {
|
Some(Opcode::Quit) => {
|
||||||
break;
|
break;
|
||||||
|
|
@ -147,11 +131,7 @@ fn main() -> ! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<<<<<<< HEAD
|
|
||||||
log::info!("consuming listener: {:?}", fido_listener);
|
log::info!("consuming listener: {:?}", fido_listener);
|
||||||
=======
|
|
||||||
log::info!("Statement to consume the blocked message, preventing it from being dropped: {:?}", fido_blocker);
|
|
||||||
>>>>>>> origin/dither2
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -193,18 +173,11 @@ fn main() -> ! {
|
||||||
.product("Precursor")
|
.product("Precursor")
|
||||||
.serial_number(&serial_number)
|
.serial_number(&serial_number)
|
||||||
.build();
|
.build();
|
||||||
<<<<<<< HEAD
|
|
||||||
#[cfg(all(any(target_os = "none", target_os = "xous"), feature="emukbd"))]
|
#[cfg(all(any(target_os = "none", target_os = "xous"), feature="emukbd"))]
|
||||||
{
|
{
|
||||||
let keyboard = composite.interface::<NKROBootKeyboardInterface<'_, _, _,>, _>();
|
let keyboard = composite.interface::<NKROBootKeyboardInterface<'_, _, _,>, _>();
|
||||||
keyboard.write_report(&Vec::<Keyboard>::new()).ok();
|
keyboard.write_report(&Vec::<Keyboard>::new()).ok();
|
||||||
keyboard.tick().unwrap();
|
keyboard.tick().unwrap();
|
||||||
=======
|
|
||||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
|
||||||
{
|
|
||||||
keyboard.interface().write_report(&Vec::<Keyboard>::new()).ok();
|
|
||||||
keyboard.interface().tick().unwrap();
|
|
||||||
>>>>>>> origin/dither2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||||
|
|
@ -266,7 +239,6 @@ fn main() -> ! {
|
||||||
}
|
}
|
||||||
let mut buffer = unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) };
|
let mut buffer = unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) };
|
||||||
let mut u2f_ipc = buffer.to_original::<U2fMsgIpc, _>().unwrap();
|
let mut u2f_ipc = buffer.to_original::<U2fMsgIpc, _>().unwrap();
|
||||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
|
||||||
if fido_listener_pid == msg.sender.pid() {
|
if fido_listener_pid == msg.sender.pid() {
|
||||||
let mut u2f_msg = RawFidoMsg::default();
|
let mut u2f_msg = RawFidoMsg::default();
|
||||||
assert_eq!(u2f_ipc.code, U2fCode::Tx, "Expected U2fCode::Tx in wrapper");
|
assert_eq!(u2f_ipc.code, U2fCode::Tx, "Expected U2fCode::Tx in wrapper");
|
||||||
|
|
@ -280,8 +252,6 @@ fn main() -> ! {
|
||||||
} else {
|
} else {
|
||||||
u2f_ipc.code = U2fCode::Denied;
|
u2f_ipc.code = U2fCode::Denied;
|
||||||
}
|
}
|
||||||
#[cfg(not(any(target_os = "none", target_os = "xous")))]
|
|
||||||
{u2f_ipc.code = U2fCode::Denied;}
|
|
||||||
buffer.replace(u2f_ipc).unwrap();
|
buffer.replace(u2f_ipc).unwrap();
|
||||||
}
|
}
|
||||||
Some(Opcode::UsbIrqHandler) => {
|
Some(Opcode::UsbIrqHandler) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue