mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-08 04:56:43 +00:00
prove that we've restored ditherpunk functionality to hosted mode
this basically brings us back to the point of the original PR, but with the code being optional.
This commit is contained in:
parent
a8e7809087
commit
05f705a931
4 changed files with 24 additions and 6 deletions
|
|
@ -136,8 +136,8 @@ pub fn spawn_test() {
|
|||
.expect("qrcode failed");
|
||||
log::info!("qrcode test done");
|
||||
|
||||
// 5. test image
|
||||
#[cfg(feature="ditherpunk")]
|
||||
// 5. test image - because it reads a local file, only makes sense on hosted mode
|
||||
#[cfg(all(feature="ditherpunk", not(any(target_os = "none", target_os = "xous"))))]
|
||||
{
|
||||
log::info!("testing image");
|
||||
let reader = match Reader::open("../services/modals/src/tests/bunny.png") {
|
||||
|
|
|
|||
|
|
@ -608,7 +608,7 @@ impl<'a> ShellCmdApi<'a> for Test {
|
|||
write!(ret, "Ship mode request denied").unwrap();
|
||||
}
|
||||
}
|
||||
#[cfg(feature="ditherpunk")]
|
||||
#[cfg(all(feature="ditherpunk", not(any(target_os = "none", target_os = "xous"))))]
|
||||
"modals" => {
|
||||
modals::tests::spawn_test();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,9 +25,7 @@ use hosted::*;
|
|||
use num_traits::*;
|
||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||
use usb_device_xous::KeyboardLedsReport;
|
||||
use usbd_human_interface_device::device::fido::{FidoInterface, FidoMsg};
|
||||
use xous::{msg_scalar_unpack, msg_blocking_scalar_unpack};
|
||||
use core::ops::{DerefMut, Deref};
|
||||
use core::num::NonZeroU8;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
|
|
@ -43,6 +41,10 @@ use usbd_human_interface_device::device::keyboard::NKROBootKeyboardInterface;
|
|||
use usbd_human_interface_device::prelude::*;
|
||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||
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 std::convert::TryInto;
|
||||
|
|
@ -102,12 +104,20 @@ fn xmain() -> ! {
|
|||
None
|
||||
).unwrap();
|
||||
}
|
||||
let mut fido_blocker: Option<xous::MessageEnvelope> = None;
|
||||
loop {
|
||||
let msg = xous::receive_message(usbdev_sid).unwrap();
|
||||
match FromPrimitive::from_usize(msg.body.id()) {
|
||||
Some(Opcode::DebugUsbOp) => msg_blocking_scalar_unpack!(msg, _update_req, _new_state, _, _, {
|
||||
xous::return_scalar2(msg.sender, 0, 1).expect("couldn't return status");
|
||||
}),
|
||||
Some(Opcode::U2fRxDeferred) => {
|
||||
// this will prevent the FIDO stack from ever moving forward
|
||||
fido_blocker = Some(msg);
|
||||
}
|
||||
Some(Opcode::Quit) => {
|
||||
break;
|
||||
}
|
||||
_ => {
|
||||
log::warn!("SoC not compatible with HID, ignoring USB message: {:?}", msg);
|
||||
// make it so blocking scalars don't block
|
||||
|
|
@ -124,6 +134,7 @@ fn xmain() -> ! {
|
|||
}
|
||||
}
|
||||
}
|
||||
log::info!("Statement to consume the blocked message, preventing it from being dropped: {:?}", fido_blocker);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -202,6 +213,7 @@ fn xmain() -> ! {
|
|||
}
|
||||
let mut buffer = unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().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() {
|
||||
let mut u2f_msg = FidoMsg::default();
|
||||
assert_eq!(u2f_ipc.code, U2fCode::Tx, "Expected U2fCode::Tx in wrapper");
|
||||
|
|
@ -212,6 +224,8 @@ fn xmain() -> ! {
|
|||
} else {
|
||||
u2f_ipc.code = U2fCode::Denied;
|
||||
}
|
||||
#[cfg(not(any(target_os = "none", target_os = "xous")))]
|
||||
{u2f_ipc.code = U2fCode::Denied;}
|
||||
buffer.replace(u2f_ipc).unwrap();
|
||||
}
|
||||
Some(Opcode::UsbIrqHandler) => {
|
||||
|
|
|
|||
|
|
@ -412,7 +412,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
}
|
||||
generate_app_menus(&apps);
|
||||
// for hosted runs, compile in the pddb test routines by default...for now.
|
||||
run(false, &pkgs, Some(&["--features", "pddbtest"]), false)?
|
||||
run(false, &pkgs,
|
||||
Some(&[
|
||||
"--features", "pddbtest",
|
||||
"--features", "ditherpunk",
|
||||
]), false)?
|
||||
}
|
||||
Some("hosted-ci") => {
|
||||
let mut pkgs = hw_pkgs.to_vec();
|
||||
|
|
|
|||
Loading…
Reference in a new issue