diff --git a/Cargo.lock b/Cargo.lock index 5d67377..c603446 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -350,9 +350,9 @@ dependencies = [ [[package]] name = "ctaphid-dispatch" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27caf0a07de6b0af58ba69562c1834ddf7aa27bc1d1687fed3b18fea1501e59e" +checksum = "38fd4316573df369820c5a9f8285fe522d8871c0b20bcf7d390f73b8e6caee28" dependencies = [ "ctaphid-app", "delog", @@ -1562,9 +1562,9 @@ dependencies = [ [[package]] name = "usbd-ctaphid" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "092fad7bf817001ecade9272fe6ccbea4e5d0c02f99ca24c4c5ce97fbbff5371" +checksum = "82f5a2aa6898726b4eeb3fa3796fb8dc49e76e2a16bd683db103f63bc8ceca97" dependencies = [ "ctaphid-dispatch", "delog", diff --git a/Cargo.toml b/Cargo.toml index c68f20b..007f048 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,8 +15,8 @@ usb-device = { version = "0.2.7", default-features = false } usbip-device = "0.1.5" # ctaphid -ctaphid-dispatch = { version = "0.2", features = ["log-all"], optional = true } -usbd-ctaphid = { version = "0.2", features = ["log-all"], optional = true } +ctaphid-dispatch = { version = "0.3", features = ["log-all"], optional = true } +usbd-ctaphid = { version = "0.3", features = ["log-all"], optional = true } # ccid apdu-dispatch = { version = "0.3", optional = true } diff --git a/examples/dummy.rs b/examples/dummy.rs index 92b5d0c..38b37fd 100644 --- a/examples/dummy.rs +++ b/examples/dummy.rs @@ -9,8 +9,6 @@ use std::path::PathBuf; -#[cfg(feature = "ccid")] -use apdu_dispatch::command::SIZE as ApduCommandSize; #[cfg(feature = "ctaphid")] use ctaphid_dispatch::app::{Command, Error, VendorCommand}; @@ -113,19 +111,17 @@ impl<'a> trussed_usbip::Apps<'a, CoreOnly> for Apps( + fn with_ctaphid_apps( &mut self, - f: impl FnOnce( - &mut [&mut dyn ctaphid_dispatch::app::App<'a, { ctaphid_dispatch::MESSAGE_SIZE }>], - ) -> T, + f: impl FnOnce(&mut [&mut dyn ctaphid_dispatch::app::App<'a, N>]) -> T, ) -> T { f(&mut [&mut self.dummy]) } #[cfg(feature = "ccid")] - fn with_ccid_apps( + fn with_ccid_apps( &mut self, - f: impl FnOnce(&mut [&mut dyn apdu_dispatch::app::App]) -> T, + f: impl FnOnce(&mut [&mut dyn apdu_dispatch::app::App]) -> T, ) -> T { f(&mut []) } diff --git a/src/ctaphid.rs b/src/ctaphid.rs index da638f8..aca475a 100644 --- a/src/ctaphid.rs +++ b/src/ctaphid.rs @@ -9,12 +9,12 @@ use usbd_ctaphid::{types::Status, CtapHid}; use super::{Timeout, IS_WAITING}; -pub fn setup<'bus, 'pipe, 'interrupt, B: UsbBus>( +pub fn setup<'bus, 'pipe, 'interrupt, B: UsbBus, const N: usize>( bus_allocator: &'bus UsbBusAllocator, - interchange: &'pipe ctaphid_dispatch::Channel, + interchange: &'pipe ctaphid_dispatch::Channel, ) -> ( - CtapHid<'bus, 'pipe, 'interrupt, B>, - Dispatch<'pipe, 'interrupt>, + CtapHid<'bus, 'pipe, 'interrupt, B, N>, + Dispatch<'pipe, 'interrupt, N>, ) { let (ctaphid_rq, ctaphid_rp) = interchange.split().unwrap(); let ctaphid = CtapHid::new(bus_allocator, ctaphid_rq, 0u32) @@ -25,8 +25,8 @@ pub fn setup<'bus, 'pipe, 'interrupt, B: UsbBus>( (ctaphid, ctaphid_dispatch) } -pub fn keepalive( - ctaphid: &mut CtapHid<'_, '_, '_, B>, +pub fn keepalive( + ctaphid: &mut CtapHid<'_, '_, '_, B, N>, timeout: &mut Timeout, epoch: Instant, ) { diff --git a/src/lib.rs b/src/lib.rs index eeb4d11..aef3ca3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -66,20 +66,15 @@ pub trait Apps<'interrupt, D: Dispatch> { ) -> Self; #[cfg(feature = "ctaphid")] - fn with_ctaphid_apps( + fn with_ctaphid_apps( &mut self, - f: impl FnOnce( - &mut [&mut dyn ctaphid_dispatch::app::App< - 'interrupt, - { ctaphid_dispatch::MESSAGE_SIZE }, - >], - ) -> T, + f: impl FnOnce(&mut [&mut dyn ctaphid_dispatch::app::App<'interrupt, N>]) -> T, ) -> T; #[cfg(feature = "ccid")] - fn with_ccid_apps( + fn with_ccid_apps( &mut self, - f: impl FnOnce(&mut [&mut dyn apdu_dispatch::app::App<7609>]) -> T, + f: impl FnOnce(&mut [&mut dyn apdu_dispatch::app::App]) -> T, ) -> T; } @@ -163,7 +158,10 @@ where #[cfg(feature = "ctaphid")] let ctap_channel = ctaphid_dispatch::Channel::new(); #[cfg(feature = "ctaphid")] - let (mut ctaphid, mut ctaphid_dispatch) = ctaphid::setup(&bus_allocator, &ctap_channel); + let (mut ctaphid, mut ctaphid_dispatch) = ctaphid::setup::< + _, + { ctaphid_dispatch::DEFAULT_MESSAGE_SIZE }, + >(&bus_allocator, &ctap_channel); #[cfg(feature = "ccid")] let (contact, contactless) = Default::default();