adjust autotest flow for UDP-based button pressing

This commit is contained in:
bunnie 2022-06-08 20:15:32 +08:00
parent 01fbc1e8b7
commit 52211f078e
3 changed files with 11 additions and 5 deletions

View file

@ -952,6 +952,7 @@ where
_ => return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED),
}
//(self.check_user_presence)(cid)?;
#[cfg(not(feature="autotest"))]
if crate::ux::request_permission_blocking(t!("vault.u2f.reset_check", xous::LANG).to_string(), cid).is_none() {
return Err(Ctap2StatusCode::CTAP2_ERR_NOT_ALLOWED)
}

View file

@ -16,6 +16,11 @@ use ctap::CtapState;
mod shims;
use shims::*;
// CTAP2 testing notes:
// run our branch and use this to forward the prompts on to the device:
// netcat -k -u -l 6502 > /dev/ttyS0
// use the "autotest" feature to remove some excess prompts that interfere with the test
/*
UI concept:

View file

@ -130,8 +130,8 @@ pub(crate) fn start_ux_thread() {
let mut app_info: Option<AppInfo> = None;
let pddb = pddb::Pddb::new();
pddb.is_mounted_blocking();
#[cfg(feature="autotest")]
modals.show_notification("WARNING: FIDO configured for autotest. Do not use for production!", None).unwrap();
//#[cfg(feature="autotest")]
//modals.show_notification("WARNING: FIDO configured for autotest. Do not use for production!", None).unwrap();
let mut num_fido_auths = 0; // only counts FIDO2 flow auths, not U2F auths
loop {
let mut msg = xous::receive_message(sid).unwrap();
@ -404,14 +404,14 @@ pub(crate) fn start_ux_thread() {
}
}
// check if we got a hit
#[cfg(not(feature="autotest"))]
//#[cfg(not(feature="autotest"))]
let key_hit = kbhit.load(Ordering::SeqCst);
#[cfg(feature="autotest")]
/*#[cfg(feature="autotest")]
let key_hit = if num_fido_auths != 82 { // 82 is the test number of "don't touch it"
'y' as u32
} else {
0
};
};*/
if key_hit != 0 {
num_fido_auths += 1;
log::info!("got user presence! count: {}", num_fido_auths);