Skip to content

Commit

Permalink
convert usbd-human-interface-device to xous-usb-hid
Browse files Browse the repository at this point in the history
  • Loading branch information
bunnie committed Nov 16, 2023
1 parent 498b898 commit 367ede6
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 43 deletions.
35 changes: 17 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,6 @@ git="https://github.com/betrusted-io/usb-device.git"
branch="main"
# local dev shortcuts
#path = "../usb-device"
#[patch.crates-io.usbd-human-interface-device]
#path = "../usbd-human-interface-device"

[patch.crates-io.getrandom]
path = "imports/getrandom"
Expand Down
1 change: 1 addition & 0 deletions RELEASE-v0.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ perform the Xous firmware upgrade. This requires running manual update commands,
- sigchat skeleton added thanks to @nhoj
- usbd-human-interface-device bumped to latest in preparation for a fork
- Fix #446 - add support for numeric-only passwords in `vault`
- Fork usbd-human-interface-device to xous-usb-hid

## Roadmap
- Lots of testing and bug fixes
Expand Down
2 changes: 1 addition & 1 deletion apps/vault/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ graphics-server = {path = "../../services/graphics-server" }
locales = {path = "../../locales"}
tts-frontend = {path="../../services/tts"}
usb-device-xous = {path="../../services/usb-device-xous"}
usbd-human-interface-device = "0.4.3"
xous-usb-hid = {git = "https://github.com/betrusted-io/xous-usb-hid.git"}
pddb = {path = "../../services/pddb" }
modals = {path = "../../services/modals" }
trng = {path="../../services/trng"}
Expand Down
2 changes: 1 addition & 1 deletion apps/vault/src/env/xous/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use ctap_crypto::rng256::XousRng256;
use xous::try_send_message;
use xous_names::XousNames;
use crate::env::xous::storage::XousUpgradeStorage;
use usbd_human_interface_device::device::fido::*;
use xous_usb_hid::device::fido::*;
use modals::Modals;
use locales::t;
use std::io::{Read, Write};
Expand Down
2 changes: 1 addition & 1 deletion apps/vault/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::vendor_commands::VendorSession;
use ux::framework::{VaultUx, DEFAULT_FONT, FONT_LIST, name_to_style};
use xous_ipc::Buffer;
use xous::{send_message, Message, msg_blocking_scalar_unpack, msg_scalar_unpack};
use usbd_human_interface_device::device::fido::*;
use xous_usb_hid::device::fido::*;
use num_traits::*;

use std::thread;
Expand Down
6 changes: 3 additions & 3 deletions services/usb-device-xous/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ xous-semver = "0.1.2"
utralib = { version = "0.1.23", optional = true, default-features = false }
trng = {path="../trng"}

usbd-human-interface-device = "0.4.3"
xous-usb-hid = {git = "https://github.com/betrusted-io/xous-usb-hid.git"}
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
packed_struct = { version = "0.10", default-features = false } # used by the xous-usb-hid crate
num_enum = { version = "0.5", default-features = false } # used by the xous-usb-hid crate

# Mass storage support
usbd_scsi = { path = "../../libs/mass-storage/usbd_scsi", optional = true }
Expand Down
6 changes: 3 additions & 3 deletions services/usb-device-xous/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use trng::api::TrngTestMode;
use xous::{CID, send_message, Message};
use num_traits::*;
pub use usb_device::device::UsbDeviceState;
pub use usbd_human_interface_device::device::keyboard::KeyboardLedsReport;
pub use usbd_human_interface_device::page::Keyboard as UsbKeyCode;
pub use xous_usb_hid::device::keyboard::KeyboardLedsReport;
pub use xous_usb_hid::page::Keyboard as UsbKeyCode;
use packed_struct::PackedStruct;
use xous_ipc::Buffer;
pub use usbd_human_interface_device::device::fido::RawFidoReport;
pub use xous_usb_hid::device::fido::RawFidoReport;

