Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repository = "https://github.com/solokeys/ctaphid-dispatch"

[workspace.dependencies]
heapless-bytes = "0.3"
trussed-core = "0.1.0-rc.1"
trussed-core = "0.1.0"

[patch.crates-io]
ctaphid-app.path = "app"
4 changes: 2 additions & 2 deletions app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changelog

## [v0.1.0-rc.1](https://github.com/trussed-dev/ctaphid-dispatch/releases/tag/app-v0.1.0-rc.1) (2025-01-08)
## [v0.1.0](https://github.com/trussed-dev/ctaphid-dispatch/releases/tag/app-v0.1.0) (2025-01-08)

- Extract `app` and `command` modules from `ctaphid-dispatch` 0.1 into a separate crate.
Initial release that extracts the `app` and `command` modules from `ctaphid-dispatch` 0.1 into a separate crate.
2 changes: 1 addition & 1 deletion app/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ctaphid-app"
version = "0.1.0-rc.1"
version = "0.1.0"
description = "trait for CTAPHID applications"

authors.workspace = true
Expand Down
5 changes: 5 additions & 0 deletions dispatch/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
-

## [0.2.0] - 2025-01-08

- Optimize stack usage of `Dispatch::poll`
- Replace `trussed` dependency with `trussed-core`.
- Replace `heapless` dependency with `heapless-bytes`.
- Move the `app` and `command` modules into a separate crate, `ctaphid-app`, and re-export it.
- Make `App` trait generic over the response size.
- Remove unused `ShortMessage` type.
- Flatten the public module structure and remove unnecessary re-exports.

## [0.1.1] - 2022-08-22
- adjust to `interchange` API change
Expand Down
4 changes: 2 additions & 2 deletions dispatch/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ctaphid-dispatch"
version = "0.1.1"
version = "0.2.0"
description = "Dispatch layer after usbd-ctaphid"

authors.workspace = true
Expand All @@ -9,7 +9,7 @@ license.workspace = true
repository.workspace = true

[dependencies]
ctaphid-app = "0.1.0-rc.1"
ctaphid-app = "0.1"
delog = "0.1"
heapless-bytes.workspace = true
interchange = "0.3.0"
Expand Down
5 changes: 0 additions & 5 deletions dispatch/src/constants.rs

This file was deleted.

14 changes: 5 additions & 9 deletions dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@
extern crate delog;
generate_macros!();

pub mod dispatch;
pub mod types;
mod dispatch;
mod types;

pub mod app {
pub use crate::types::AppResult;
pub use ctaphid_app::{App, Command, Error};
}
pub use ctaphid_app as app;

pub mod command {
pub use ctaphid_app::{Command, VendorCommand};
}
pub use dispatch::Dispatch;
pub use types::{Channel, InterchangeResponse, Message, Requester, Responder, MESSAGE_SIZE};
14 changes: 1 addition & 13 deletions dispatch/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
use ctaphid_app::{Command, Error};
use heapless_bytes::Bytes;

pub use ctaphid_app::Error;

// // 7609 bytes is max message size for ctaphid
// type U6144 = <heapless::consts::U4096 as core::ops::Add<heapless::consts::U2048>>::Output;
// type U7168 = <U6144 as core::ops::Add<heapless::consts::U1024>>::Output;
// pub type U7609 = <U7168 as core::ops::Add<heapless::consts::U441>>::Output;
// pub type U7609 = heapless::consts::U4096;

// TODO: find reasonable size
// pub type Message = heapless::Vec<u8, 3072>;
pub const MESSAGE_SIZE: usize = 7609;

pub type Message = Bytes<MESSAGE_SIZE>;
pub type AppResult = core::result::Result<(), Error>;

/// Wrapper struct that implements [`Default`][] to be able to use [`response_mut`](interchange::Responder::response_mut)
pub struct InterchangeResponse(pub Result<Message, Error>);
Expand All @@ -36,8 +26,6 @@ impl From<InterchangeResponse> for Result<Message, Error> {
}
}

pub use crate::command::Command;

pub type Responder<'pipe> = interchange::Responder<'pipe, (Command, Message), InterchangeResponse>;
pub type Requester<'pipe> = interchange::Requester<'pipe, (Command, Message), InterchangeResponse>;
pub type Channel = interchange::Channel<(Command, Message), InterchangeResponse>;
Loading