From 13bdbe400bdc2aa6c820e31f95b824a4210de6e4 Mon Sep 17 00:00:00 2001 From: Aaron-Hartwig Date: Fri, 16 Jan 2026 09:53:22 -0600 Subject: [PATCH 1/3] adds HwError::I2cTransactionTimeout --- messages/src/message.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/messages/src/message.rs b/messages/src/message.rs index 845df4d..b06b957 100644 --- a/messages/src/message.rs +++ b/messages/src/message.rs @@ -63,7 +63,10 @@ pub mod version { /// Addition to HwError: I2cSclStretchTimeout pub const V5: u8 = 5; - pub const CURRENT: u8 = V5; + /// Addition to HwError: I2cTransactionTimeout + pub const V6: u8 = 6; + + pub const CURRENT: u8 = V6; pub const MIN: u8 = V1; } pub mod outer { @@ -200,6 +203,13 @@ pub enum HwError { /// CMIS 5.0 section B.2.7.3 but referred to as tRD. #[cfg_attr(any(test, feature = "std"), error("The module stretched SCL too long"))] I2cSclStretchTimeout, + + /// An I2C transaction has gone on for too long. + /// + /// While neither SFF-8636 or CMIS give guidance for transaction timeouts, + /// we are opting to use the SMBus t_timeout,min of 25ms to timeout. + #[cfg_attr(any(test, feature = "std"), error("The transaction timed out"))] + I2cTransactionTimeout, } /// Deserialize the [`HwError`]s from a packet buffer that are expected, given @@ -1069,7 +1079,7 @@ mod test { #[test] fn test_hardware_error_encoding_unchanged() { let mut buf = [0u8; HwError::MAX_SIZE]; - const TEST_DATA: [HwError; 13] = [ + const TEST_DATA: [HwError; 14] = [ HwError::I2cError, HwError::InvalidModuleIndex, HwError::FpgaError, @@ -1083,6 +1093,7 @@ mod test { HwError::I2cAddressNack, HwError::I2cByteNack, HwError::I2cSclStretchTimeout, + HwError::I2cTransactionTimeout, ]; for (variant_id, variant) in TEST_DATA.iter().enumerate() { From d31c35bc462318f64dc9b4d171257165a1dd2f8b Mon Sep 17 00:00:00 2001 From: Aaron Hartwig Date: Tue, 20 Jan 2026 14:14:23 -0600 Subject: [PATCH 2/3] feedback from Ben --- messages/src/message.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/messages/src/message.rs b/messages/src/message.rs index b06b957..a87ebc4 100644 --- a/messages/src/message.rs +++ b/messages/src/message.rs @@ -208,7 +208,7 @@ pub enum HwError { /// /// While neither SFF-8636 or CMIS give guidance for transaction timeouts, /// we are opting to use the SMBus t_timeout,min of 25ms to timeout. - #[cfg_attr(any(test, feature = "std"), error("The transaction timed out"))] + #[cfg_attr(any(test, feature = "std"), error("The I2C transaction to the module timed out"))] I2cTransactionTimeout, } From 03a159a91ac5866ebc53dd4b9fe8c6daacb96158 Mon Sep 17 00:00:00 2001 From: Aaron Hartwig Date: Tue, 20 Jan 2026 14:24:01 -0600 Subject: [PATCH 3/3] fmt --- messages/src/message.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/messages/src/message.rs b/messages/src/message.rs index a87ebc4..cf6cd00 100644 --- a/messages/src/message.rs +++ b/messages/src/message.rs @@ -208,7 +208,10 @@ pub enum HwError { /// /// While neither SFF-8636 or CMIS give guidance for transaction timeouts, /// we are opting to use the SMBus t_timeout,min of 25ms to timeout. - #[cfg_attr(any(test, feature = "std"), error("The I2C transaction to the module timed out"))] + #[cfg_attr( + any(test, feature = "std"), + error("The I2C transaction to the module timed out") + )] I2cTransactionTimeout, }