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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
* [breaking] The control pipe is now provided in the `UsbDeviceBuilder` API to allow for user-provided control
pipes. This makes it so that control pipes have configurable sizing.
* Don't require UsbBus to be Sync. If a UsbBus is not Sync, it can still be used to make a UsbDevice, but that UsbDevice will not be Sync (ensuring soundness).
* Update `defmt` to version 1.
* Update `rand` to version 0.10.

## [0.3.2] - 2024-03-06

Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ authors = ["Matti Virkkunen <mvirkkunen@gmail.com>"]
repository = "https://github.com/rust-embedded-community/usb-device"

[dependencies]
defmt = { version = "0.3", optional = true }
defmt = { version = "1", optional = true }
portable-atomic = { version = "1.2.0", default-features = false }
heapless = "0.8"
log = { version = "0.4", default-features = false, optional = true}

[dev-dependencies]
rusb = "0.9.1"
rand = "0.8.5"
rand = { version = "0.10", features = ["thread_rng"] }

[features]

Expand Down
2 changes: 1 addition & 1 deletion tests/test_class_host/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn open_device(ctx: &Context) -> rusb::Result<DeviceHandles> {
continue;
}

let mut handle = device.open()?;
let handle = device.open()?;

let langs = handle.read_languages(TIMEOUT)?;
if langs.is_empty() || langs[0].lang_id() != EN_US {
Expand Down
11 changes: 6 additions & 5 deletions tests/test_class_host/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use crate::device::*;
use rand::prelude::*;
use rand::rngs::ThreadRng;
use rusb::{request_type, Direction, Recipient, RequestType, TransferType};
use std::cmp::max;
use std::fmt::Write;
Expand Down Expand Up @@ -31,11 +32,11 @@ macro_rules! tests {
tests! {

fn control_request(dev, _out) {
let mut rng = rand::thread_rng();
let mut rng = ThreadRng::default();

let value: u16 = rng.gen();
let index: u16 = rng.gen();
let data = random_data(rng.gen_range(0..16));
let value: u16 = rng.random();
let index: u16 = rng.random();
let data = random_data(rng.random_range(0..16));

let mut expected = [0u8; 8];
expected[0] = 0x02_u8 << 5;
Expand Down Expand Up @@ -318,6 +319,6 @@ fn run_bench(dev: &DeviceHandles, out: &mut String, f: impl Fn(&mut [u8])) {

fn random_data(len: usize) -> Vec<u8> {
let mut data = vec![0u8; len];
rand::thread_rng().fill(data.as_mut_slice());
ThreadRng::default().fill(data.as_mut_slice());
data
}