mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
modify naming of FidoInterface to RawFidoInterface
per maintainer request of usbd-human-interface-device for PR
This commit is contained in:
parent
d752c4e87e
commit
9ab3f71f23
7 changed files with 17 additions and 15 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -3670,7 +3670,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "usbd-human-interface-device"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/betrusted-io/usbd-human-interface-device.git?branch=main#34fca5ed645bcbfb36ceb28db771444b47c33a77"
|
||||
source = "git+https://github.com/betrusted-io/usbd-human-interface-device.git?branch=main#1bf7df956d26b25485a6d9faa186e5b387c55a67"
|
||||
dependencies = [
|
||||
"delegate",
|
||||
"embedded-time",
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ locales = {path = "../../locales"}
|
|||
tts-frontend = {path="../../services/tts"}
|
||||
usb-device-xous = {path="../../services/usb-device-xous"}
|
||||
usbd-human-interface-device = {git="https://github.com/betrusted-io/usbd-human-interface-device.git", branch="main"}
|
||||
#usbd-human-interface-device = {path="../../../usbd-human-interface-device"}
|
||||
pddb = {path = "../../services/pddb" }
|
||||
modals = {path = "../../services/modals" }
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ fn main() -> ! {
|
|||
let reply = ctap_hid.process_hid_packet(&msg.packet, now, &mut ctap_state);
|
||||
// This block handles sending packets.
|
||||
for pkt_reply in reply {
|
||||
let mut reply = FidoMsg::default();
|
||||
let mut reply = RawFidoMsg::default();
|
||||
reply.packet.copy_from_slice(&pkt_reply);
|
||||
let status = usb.u2f_send(reply);
|
||||
match status {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use xous::{msg_scalar_unpack, send_message, Message};
|
|||
use xous_ipc::Buffer;
|
||||
use locales::t;
|
||||
use crate::ctap::hid::{CtapHid, KeepaliveStatus};
|
||||
use usbd_human_interface_device::device::fido::FidoMsg;
|
||||
use usbd_human_interface_device::device::fido::RawFidoMsg;
|
||||
use std::io::{Write, Read};
|
||||
use chrono::{Utc, DateTime, NaiveDateTime};
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
|
@ -390,7 +390,7 @@ pub(crate) fn start_ux_thread() {
|
|||
if deferred_req.is_some() { // keepalives are only needed for deferred requests
|
||||
let keepalive_msg = CtapHid::keepalive(channel_id, KeepaliveStatus::UpNeeded);
|
||||
for pkt in keepalive_msg {
|
||||
let mut ka = FidoMsg::default();
|
||||
let mut ka = RawFidoMsg::default();
|
||||
ka.packet.copy_from_slice(&pkt);
|
||||
let status = usb.u2f_send(ka);
|
||||
match status {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ bitfield = "0.13.2"
|
|||
vcell = "0.1.3"
|
||||
|
||||
usbd-human-interface-device = {git="https://github.com/betrusted-io/usbd-human-interface-device.git", branch="main"}
|
||||
#usbd-human-interface-device = {path="../../../usbd-human-interface-device"}
|
||||
embedded-time = "0.12.1" # required by the keyboard interface
|
||||
packed_struct = { version = "0.10", default-features = false } # used by the usbd-human-interface-device crate
|
||||
num_enum = { version = "0.5", default-features = false } # used by the usbd-human-interface-device crate
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ pub use usbd_human_interface_device::device::keyboard::KeyboardLedsReport;
|
|||
pub use usbd_human_interface_device::page::Keyboard as UsbKeyCode;
|
||||
use packed_struct::PackedStruct;
|
||||
use xous_ipc::Buffer;
|
||||
pub use usbd_human_interface_device::device::fido::FidoMsg;
|
||||
pub use usbd_human_interface_device::device::fido::RawFidoMsg;
|
||||
|
||||
pub enum UsbDeviceType {
|
||||
Debug = 0,
|
||||
|
|
@ -201,7 +201,7 @@ impl UsbHid {
|
|||
_ => panic!("Internal error: illegal return type"),
|
||||
}
|
||||
}
|
||||
pub fn u2f_wait_incoming(&self) -> Result<FidoMsg, xous::Error> {
|
||||
pub fn u2f_wait_incoming(&self) -> Result<RawFidoMsg, xous::Error> {
|
||||
let req = U2fMsgIpc {
|
||||
data: [0; 64],
|
||||
code: U2fCode::RxWait
|
||||
|
|
@ -211,7 +211,7 @@ impl UsbHid {
|
|||
let ack = buf.to_original::<U2fMsgIpc, _>().unwrap();
|
||||
match ack.code {
|
||||
U2fCode::RxAck => {
|
||||
let mut u2fmsg = FidoMsg::default();
|
||||
let mut u2fmsg = RawFidoMsg::default();
|
||||
u2fmsg.packet.copy_from_slice(&ack.data);
|
||||
Ok(u2fmsg)
|
||||
},
|
||||
|
|
@ -221,7 +221,7 @@ impl UsbHid {
|
|||
_ => Err(xous::Error::InternalError)
|
||||
}
|
||||
}
|
||||
pub fn u2f_send(&self, msg: FidoMsg) -> Result<(), xous::Error> {
|
||||
pub fn u2f_send(&self, msg: RawFidoMsg) -> Result<(), xous::Error> {
|
||||
let mut req = U2fMsgIpc {
|
||||
data: [0; 64],
|
||||
code: U2fCode::Tx
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ 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::FidoMsg;
|
||||
use usbd_human_interface_device::device::fido::RawFidoMsg;
|
||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||
use usbd_human_interface_device::device::fido::FidoInterface;
|
||||
use usbd_human_interface_device::device::fido::RawFidoInterface;
|
||||
use xous::{msg_scalar_unpack, msg_blocking_scalar_unpack};
|
||||
use core::num::NonZeroU8;
|
||||
use std::collections::BTreeMap;
|
||||
|
|
@ -157,13 +157,13 @@ fn main() -> ! {
|
|||
NKROBootKeyboardInterface::default_config(&clock),
|
||||
)
|
||||
.add_interface(
|
||||
FidoInterface::default_config()
|
||||
RawFidoInterface::default_config()
|
||||
)
|
||||
.build(&usb_alloc);
|
||||
#[cfg(all(any(target_os = "none", target_os = "xous"), not(feature="emukbd")))]
|
||||
let mut composite = UsbHidClassBuilder::new()
|
||||
.add_interface(
|
||||
FidoInterface::default_config()
|
||||
RawFidoInterface::default_config()
|
||||
)
|
||||
.build(&usb_alloc);
|
||||
|
||||
|
|
@ -240,11 +240,11 @@ fn main() -> ! {
|
|||
let mut buffer = unsafe { Buffer::from_memory_message_mut(msg.body.memory_message_mut().unwrap()) };
|
||||
let mut u2f_ipc = buffer.to_original::<U2fMsgIpc, _>().unwrap();
|
||||
if fido_listener_pid == msg.sender.pid() {
|
||||
let mut u2f_msg = FidoMsg::default();
|
||||
let mut u2f_msg = RawFidoMsg::default();
|
||||
assert_eq!(u2f_ipc.code, U2fCode::Tx, "Expected U2fCode::Tx in wrapper");
|
||||
u2f_msg.packet.copy_from_slice(&u2f_ipc.data);
|
||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||
let u2f = composite.interface::<FidoInterface<'_, _>, _>();
|
||||
let u2f = composite.interface::<RawFidoInterface<'_, _>, _>();
|
||||
#[cfg(any(target_os = "none", target_os = "xous"))]
|
||||
u2f.write_report(&u2f_msg).ok();
|
||||
log::debug!("sent U2F packet {:x?}", u2f_ipc.data);
|
||||
|
|
@ -267,7 +267,7 @@ fn main() -> ! {
|
|||
Err(e) => log::trace!("KEYB ERR: {:?}", e),
|
||||
}
|
||||
}
|
||||
let u2f = composite.interface::<FidoInterface<'_, _>, _>();
|
||||
let u2f = composite.interface::<RawFidoInterface<'_, _>, _>();
|
||||
match u2f.read_report() {
|
||||
Ok(u2f_report) => {
|
||||
if let Some(mut listener) = fido_listener.take() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue