mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
get OUT packets working; in particular, HID/U2F seems good to go
This commit is contained in:
parent
51adf0e76c
commit
16b3c43e31
1 changed files with 19 additions and 15 deletions
|
|
@ -175,7 +175,7 @@ pub(crate) fn main_hw() -> ! {
|
||||||
let now = tt.elapsed_ms();
|
let now = tt.elapsed_ms();
|
||||||
let opcode =
|
let opcode =
|
||||||
num_traits::FromPrimitive::from_usize(msg.body.id()).unwrap_or(TimeoutOp::InvalidCall);
|
num_traits::FromPrimitive::from_usize(msg.body.id()).unwrap_or(TimeoutOp::InvalidCall);
|
||||||
log::info!("Timeout thread: {:?}", opcode);
|
log::debug!("Timeout thread: {:?}", opcode);
|
||||||
match opcode {
|
match opcode {
|
||||||
TimeoutOp::Pump => {
|
TimeoutOp::Pump => {
|
||||||
if to_run.load(Ordering::SeqCst) {
|
if to_run.load(Ordering::SeqCst) {
|
||||||
|
|
@ -254,7 +254,7 @@ pub(crate) fn main_hw() -> ! {
|
||||||
xous::reply_and_receive_next(usbdev_sid, &mut msg_opt).expect("Error fetching next message");
|
xous::reply_and_receive_next(usbdev_sid, &mut msg_opt).expect("Error fetching next message");
|
||||||
let msg = msg_opt.as_mut().unwrap();
|
let msg = msg_opt.as_mut().unwrap();
|
||||||
let opcode = num_traits::FromPrimitive::from_usize(msg.body.id()).unwrap_or(Opcode::InvalidCall);
|
let opcode = num_traits::FromPrimitive::from_usize(msg.body.id()).unwrap_or(Opcode::InvalidCall);
|
||||||
log::info!("{:?}", opcode);
|
log::debug!("{:?}", opcode);
|
||||||
match opcode {
|
match opcode {
|
||||||
Opcode::PmicIrq => match pmic.get_vbus_irq_status(&mut i2c).unwrap() {
|
Opcode::PmicIrq => match pmic.get_vbus_irq_status(&mut i2c).unwrap() {
|
||||||
VbusIrq::Insert => {
|
VbusIrq::Insert => {
|
||||||
|
|
@ -366,8 +366,8 @@ pub(crate) fn main_hw() -> ! {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Opcode::IrqFidoRx => {
|
Opcode::IrqFidoRx => {
|
||||||
let buffer = unsafe { Buffer::from_memory_message(msg.body.memory_message().unwrap()) };
|
if let Some(raw_report) = cu.hid_packet.take() {
|
||||||
let u2f_report = buffer.to_original::<HIDReport, _>().unwrap();
|
let u2f_report = HIDReport(raw_report);
|
||||||
if let Some(mut listener) = fido_listener.take() {
|
if let Some(mut listener) = fido_listener.take() {
|
||||||
let mut response = unsafe {
|
let mut response = unsafe {
|
||||||
Buffer::from_memory_message_mut(listener.body.memory_message_mut().unwrap())
|
Buffer::from_memory_message_mut(listener.body.memory_message_mut().unwrap())
|
||||||
|
|
@ -382,6 +382,10 @@ pub(crate) fn main_hw() -> ! {
|
||||||
crate::println!("Got U2F packet, but no server to respond...queuing.");
|
crate::println!("Got U2F packet, but no server to respond...queuing.");
|
||||||
fido_rx_queue.push_back(u2f_report.0);
|
fido_rx_queue.push_back(u2f_report.0);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// I *think* this is harmless, can remove this later on if protocol is robust
|
||||||
|
log::warn!("got IrqFidoRx but no data");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Opcode::U2fTx => {
|
Opcode::U2fTx => {
|
||||||
if fido_listener_pid.is_none() {
|
if fido_listener_pid.is_none() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue