From 39cc2136504283f0d6538571d312bdc016c608f5 Mon Sep 17 00:00:00 2001 From: Charles Thompson Date: Mon, 6 Oct 2025 13:46:43 -0400 Subject: [PATCH 1/4] Implemented traits for 0.7 embedded io --- Cargo.toml | 2 +- src/io.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1ce1eba..30c303e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,4 +13,4 @@ repository = "https://github.com/mvirkkunen/usbd-serial" embedded-hal = "0.2.4" nb = "1" usb-device = "0.3" -embedded-io = "0.6" +embedded-io = "0.7" diff --git a/src/io.rs b/src/io.rs index 0b965e4..a6870ec 100644 --- a/src/io.rs +++ b/src/io.rs @@ -11,6 +11,14 @@ impl From for Error { } } +impl core::fmt::Display for Error { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{:?}", self) + } +} + +impl core::error::Error for Error {} + impl embedded_io::Error for Error { fn kind(&self) -> embedded_io::ErrorKind { match self.0 { From 2343b70c0e82c67340f0aa1a2e2d0f761c7f32ab Mon Sep 17 00:00:00 2001 From: Charles Thompson Date: Mon, 6 Oct 2025 13:55:34 -0400 Subject: [PATCH 2/4] Updated rust version to 2024 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 30c303e..752807e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "usbd-serial" description = "USB CDC-ACM serial port class for use with usb-device." version = "0.2.2" -edition = "2018" +edition = "2024" readme = "README.md" keywords = ["no-std", "usb-device"] license = "MIT" From fe70d59943562e8a94b871356d2933045bcad489 Mon Sep 17 00:00:00 2001 From: Charles Thompson Date: Mon, 6 Oct 2025 13:59:57 -0400 Subject: [PATCH 3/4] Updated formatting --- src/cdc_acm.rs | 2 +- src/serial_port.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cdc_acm.rs b/src/cdc_acm.rs index 3939763..24f0c1a 100644 --- a/src/cdc_acm.rs +++ b/src/cdc_acm.rs @@ -1,9 +1,9 @@ use core::convert::TryInto; use core::mem; +use usb_device::Result; use usb_device::class_prelude::*; use usb_device::descriptor::lang_id::LangID; use usb_device::device::DEFAULT_ALTERNATE_SETTING; -use usb_device::Result; /// This should be used as `device_class` when building the `UsbDevice`. pub const USB_CLASS_CDC: u8 = 0x02; diff --git a/src/serial_port.rs b/src/serial_port.rs index 1e05e89..44ba957 100644 --- a/src/serial_port.rs +++ b/src/serial_port.rs @@ -2,9 +2,9 @@ use crate::buffer::{Buffer, DefaultBufferStore}; use crate::cdc_acm::*; use core::borrow::BorrowMut; use core::slice; +use usb_device::Result; use usb_device::class_prelude::*; use usb_device::descriptor::lang_id::LangID; -use usb_device::Result; /// USB (CDC-ACM) serial port with built-in buffering to implement stream-like behavior. /// From b5b731a6f0ce3af1b01697677eeb91fde174005d Mon Sep 17 00:00:00 2001 From: Charles thompson Date: Tue, 7 Oct 2025 06:45:42 -0400 Subject: [PATCH 4/4] Updated changelog --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04112b1..d904545 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] -No unreleased changes yet! +### Changed +* `embedded-io` version changed from 0.6.x to 0.7.x +* Rust edition changed from 2018 to 2024 + +### Added +* Implemented `core::fmt::Display` and `core::error::Error` for `io::Error` to + allow for compatability with `embedded-io` 0.7.x ## [0.2.2] - 2024-04-22