#[derive(Debug)]
pub struct UsbHid {
Expand Down
2 changes: 1 addition & 1 deletion services/usb-device-xous/src/main_hosted.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::*;

use num_traits::*;
use usbd_human_interface_device::device::fido::RawFidoReport;
use xous_usb_hid::device::fido::RawFidoReport;
use xous::{msg_scalar_unpack, msg_blocking_scalar_unpack};
use xous_semver::SemVer;
use core::num::NonZeroU8;
Expand Down
14 changes: 7 additions & 7 deletions services/usb-device-xous/src/main_hw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use crate::*;
use num_traits::*;
use usb_device_xous::KeyboardLedsReport;
use usb_device_xous::UsbDeviceType;
use usbd_human_interface_device::device::fido::RawFidoReport;
use usbd_human_interface_device::device::fido::RawFidoConfig;
use usbd_human_interface_device::device::fido::RawFido;
use usbd_human_interface_device::device::DeviceClass;
use xous_usb_hid::device::fido::RawFidoReport;
use xous_usb_hid::device::fido::RawFidoConfig;
use xous_usb_hid::device::fido::RawFido;
use xous_usb_hid::device::DeviceClass;
use xous::{msg_scalar_unpack, msg_blocking_scalar_unpack};
#[cfg(not(feature="minimal"))]
use xous_semver::SemVer;
Expand All @@ -17,9 +17,9 @@ use utralib::generated::*;

use usb_device::prelude::*;
use usb_device::class_prelude::*;
use usbd_human_interface_device::page::Keyboard;
use usbd_human_interface_device::device::keyboard::{NKROBootKeyboard, NKROBootKeyboardConfig};
use usbd_human_interface_device::prelude::*;
use xous_usb_hid::page::Keyboard;
use xous_usb_hid::device::keyboard::{NKROBootKeyboard, NKROBootKeyboardConfig};
use xous_usb_hid::prelude::*;

use std::convert::TryInto;
#[cfg(not(feature="minimal"))]
Expand Down
2 changes: 1 addition & 1 deletion services/usb-device-xous/src/mappings.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![allow(dead_code)]
pub use usbd_human_interface_device::page::Keyboard as UsbKeyCode;
pub use xous_usb_hid::page::Keyboard as UsbKeyCode;

#[cfg(any(feature="precursor", feature="renode"))]
pub fn char_to_hid_code_us101(key: char) -> Vec<UsbKeyCode> {
Expand Down
2 changes: 1 addition & 1 deletion services/usb-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bitfield = "0.13.2"
vcell = "0.1.3"
utralib = { version = "0.1.23", optional = true, default-features = false }

usbd-human-interface-device = "0.4.3"
xous-usb-hid = {git = "https://github.com/betrusted-io/xous-usb-hid.git"}
embedded-time = "0.12.1" # required by the keyboard interface

[dependencies.usb-device]
Expand Down
8 changes: 4 additions & 4 deletions services/usb-test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ use std::collections::BTreeMap;

use usb_device::prelude::*;
use usb_device::class_prelude::*;
use usbd_human_interface_device::page::Keyboard;
use usbd_human_interface_device::device::keyboard::NKROBootKeyboard;
use usbd_human_interface_device::prelude::*;
use xous_usb_hid::page::Keyboard;
use xous_usb_hid::device::keyboard::NKROBootKeyboard;
use xous_usb_hid::prelude::*;
use embedded_time::Clock;
use std::convert::TryInto;

Expand Down Expand Up @@ -100,7 +100,7 @@ fn main() -> ! {
)
.build(&usb_alloc);
let mut usb_dev = UsbDeviceBuilder::new(&usb_alloc, UsbVidPid(0x1209, 0x3613))
.manufacturer("usbd-human-interface-device")
.manufacturer("xous-usb-hid")
.product("NKRO Keyboard")
.serial_number("PRECURSOR")
.build();
Expand Down

0 comments on commit 367ede6

Please sign in to comment.