mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-19 09:00:54 +00:00
register a listener for U2F events plugged into autobacklight
this should cause the backlight to turn on anytime there is an incoming U2F packet, allowing a user to read the screen and see what they are trying to allow for authentication even in a dark room.
This commit is contained in:
parent
b2208850b2
commit
f162555ac3
1 changed files with 7 additions and 2 deletions
|
|
@ -223,8 +223,10 @@ fn wrapped_main() -> ! {
|
||||||
// ------------------ lay out our public API infrastructure
|
// ------------------ lay out our public API infrastructure
|
||||||
// ok, now that we have a GID, we can continue on with our merry way
|
// ok, now that we have a GID, we can continue on with our merry way
|
||||||
let status_gid: Gid = Gid::new(canvas_gid);
|
let status_gid: Gid = Gid::new(canvas_gid);
|
||||||
// allow only one connection, from keyboard to us.
|
// Expected connections:
|
||||||
let status_sid = xns.register_name(SERVER_NAME_STATUS, Some(1)).unwrap();
|
// - from keyboard
|
||||||
|
// - from USB HID
|
||||||
|
let status_sid = xns.register_name(SERVER_NAME_STATUS, Some(2)).unwrap();
|
||||||
// create a connection for callback hooks
|
// create a connection for callback hooks
|
||||||
let cb_cid = xous::connect(status_sid).unwrap();
|
let cb_cid = xous::connect(status_sid).unwrap();
|
||||||
unsafe { CB_TO_MAIN_CONN = Some(cb_cid) };
|
unsafe { CB_TO_MAIN_CONN = Some(cb_cid) };
|
||||||
|
|
@ -395,6 +397,9 @@ fn wrapped_main() -> ! {
|
||||||
kbd.lock()
|
kbd.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.register_observer(SERVER_NAME_STATUS, StatusOpcode::Keypress.to_u32().unwrap() as usize);
|
.register_observer(SERVER_NAME_STATUS, StatusOpcode::Keypress.to_u32().unwrap() as usize);
|
||||||
|
// register the USB U2F event listener - point to the same handler as key press since our intention is to
|
||||||
|
// just toggle the backlight
|
||||||
|
usb_hid.register_u2f_observer(SERVER_NAME_STATUS, StatusOpcode::Keypress.to_u32().unwrap() as usize);
|
||||||
|
|
||||||
let autobacklight_enabled = Arc::new(Mutex::new(true));
|
let autobacklight_enabled = Arc::new(Mutex::new(true));
|
||||||
let (tx, rx): (Sender<BacklightThreadOps>, Receiver<BacklightThreadOps>) = unbounded();
|
let (tx, rx): (Sender<BacklightThreadOps>, Receiver<BacklightThreadOps>) = unbounded();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue