From 2628d5fe1416c8d70a86c356805a9d65f701b9bf Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 10 Jul 2026 01:41:01 +0800 Subject: [PATCH 1/2] flake.lock: Update Build would fail because of old libgit. now we can do nix develop -c cargo build nix build .#tool-debug Signed-off-by: Daniel Schaefer --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 87ca7ac6..0a5921b6 100644 --- a/flake.lock +++ b/flake.lock @@ -20,11 +20,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1770689213, - "narHash": "sha256-N6JiSpfi0s8NjUTnjwo3c+YAmvYhCDzjCKCrTUC97xM=", + "lastModified": 1783279667, + "narHash": "sha256-/NAkDSsve+GNM0Bt6tleJdCGfsTlK89nPjkVOzZMo0s=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "49d75834011c94a120a9cb874ac1c4d8b7bfc767", + "rev": "f205b5574fd0cb7da5b702a2da51507b7f4fdd1b", "type": "github" }, "original": { From c9ad0cd8cde601ecbcb72fc6901baa592d74ac91 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 5 Aug 2026 18:20:47 +0800 Subject: [PATCH 2/2] cargo clippy https://rust-lang.github.io/rust-clippy/rust-1.97.0/index.html#byte_char_slices Also flip from le to be for more readable code Signed-off-by: Daniel Schaefer --- framework_lib/src/ccgx/hid.rs | 6 +++--- framework_lib/src/ccgx/mod.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/framework_lib/src/ccgx/hid.rs b/framework_lib/src/ccgx/hid.rs index c36aeebb..d38739db 100644 --- a/framework_lib/src/ccgx/hid.rs +++ b/framework_lib/src/ccgx/hid.rs @@ -144,10 +144,10 @@ fn decode_fw_info(buf: &[u8]) -> HidFirmwareInfo { // TODO: Return Option? assert_eq!(info.report_id, ReportIdCmd::E0Read as u8); - if info.signature != [b'C', b'Y'] { + if info.signature != *b"CY" { println!("{:X?}", info); } - assert_eq!(info.signature, [b'C', b'Y']); + assert_eq!(info.signature, *b"CY"); info } @@ -157,7 +157,7 @@ fn print_fw_info(info: &HidFirmwareInfo, verbose: bool) { info!(" Signature: {:X?}", info.signature); // Something's totally off if the signature is invalid - if info.signature != [b'C', b'Y'] { + if info.signature != *b"CY" { error!("Firmware Signature is invalid."); return; } diff --git a/framework_lib/src/ccgx/mod.rs b/framework_lib/src/ccgx/mod.rs index 65239e64..fb0c8e76 100644 --- a/framework_lib/src/ccgx/mod.rs +++ b/framework_lib/src/ccgx/mod.rs @@ -31,8 +31,8 @@ const FW2_METADATA_ROW_CCG8: u32 = 0x3FF; const METADATA_OFFSET: usize = 0xC0; // TODO: Is this 0x40 on ADL? const CCG8_METADATA_OFFSET: usize = 0x80; const CCG3_METADATA_OFFSET: usize = 0x40; -const METADATA_MAGIC: u16 = u16::from_le_bytes([b'Y', b'C']); // CY (Cypress) -const CCG8_METADATA_MAGIC: u16 = u16::from_le_bytes([b'F', b'I']); // IF (Infineon) +const METADATA_MAGIC: u16 = u16::from_be_bytes(*b"CY"); // CY (Cypress) +const CCG8_METADATA_MAGIC: u16 = u16::from_be_bytes(*b"IF"); // IF (Infineon) #[repr(C, packed)] #[derive(FromBytes, KnownLayout, Debug, Copy, Clone)]