mirror of
https://github.com/trussed-dev/usbd-ctaphid.git
synced 2026-06-20 04:16:20 -07:00
Add CI workflow
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
name: ci
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: install Rust toolchain
|
||||
run: rustup show active-toolchain || rustup toolchain install
|
||||
- name: check
|
||||
run: |
|
||||
cargo check --workspace --all-features --all-targets
|
||||
- name: test
|
||||
run: |
|
||||
cargo test --all-features --workspace
|
||||
- name: lint
|
||||
run: |
|
||||
cargo fmt --check --all
|
||||
cargo clippy --workspace --all-features --all-targets -- -Dwarnings
|
||||
RUSTDOCFLAGS='-Dwarnings' cargo doc --workspace --all-features --no-deps
|
||||
+2
-2
@@ -27,7 +27,7 @@ pub struct CtapHid<'alloc, 'pipe, 'interrupt, Bus: UsbBus> {
|
||||
pipe: Pipe<'alloc, 'pipe, 'interrupt, Bus>,
|
||||
}
|
||||
|
||||
impl<'alloc, 'pipe, 'interrupt, Bus> CtapHid<'alloc, 'pipe, 'interrupt, Bus>
|
||||
impl<'alloc, 'pipe, Bus> CtapHid<'alloc, 'pipe, '_, Bus>
|
||||
where
|
||||
Bus: UsbBus,
|
||||
{
|
||||
@@ -218,7 +218,7 @@ pub enum ClassRequests {
|
||||
SetProtocol = 0xB,
|
||||
}
|
||||
|
||||
impl<'alloc, 'pipe, 'interrupt, Bus> UsbClass<Bus> for CtapHid<'alloc, 'pipe, 'interrupt, Bus>
|
||||
impl<Bus> UsbClass<Bus> for CtapHid<'_, '_, '_, Bus>
|
||||
where
|
||||
Bus: UsbBus,
|
||||
{
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
usbd-ctaphid
|
||||
|
||||
See "proposed standard":
|
||||
https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#usb
|
||||
<https://fidoalliance.org/specs/fido-v2.0-ps-20190130/fido-client-to-authenticator-protocol-v2.0-ps-20190130.html#usb>
|
||||
|
||||
*/
|
||||
|
||||
|
||||
+7
-8
@@ -180,7 +180,7 @@ pub struct Pipe<'alloc, 'pipe, 'interrupt, Bus: UsbBus> {
|
||||
pub(crate) version: crate::Version,
|
||||
}
|
||||
|
||||
impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus> {
|
||||
impl<'alloc, 'pipe, Bus: UsbBus> Pipe<'alloc, 'pipe, '_, Bus> {
|
||||
pub(crate) fn new(
|
||||
read_endpoint: EndpointOut<'alloc, Bus>,
|
||||
write_endpoint: EndpointIn<'alloc, Bus>,
|
||||
@@ -316,7 +316,10 @@ impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus
|
||||
// `solo ls` crashes here as it uses command 0x86
|
||||
Err(_) => {
|
||||
info!("Received invalid command.");
|
||||
self.start_sending_error_on_channel(channel, AuthenticatorError::InvalidCommand);
|
||||
self.start_sending_error_on_channel(
|
||||
channel,
|
||||
AuthenticatorError::InvalidCommand,
|
||||
);
|
||||
return;
|
||||
}
|
||||
};
|
||||
@@ -526,11 +529,7 @@ impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus
|
||||
}
|
||||
|
||||
_ => {
|
||||
if request.command == Command::Cbor {
|
||||
self.needs_keepalive = true;
|
||||
} else {
|
||||
self.needs_keepalive = false;
|
||||
}
|
||||
self.needs_keepalive = request.command == Command::Cbor;
|
||||
if self.interchange.state() == interchange::State::Responded {
|
||||
info!("dumping stale response");
|
||||
self.interchange.take_response();
|
||||
@@ -625,7 +624,7 @@ impl<'alloc, 'pipe, 'interrupt, Bus: UsbBus> Pipe<'alloc, 'pipe, 'interrupt, Bus
|
||||
message.len()
|
||||
);
|
||||
let response = Response::from_request_and_size(request, message.len());
|
||||
self.buffer[..message.len()].copy_from_slice(&message);
|
||||
self.buffer[..message.len()].copy_from_slice(message);
|
||||
self.start_sending(response);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user