Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,16 @@ jobs:

- name: Check all targets
run: |
cargo check --workspace --all-targets --no-default-features
cargo check --workspace --all-targets --no-default-features --features ctaphid
cargo check --workspace --all-targets --no-default-features --features ccid
# usb-device 0.2 bus
cargo check --workspace --all-targets --no-default-features --features usb-device-0-2
cargo check --workspace --all-targets --no-default-features --features usb-device-0-2,ctaphid
cargo check --workspace --all-targets --no-default-features --features usb-device-0-2,ccid
# usb-device 0.3 bus
cargo check --workspace --all-targets --no-default-features --features usb-device-0-3
cargo check --workspace --all-targets --no-default-features --features usb-device-0-3,ctaphid
cargo check --workspace --all-targets --no-default-features --features usb-device-0-3,ccid
# storage pulls in usb-device 0.3 on its own
cargo check --workspace --all-targets --no-default-features --features storage
cargo check --workspace --all-targets
cargo check --workspace --all-targets --all-features

Expand Down
99 changes: 90 additions & 9 deletions Cargo.lock

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

38 changes: 33 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,24 @@ log = { version = "0.4.14", default-features = false }
rand_chacha = { version = "0.3", default-features = false }
rand_core = { version = "0.6", features = ["getrandom"] }
trussed = { version = "=0.2.0-rc.1", default-features = false, features = ["log-all", "virt"] }
usb-device = { version = "0.2.7", default-features = false }
usbip-device = "0.1.5"
# Selects the usb-device version; see the `usb_device` alias in src/lib.rs.
usb-device-0-2 = { package = "usb-device", version = "0.2.7", default-features = false, optional = true }
usb-device-0-3 = { package = "usb-device", version = "0.3.2", default-features = false, optional = true }
usbip-device-0-1 = { package = "usbip-device", version = "0.1.5", optional = true }
usbip-device-0-2 = { package = "usbip-device", git = "https://github.com/daringer/usbip-device", rev = "ad359ae257e4bd931d9424732132cf085e0fac02", optional = true }

# ctaphid
ctaphid-dispatch = { version = "0.4", features = ["log-all"], optional = true }
usbd-ctaphid = { version = "0.4", features = ["log-all"], optional = true }
usbd-ctaphid = { version = "0.4", features = ["log-all"], optional = true, default-features = false }

# ccid
apdu-dispatch = { version = "0.4", optional = true }
usbd-ccid = { version = "0.4", features = ["log-all"], optional = true }
usbd-ccid = { version = "0.4", features = ["log-all"], optional = true, default-features = false }

# storage
usbd-storage = { version = "3.0.0", features = ["bbb", "scsi"], optional = true }
aes = { version = "0.8", optional = true }
xts-mode = { version = "0.5", optional = true }

[dev-dependencies]
clap = { version = "3.0.0", features = ["derive"] }
Expand All @@ -36,9 +44,29 @@ trussed = "=0.2.0-rc.1"
trussed-core = "0.2"

[features]
default = ["ctaphid", "ccid"]
default = ["ctaphid", "ccid", "usb-device-0-2"]
ctaphid = ["ctaphid-dispatch", "usbd-ctaphid"]
ccid = ["apdu-dispatch", "usbd-ccid"]
# usbd-storage requires usb-device 0.3, so enabling storage selects it.
storage = ["dep:usbd-storage", "dep:aes", "dep:xts-mode", "usb-device-0-3"]

# The class drivers must resolve to the same usb-device version as the bus.
"usb-device-0-2" = [
"dep:usb-device-0-2",
"dep:usbip-device-0-1",
"usbd-ctaphid?/usb-device-0-2",
"usbd-ccid?/usb-device-0-2",
]
"usb-device-0-3" = [
"dep:usb-device-0-3",
"dep:usbip-device-0-2",
"usbd-ctaphid?/usb-device-0-3",
"usbd-ccid?/usb-device-0-3",
]

[package.metadata.docs.rs]
all-features = true

[patch.crates-io]
usbd-ccid = { git = "https://github.com/trussed-dev/usbd-ccid", rev = "9912b35c5d7ad0253a60219c1555084eab3844d7" }
usbd-ctaphid = { git = "https://github.com/trussed-dev/usbd-ctaphid", rev = "91ecf98c88b1a61276ebf3e77e65009bba3c4e17" }
2 changes: 1 addition & 1 deletion src/ccid.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::time::{Duration, Instant};

use crate::usb_device::bus::{UsbBus, UsbBusAllocator};
use apdu_dispatch::dispatch::ApduDispatch;
use apdu_dispatch::interchanges::Data;
use usb_device::bus::{UsbBus, UsbBusAllocator};
use usbd_ccid::{Ccid, Status};

use super::Timeout;
Expand Down
2 changes: 1 addition & 1 deletion src/ctaphid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::{
time::{Duration, Instant},
};

use crate::usb_device::bus::{UsbBus, UsbBusAllocator};
use ctaphid_dispatch::Dispatch;
use usb_device::bus::{UsbBus, UsbBusAllocator};
use usbd_ctaphid::{types::Status, CtapHid};

use super::{Timeout, IS_WAITING};
Expand Down
Loading
Loading