From 2d1aaa72403d602f063c18995af60f1b812644fd Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Tue, 10 Jun 2025 02:06:57 +0800 Subject: [PATCH 01/34] ccgx: derive Ord for AppVersion and BaseVersion Allow easily comparing them Signed-off-by: Daniel Schaefer --- framework_lib/src/ccgx/mod.rs | 45 ++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/framework_lib/src/ccgx/mod.rs b/framework_lib/src/ccgx/mod.rs index f7269b9..4495cc7 100644 --- a/framework_lib/src/ccgx/mod.rs +++ b/framework_lib/src/ccgx/mod.rs @@ -110,7 +110,7 @@ pub enum SiliconId { Ccg8 = 0x3580, } -#[derive(Debug, PartialEq, Copy, Clone)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Copy, Clone)] pub struct BaseVersion { /// Major part of the version. X of X.Y.Z.BB pub major: u8, @@ -154,7 +154,7 @@ impl From for BaseVersion { } } -#[derive(Debug, PartialEq, Copy, Clone)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Copy, Clone)] pub enum Application { Notebook, Monitor, @@ -162,7 +162,7 @@ pub enum Application { Invalid, } -#[derive(Debug, PartialEq, Copy, Clone)] +#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Copy, Clone)] pub struct AppVersion { pub application: Application, /// Major part of the version. X of X.Y.Z @@ -309,3 +309,42 @@ fn parse_metadata_cyacd2(buffer: &[u8]) -> Option<(u32, u32)> { None } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + // Make sure deriving does what I expect, properly comparing with multiple fields + fn derive_ord() { + let v0_0_0 = AppVersion { + application: Application::Notebook, + major: 0, + minor: 0, + circuit: 0, + }; + let v1_0_1 = AppVersion { + application: Application::Notebook, + major: 1, + minor: 0, + circuit: 1, + }; + let v0_1_0 = AppVersion { + application: Application::Notebook, + major: 0, + minor: 1, + circuit: 0, + }; + let v1_1_1 = AppVersion { + application: Application::Notebook, + major: 1, + minor: 1, + circuit: 1, + }; + assert_eq!(v0_0_0, v0_0_0.clone()); + assert!(v0_0_0 < v1_0_1); + assert!(v0_1_0 < v1_0_1); + assert!(v1_0_1 < v1_1_1); + assert!(v1_1_1 > v1_0_1); + } +} From ba0bad02be76efe869653438ba7cc4569fb4ad8b Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 15 Jun 2025 23:49:25 +0800 Subject: [PATCH 02/34] docs: Move file analysis to advanced examples Too low level for the main readme. Signed-off-by: Daniel Schaefer --- EXAMPLES_ADVANCED.md | 65 ++++++++++++++++++++++++++++++++++++++++++++ README.md | 55 ------------------------------------- 2 files changed, 65 insertions(+), 55 deletions(-) diff --git a/EXAMPLES_ADVANCED.md b/EXAMPLES_ADVANCED.md index f8fb217..0ece899 100644 --- a/EXAMPLES_ADVANCED.md +++ b/EXAMPLES_ADVANCED.md @@ -100,3 +100,68 @@ Wrote 153 bytes to foo.bin # Update everything from a file > framework_tool --flash-gpu-descriptor-file pcie_4x2.bin ``` + +## Analyzing binaries + +### EC + +Note that only since Framework 13 Intel Core Ultra (and later) the version number embedded in the ED binary is meaningful. As you can see below, in this example on Intel Core 12th/13th Gen (hx30) it's always 0.0.1. +The commit hash though is accurate and reflects the git commit it was built from. + +``` +> framework-tool --ec--bin ec.bin +File + Size: 524288 B + Size: 512 KB +EC + Version: hx30_v0.0.1-7a61a89 + RollbackVer: 0 + Platform: hx30 + Version: 0.0.1 + Commit: 7a61a89 + Size: 2868 B + Size: 2 KB +``` + +### PD + +``` +> framework_tool --pd-bin pd-0.1.14.bin +File + Size: 65536 B + Size: 64 KB +FW 1 + Silicon ID: 0x3000 + Version: 0.1.14 + Row size: 128 B + Start Row: 22 + Rows: 95 + Size: 12160 B + Size: 11 KB +FW 2 + Silicon ID: 0x3000 + Version: 0.1.14 + Row size: 128 B + Start Row: 118 + Rows: 381 + Size: 48768 B + Size: 47 KB +``` + +### UEFI Capsule + +``` +> framework_tool --capsule retimer23.cap +File + Size: 2232676 B + Size: 2180 KB +Capsule Header + Capsule GUID: (ba2e4e6e, 3b0c, 4f25, [8a,59,4c,55,3f,c8,6e,a2]) + Header size: 28 B + Flags: 0x50000 + Persist across reset (0x10000) + Initiate reset (0x40000) + Capsule Size: 2232676 B + Capsule Size: 2180 KB + Type: Framework Retimer23 (Right) +``` diff --git a/README.md b/README.md index fc913e2..848389f 100644 --- a/README.md +++ b/README.md @@ -205,61 +205,6 @@ Many actions require root. First build with cargo and then run the binary with s cargo build && sudo ./target/debug/framework_tool ``` -Dumping version information from firmware binaries: - -``` -# Dumping PD FW Binary Information: -> cargo run -q -- --pd-bin pd-0.1.14.bin -File - Size: 65536 B - Size: 64 KB -FW 1 - Silicon ID: 0x3000 - Version: 0.1.14 - Row size: 128 B - Start Row: 22 - Rows: 95 - Size: 12160 B - Size: 11 KB -FW 2 - Silicon ID: 0x3000 - Version: 0.1.14 - Row size: 128 B - Start Row: 118 - Rows: 381 - Size: 48768 B - Size: 47 KB - -# Dumping EC FW Binary Information -> cargo run -q -- --ec--bin ec.bin -File - Size: 524288 B - Size: 512 KB -EC - Version: hx30_v0.0.1-7a61a89 - RollbackVer: 0 - Platform: hx30 - Version: 0.0.1 - Commit: 7a61a89 - Size: 2868 B - Size: 2 KB - -# Dumping Capsule Binary Information: -> cargo run -q -- --capsule retimer23.cap -File - Size: 2232676 B - Size: 2180 KB -Capsule Header - Capsule GUID: (ba2e4e6e, 3b0c, 4f25, [8a,59,4c,55,3f,c8,6e,a2]) - Header size: 28 B - Flags: 0x50000 - Persist across reset (0x10000) - Initiate reset (0x40000) - Capsule Size: 2232676 B - Capsule Size: 2180 KB - Type: Framework Retimer23 (Right) -``` - ###### Running on Windows On newly released systems since 2025 the Framework driver installer includes the EC driver. From c55d6bd7cddbac82ce697c62de9ec6f6665f52f2 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sun, 15 Jun 2025 23:51:46 +0800 Subject: [PATCH 03/34] README: Add platform list And which OS version is supported. Signed-off-by: Daniel Schaefer --- README.md | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 848389f..c40160a 100644 --- a/README.md +++ b/README.md @@ -13,11 +13,32 @@ see the [Support Matrices](support-matrices.md). ###### Operating System Support -- [x] OS Tool (`framework_tool`) - - [x] Tested on Linux - - [x] Tested on Windows - - [x] Tested on FreeBSD -- [x] UEFI Shell tool (`framework_uefi`) +The following operating environments are supported. + +- Linux +- Windows +- UEFI +- FreeBSD + +Most functionality depends communication with the EC. +For Linux and Windows there are dedicated drivers. +On UEFI and FreeBSD raw port I/O is used - on Linux this can also be used as a fallback, if the driver is not available or not working. + +| | Port I/O | Linux | Windows | +|---------------------|----------| ------|---------| +| Framework 12 | | | | +| Intel Core 12th Gen | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Yes | +| Framework 13 | | | | +| Intel Core 11th Gen | Yes | [6.11](https://github.com/torvalds/linux/commit/04ca0a51f1e63bd553fd4af8e9af0fe094fa4f0a) | Not yet | +| Intel Core 12th Gen | Yes | [6.13](https://github.com/torvalds/linux/commit/dcd59d0d7d51b2a4b768fc132b0d74a97dfd6d6a) | Not yet | +| Intel Core 13th Gen | Yes | [6.13](https://github.com/torvalds/linux/commit/dcd59d0d7d51b2a4b768fc132b0d74a97dfd6d6a) | Not yet | +| AMD Ryzen 7040 | Yes | [6.10](https://github.com/torvalds/linux/commit/c8f460d991df93d87de01a96b783cad5a2da9616) | Soon | +| Intel Core Ultra 1S | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Soon | +| AMD Ryzen AI 300 | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Yes | +| Framework 16 | | | | +| AMD Ryzen 7040 | Yes | [6.10](https://github.com/torvalds/linux/commit/c8f460d991df93d87de01a96b783cad5a2da9616) | Soon | +| Framework Desktop | | | | +| AMD Ryzen AI Max | Yes | [6.15](https://github.com/torvalds/linux/commit/d83c45aeec9b223fe6db4175e9d1c4f5699cc37a) | Yes | ###### Firmware Information From fcb1ba86e04d7be3fd902a4c761b2b2d78a9aff1 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 18 Jun 2025 14:13:37 +0800 Subject: [PATCH 04/34] --inputdeck: On FW16 also print sleep_l gpio state To help debug keyboard/EC issues it's useful to know what the state of that GPIO is. EC uses it to tell the keyboard about system sleep and lid state. ``` > framework_tool --inputdeck Chassis Closed: true Input Deck State: On Touchpad present: true SLEEP# GPIO high: true Positions: Pos 0: KeyboardA Pos 1: Disconnected Pos 2: Disconnected Pos 3: KeyboardB Pos 4: Disconnected ``` Signed-off-by: Daniel Schaefer --- EXAMPLES.md | 1 + framework_lib/src/chromium_ec/mod.rs | 2 ++ 2 files changed, 3 insertions(+) diff --git a/EXAMPLES.md b/EXAMPLES.md index 61b4aac..2361b19 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -234,6 +234,7 @@ Input Deck Chassis Closed: true Input Deck State: On Touchpad present: true +SLEEP# GPIO high: true Positions: Pos 0: GenericC Pos 1: KeyboardA diff --git a/framework_lib/src/chromium_ec/mod.rs b/framework_lib/src/chromium_ec/mod.rs index 0adba41..ed1210e 100644 --- a/framework_lib/src/chromium_ec/mod.rs +++ b/framework_lib/src/chromium_ec/mod.rs @@ -603,9 +603,11 @@ impl CrosEc { pub fn print_fw16_inputdeck_status(&self) -> EcResult<()> { let intrusion = self.get_intrusion_status()?; let status = self.get_input_deck_status()?; + let sleep_l = self.get_gpio("sleep_l")?; println!("Chassis Closed: {}", !intrusion.currently_open); println!("Input Deck State: {:?}", status.state); println!("Touchpad present: {}", status.touchpad_present); + println!("SLEEP# GPIO high: {}", sleep_l); println!("Positions:"); println!(" Pos 0: {:?}", status.top_row.pos0); println!(" Pos 1: {:?}", status.top_row.pos1); From df72eb6e9657f23f4d43edd68a8e1b5a738d6577 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 18 Jun 2025 13:39:50 +0800 Subject: [PATCH 05/34] --versions: Add OS and tool version It's useful to know which Linux/FreeBSD kernel or windows version people are running when reporting an issue. Example: ``` > sudo framework_tool --versions Tool Version: 0.4.3 OS Version: Linux 6.15.1 #1-NixOS SMP PREEMPT_DYNAMIC Wed Jun 4 12:46:27 UTC 2025 x86_64 ``` Signed-off-by: Daniel Schaefer --- Cargo.lock | 16 ++++++++++++++ framework_lib/Cargo.toml | 1 + framework_lib/src/commandline/mod.rs | 3 +++ framework_lib/src/os_specific.rs | 33 ++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index f6c79ef..25672fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -435,6 +435,7 @@ dependencies = [ "uefi", "uefi-services", "windows 0.59.0", + "windows-version", "wmi", ] @@ -1559,6 +1560,12 @@ dependencies = [ "syn 2.0.98", ] +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + [[package]] name = "windows-result" version = "0.3.0" @@ -1642,6 +1649,15 @@ dependencies = [ "windows_x86_64_msvc 0.53.0", ] +[[package]] +name = "windows-version" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e04a5c6627e310a23ad2358483286c7df260c964eb2d003d8efd6d0f4e79265c" +dependencies = [ + "windows-link", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.0" diff --git a/framework_lib/Cargo.toml b/framework_lib/Cargo.toml index b3af9f2..a440d75 100644 --- a/framework_lib/Cargo.toml +++ b/framework_lib/Cargo.toml @@ -49,6 +49,7 @@ env_logger = "0.11" clap = { version = "4.5", features = ["derive", "cargo"] } clap-num = { version = "1.2.0" } clap-verbosity-flag = { version = "2.2.1" } +windows-version = "0.1.4" [target.'cfg(unix)'.dependencies] libc = "0.2.155" diff --git a/framework_lib/src/commandline/mod.rs b/framework_lib/src/commandline/mod.rs index 602ca09..7839086 100644 --- a/framework_lib/src/commandline/mod.rs +++ b/framework_lib/src/commandline/mod.rs @@ -49,6 +49,7 @@ use crate::ec_binary; use crate::esrt; #[cfg(feature = "rusb")] use crate::inputmodule::check_inputmodule_version; +use crate::os_specific; use crate::power; use crate::smbios; use crate::smbios::ConfigDigit0; @@ -374,6 +375,8 @@ fn print_stylus_battery_level() { } fn print_versions(ec: &CrosEc) { + println!("Tool Version: {}", built_info::PKG_VERSION); + println!("OS Version: {}", os_specific::get_os_version()); println!("Mainboard Hardware"); if let Some(ver) = smbios::get_product_name() { println!(" Type: {}", ver); diff --git a/framework_lib/src/os_specific.rs b/framework_lib/src/os_specific.rs index 83ae2f3..b77deb8 100644 --- a/framework_lib/src/os_specific.rs +++ b/framework_lib/src/os_specific.rs @@ -3,6 +3,39 @@ #[cfg(not(feature = "uefi"))] use std::{thread, time}; +#[cfg(feature = "uefi")] +use alloc::string::{String, ToString}; + +// Could report the implemented UEFI spec version +// But that's not very useful. Just look at the BIOS version +// But at least it's useful to see that the tool was run on UEFI +#[cfg(feature = "uefi")] +pub fn get_os_version() -> String { + "UEFI".to_string() +} + +#[cfg(target_family = "windows")] +pub fn get_os_version() -> String { + let ver = windows_version::OsVersion::current(); + format!("{}.{}.{}.{}", ver.major, ver.minor, ver.pack, ver.build) +} + +#[cfg(target_family = "unix")] +pub fn get_os_version() -> String { + if let Ok(uts) = nix::sys::utsname::uname() { + // uname -a without hostname + format!( + "{} {} {} {}", + uts.sysname().to_string_lossy(), + uts.release().to_string_lossy(), + uts.version().to_string_lossy(), + uts.machine().to_string_lossy(), + ) + } else { + "Unknown".to_string() + } +} + /// Sleep a number of microseconds pub fn sleep(micros: u64) { #[cfg(not(feature = "uefi"))] From d10a7825dd089caea4ee9b095e408e7f9ef51e0b Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Thu, 26 Jun 2025 00:55:14 +0800 Subject: [PATCH 06/34] Add support for EC_CD_AP_RESET Signed-off-by: Daniel Schaefer --- framework_lib/src/chromium_ec/command.rs | 1 + framework_lib/src/chromium_ec/commands.rs | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/framework_lib/src/chromium_ec/command.rs b/framework_lib/src/chromium_ec/command.rs index e009a9e..df433da 100644 --- a/framework_lib/src/chromium_ec/command.rs +++ b/framework_lib/src/chromium_ec/command.rs @@ -53,6 +53,7 @@ pub enum EcCommands { /// Get information about PD controller power UsbPdPowerInfo = 0x0103, AdcRead = 0x0123, + ApReset = 0x0125, RgbKbdSetColor = 0x013A, RgbKbd = 0x013B, diff --git a/framework_lib/src/chromium_ec/commands.rs b/framework_lib/src/chromium_ec/commands.rs index 0a367ab..65f3748 100644 --- a/framework_lib/src/chromium_ec/commands.rs +++ b/framework_lib/src/chromium_ec/commands.rs @@ -879,6 +879,15 @@ impl EcRequest for EcRequestAdcRead { } } +#[repr(C)] +pub struct EcRequestApReset {} + +impl EcRequest<()> for EcRequestApReset { + fn command_id() -> EcCommands { + EcCommands::ApReset + } +} + // TODO: Actually 128, but if we go above ~80 EC returns REQUEST_TRUNCATED // At least when I use the portio driver pub const EC_RGBKBD_MAX_KEY_COUNT: usize = 64; From 1acf72b21aa5e1c2670dc0fd3d7d88d914e86ece Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Thu, 26 Jun 2025 00:55:40 +0800 Subject: [PATCH 07/34] Add support for EC_CMD_REBOOT_AP_ON_G3 Reset AP after entering G3 by the EC after configurable delay. V0 resets immediately. Signed-off-by: Daniel Schaefer --- framework_lib/src/chromium_ec/command.rs | 2 ++ framework_lib/src/chromium_ec/commands.rs | 27 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/framework_lib/src/chromium_ec/command.rs b/framework_lib/src/chromium_ec/command.rs index df433da..608f29b 100644 --- a/framework_lib/src/chromium_ec/command.rs +++ b/framework_lib/src/chromium_ec/command.rs @@ -54,6 +54,8 @@ pub enum EcCommands { UsbPdPowerInfo = 0x0103, AdcRead = 0x0123, ApReset = 0x0125, + LocateChip = 0x0126, + RebootApOnG3 = 0x0127, RgbKbdSetColor = 0x013A, RgbKbd = 0x013B, diff --git a/framework_lib/src/chromium_ec/commands.rs b/framework_lib/src/chromium_ec/commands.rs index 65f3748..48763c0 100644 --- a/framework_lib/src/chromium_ec/commands.rs +++ b/framework_lib/src/chromium_ec/commands.rs @@ -888,6 +888,33 @@ impl EcRequest<()> for EcRequestApReset { } } +#[repr(C)] +pub struct EcRequestRebootApOnG3V0 {} + +impl EcRequest<()> for EcRequestRebootApOnG3V0 { + fn command_id() -> EcCommands { + EcCommands::RebootApOnG3 + } + fn command_version() -> u8 { + 0 + } +} + +#[repr(C)] +pub struct EcRequestRebootApOnG3V1 { + /// Delay in seconds after entering G3 state + pub delay: u32, +} + +impl EcRequest<()> for EcRequestRebootApOnG3V1 { + fn command_id() -> EcCommands { + EcCommands::RebootApOnG3 + } + fn command_version() -> u8 { + 1 + } +} + // TODO: Actually 128, but if we go above ~80 EC returns REQUEST_TRUNCATED // At least when I use the portio driver pub const EC_RGBKBD_MAX_KEY_COUNT: usize = 64; From 7424ad0c22d6d8a614e34c879d3b2dd229649701 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 27 Jun 2025 15:05:58 +0800 Subject: [PATCH 08/34] clippy: Ignore uninlined_format_args See: https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args Recently introduced - I think it looks a bit messier inline. Signed-off-by: Daniel Schaefer --- framework_lib/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/framework_lib/src/lib.rs b/framework_lib/src/lib.rs index 93d91e2..05adf8f 100644 --- a/framework_lib/src/lib.rs +++ b/framework_lib/src/lib.rs @@ -1,6 +1,7 @@ //! A library to interact with [Framework Computer](https://frame.work) hardware and building tools to do so. #![cfg_attr(feature = "uefi", no_std)] +#![allow(clippy::uninlined_format_args)] extern crate alloc; #[cfg(feature = "uefi")] From aa3638888d2606fb6f3e32c99a38fdb559fbb3b4 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 27 Jun 2025 06:05:45 +0800 Subject: [PATCH 09/34] Current and charge rate limit cannot be read Signed-off-by: Daniel Schaefer --- framework_lib/src/commandline/clap_std.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/framework_lib/src/commandline/clap_std.rs b/framework_lib/src/commandline/clap_std.rs index 6d7f50e..600efa7 100644 --- a/framework_lib/src/commandline/clap_std.rs +++ b/framework_lib/src/commandline/clap_std.rs @@ -167,14 +167,14 @@ struct ClapCli { #[arg(long)] charge_limit: Option>, - /// Get or set max charge current limit + /// Set max charge current limit #[arg(long)] - #[clap(num_args = ..=2)] + #[clap(num_args = 1..=2)] charge_current_limit: Vec, - /// Get or set max charge current limit + /// Set max charge current limit #[arg(long)] - #[clap(num_args = ..=2)] + #[clap(num_args = 1..=2)] charge_rate_limit: Vec, /// Get GPIO value by name or all, if no name provided From 1b64d90a3474e0bb0ecea9a3623b18b792f39739 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Tue, 1 Jul 2025 10:43:15 +0800 Subject: [PATCH 10/34] uefi: Fix shell args when run from a script The UEFI tool wouldn't get any arugments when run from a UEFI shell script. Manually runnning from the shell would work, but not from e.g. startup.nsh Signed-off-by: Daniel Schaefer --- framework_lib/src/commandline/uefi.rs | 40 ++++----------------------- framework_uefi/src/main.rs | 4 +-- 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/framework_lib/src/commandline/uefi.rs b/framework_lib/src/commandline/uefi.rs index 82d6c25..1ab5530 100644 --- a/framework_lib/src/commandline/uefi.rs +++ b/framework_lib/src/commandline/uefi.rs @@ -6,8 +6,7 @@ use alloc::vec::Vec; use log::{debug, error, info, trace}; use uefi::prelude::BootServices; use uefi::proto::shell_params::*; -use uefi::table::boot::{OpenProtocolAttributes, OpenProtocolParams, SearchType}; -use uefi::Identify; +use uefi::Handle; use crate::chromium_ec::commands::SetGpuSerialMagic; use crate::chromium_ec::{CrosEcDriverType, HardwareDeviceType}; @@ -16,40 +15,13 @@ use crate::commandline::Cli; use super::{ConsoleArg, FpBrightnessArg, InputDeckModeArg, RebootEcArg, TabletModeArg}; /// Get commandline arguments from UEFI environment -pub fn get_args(boot_services: &BootServices) -> Vec { - // TODO: I think i should open this from the ImageHandle? - let shell_params_h = - boot_services.locate_handle_buffer(SearchType::ByProtocol(&ShellParameters::GUID)); - let shell_params_h = if let Ok(shell_params_h) = shell_params_h { - shell_params_h +pub fn get_args(bs: &BootServices, image_handle: Handle) -> Vec { + if let Ok(shell_params) = bs.open_protocol_exclusive::(image_handle) { + shell_params.get_args() } else { - error!("ShellParameters protocol not found"); - return vec![]; - }; - - for handle in &*shell_params_h { - let params_handle = unsafe { - boot_services - .open_protocol::( - OpenProtocolParams { - handle: *handle, - agent: boot_services.image_handle(), - controller: None, - }, - OpenProtocolAttributes::GetProtocol, - ) - .expect("Failed to open ShellParameters handle") - }; - - // Ehm why are there two and one has no args? - // Maybe one is the shell itself? - if params_handle.argc == 0 { - continue; - } - - return params_handle.get_args(); + // No protocol found if the application wasn't executed by the shell + vec![] } - vec![] } pub fn parse(args: &[String]) -> Cli { diff --git a/framework_uefi/src/main.rs b/framework_uefi/src/main.rs index b81cbe6..caeeee2 100644 --- a/framework_uefi/src/main.rs +++ b/framework_uefi/src/main.rs @@ -12,11 +12,11 @@ extern crate alloc; use framework_lib::commandline; #[entry] -fn main(_handle: Handle, mut system_table: SystemTable) -> Status { +fn main(image_handle: Handle, mut system_table: SystemTable) -> Status { uefi_services::init(&mut system_table).unwrap(); let bs = system_table.boot_services(); - let args = commandline::uefi::get_args(bs); + let args = commandline::uefi::get_args(bs, image_handle); let args = commandline::parse(&args); if commandline::run_with_args(&args, false) == 0 { return Status::SUCCESS; From 902e2fae8e46db83c3488fc54c147c3ff9808e5c Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Tue, 1 Jul 2025 10:44:03 +0800 Subject: [PATCH 11/34] framework_uefi: Add startup.nsh Make it easy to test execution from a script Signed-off-by: Daniel Schaefer --- framework_uefi/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/framework_uefi/Makefile b/framework_uefi/Makefile index a571ba1..76b03e5 100644 --- a/framework_uefi/Makefile +++ b/framework_uefi/Makefile @@ -38,6 +38,9 @@ $(BUILD)/efi.img: $(BUILD)/boot.efi mkfs.vfat $@.tmp mmd -i $@.tmp efi mmd -i $@.tmp efi/boot + echo 'efi\boot\bootx64.efi --version' > startup.nsh + mcopy -i $@.tmp startup.nsh ::efi/boot/startup.nsh + rm -f startup.nsh mcopy -i $@.tmp $< ::efi/boot/bootx64.efi mv $@.tmp $@ From 7eb45087a7e54583cf8a52987cce0809e37814d9 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Tue, 1 Jul 2025 10:52:02 +0800 Subject: [PATCH 12/34] Bump to v0.4.4 Signed-off-by: Daniel Schaefer --- Cargo.lock | 6 +++--- framework_lib/Cargo.toml | 2 +- framework_tool/Cargo.toml | 2 +- framework_uefi/Cargo.toml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f6c79ef..8bac508 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -408,7 +408,7 @@ dependencies = [ [[package]] name = "framework_lib" -version = "0.4.3" +version = "0.4.4" dependencies = [ "built", "clap", @@ -440,7 +440,7 @@ dependencies = [ [[package]] name = "framework_tool" -version = "0.4.3" +version = "0.4.4" dependencies = [ "embed-resource", "framework_lib", @@ -451,7 +451,7 @@ dependencies = [ [[package]] name = "framework_uefi" -version = "0.4.3" +version = "0.4.4" dependencies = [ "framework_lib", "log", diff --git a/framework_lib/Cargo.toml b/framework_lib/Cargo.toml index b3af9f2..770b7b1 100644 --- a/framework_lib/Cargo.toml +++ b/framework_lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework_lib" -version = "0.4.3" +version = "0.4.4" description = "Library to control Framework Computer systems" homepage = "https://github.com/FrameworkComputer/framework-system" repository = "https://github.com/FrameworkComputer/framework-system" diff --git a/framework_tool/Cargo.toml b/framework_tool/Cargo.toml index cdd90a2..0443f3e 100644 --- a/framework_tool/Cargo.toml +++ b/framework_tool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework_tool" -version = "0.4.3" +version = "0.4.4" description = "Tool to control Framework Computer systems" homepage = "https://github.com/FrameworkComputer/framework-system" repository = "https://github.com/FrameworkComputer/framework-system" diff --git a/framework_uefi/Cargo.toml b/framework_uefi/Cargo.toml index adc8b14..f0098cb 100644 --- a/framework_uefi/Cargo.toml +++ b/framework_uefi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework_uefi" -version = "0.4.3" +version = "0.4.4" description = "UEFI Tool to control Framework Computer systems" homepage = "https://github.com/FrameworkComputer/framework-system" repository = "https://github.com/FrameworkComputer/framework-system" From 438f9dc603254160274d86900bdfc6bad6ed8e9a Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 10 May 2025 09:25:23 +0800 Subject: [PATCH 13/34] Cli: Derive Default So that we can instantiate Cli to a safe default with everything disabled. Signed-off-by: Daniel Schaefer --- framework_lib/src/commandline/clap_std.rs | 4 ++-- framework_lib/src/commandline/mod.rs | 17 +++++++++++++---- framework_lib/src/commandline/uefi.rs | 14 +++++++------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/framework_lib/src/commandline/clap_std.rs b/framework_lib/src/commandline/clap_std.rs index 600efa7..a26aa4b 100644 --- a/framework_lib/src/commandline/clap_std.rs +++ b/framework_lib/src/commandline/clap_std.rs @@ -9,7 +9,7 @@ use clap_num::maybe_hex; use crate::chromium_ec::commands::SetGpuSerialMagic; use crate::chromium_ec::CrosEcDriverType; use crate::commandline::{ - Cli, ConsoleArg, FpBrightnessArg, HardwareDeviceType, InputDeckModeArg, RebootEcArg, + Cli, ConsoleArg, FpBrightnessArg, HardwareDeviceType, InputDeckModeArg, LogLevel, RebootEcArg, TabletModeArg, }; @@ -381,7 +381,7 @@ pub fn parse(args: &[String]) -> Cli { }; Cli { - verbosity: args.verbosity.log_level_filter(), + verbosity: LogLevel(args.verbosity.log_level_filter()), versions: args.versions, version: args.version, features: args.features, diff --git a/framework_lib/src/commandline/mod.rs b/framework_lib/src/commandline/mod.rs index 602ca09..2c2922b 100644 --- a/framework_lib/src/commandline/mod.rs +++ b/framework_lib/src/commandline/mod.rs @@ -134,13 +134,22 @@ impl From for DeckStateMode { } } +#[derive(Debug)] +pub struct LogLevel(log::LevelFilter); + +impl Default for LogLevel { + fn default() -> Self { + LogLevel(log::LevelFilter::Error) + } +} + /// Shadows `clap_std::ClapCli` with extras for UEFI /// /// The UEFI commandline currently doesn't use clap, so we need to shadow the struct. /// Also it has extra options. -#[derive(Debug)] +#[derive(Debug, Default)] pub struct Cli { - pub verbosity: log::LevelFilter, + pub verbosity: LogLevel, pub versions: bool, pub version: bool, pub features: bool, @@ -815,7 +824,7 @@ fn compare_version(device: Option, version: String, ec: &Cro pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 { #[cfg(feature = "uefi")] { - log::set_max_level(args.verbosity); + log::set_max_level(args.verbosity.0); } #[cfg(not(feature = "uefi"))] { @@ -824,7 +833,7 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 { // .filter("FRAMEWORK_COMPUTER_LOG") // .write_style("FRAMEWORK_COMPUTER_LOG_STYLE"); - let level = args.verbosity.as_str(); + let level = args.verbosity.0.as_str(); env_logger::Builder::from_env(env_logger::Env::default().default_filter_or(level)) .format_target(false) .format_timestamp(None) diff --git a/framework_lib/src/commandline/uefi.rs b/framework_lib/src/commandline/uefi.rs index 1ab5530..2a18cab 100644 --- a/framework_lib/src/commandline/uefi.rs +++ b/framework_lib/src/commandline/uefi.rs @@ -10,7 +10,7 @@ use uefi::Handle; use crate::chromium_ec::commands::SetGpuSerialMagic; use crate::chromium_ec::{CrosEcDriverType, HardwareDeviceType}; -use crate::commandline::Cli; +use crate::commandline::{Cli, LogLevel}; use super::{ConsoleArg, FpBrightnessArg, InputDeckModeArg, RebootEcArg, TabletModeArg}; @@ -26,7 +26,7 @@ pub fn get_args(bs: &BootServices, image_handle: Handle) -> Vec { pub fn parse(args: &[String]) -> Cli { let mut cli = Cli { - verbosity: log::LevelFilter::Error, + verbosity: LogLevel(log::LevelFilter::Error), paginate: false, versions: false, version: false, @@ -103,15 +103,15 @@ pub fn parse(args: &[String]) -> Cli { for (i, arg) in args.iter().enumerate() { if arg == "-q" { - cli.verbosity = log::LevelFilter::Off; + cli.verbosity = LogLevel(log::LevelFilter::Off); } else if arg == "-v" { - cli.verbosity = log::LevelFilter::Warn; + cli.verbosity = LogLevel(log::LevelFilter::Warn); } else if arg == "-vv" { - cli.verbosity = log::LevelFilter::Info; + cli.verbosity = LogLevel(log::LevelFilter::Info); } else if arg == "-vvv" { - cli.verbosity = log::LevelFilter::Debug; + cli.verbosity = LogLevel(log::LevelFilter::Debug); } else if arg == "-vvvv" { - cli.verbosity = log::LevelFilter::Trace; + cli.verbosity = LogLevel(log::LevelFilter::Trace); } else if arg == "--versions" { cli.versions = true; found_an_option = true; From 1f5c3464609ab768dd3a2a964c6b5b322448833e Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 10 May 2025 09:26:31 +0800 Subject: [PATCH 14/34] Add --feature readonly, to build a bin without risky commands ``` > cargo build --features readonly && sudo ./target/debug/framework_tool --dump-ec-flash ec.bin && ls -l ec.bin Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.09s ls: cannot access 'ec.bin': No such file or directory > cargo build && sudo ./target/debug/framework_tool --dump-ec-flash ec.bin && ls -l ec.bin Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.09s Dumping to ec.bin -rw-r--r--. 1 root root 524288 May 10 09:24 ec.bin ``` Signed-off-by: Daniel Schaefer --- framework_lib/Cargo.toml | 1 + framework_lib/src/commandline/mod.rs | 68 +++++++++++++++++++++++++++- framework_tool/Cargo.toml | 4 ++ framework_uefi/Cargo.toml | 4 ++ 4 files changed, 75 insertions(+), 2 deletions(-) diff --git a/framework_lib/Cargo.toml b/framework_lib/Cargo.toml index b3af9f2..97f3024 100644 --- a/framework_lib/Cargo.toml +++ b/framework_lib/Cargo.toml @@ -14,6 +14,7 @@ build = "build.rs" [features] default = ["hidapi", "rusb"] +readonly = [ ] rusb = ["dep:rusb"] hidapi = ["dep:hidapi"] uefi = [ "lazy_static/spin_no_std" ] diff --git a/framework_lib/src/commandline/mod.rs b/framework_lib/src/commandline/mod.rs index 2c2922b..9447558 100644 --- a/framework_lib/src/commandline/mod.rs +++ b/framework_lib/src/commandline/mod.rs @@ -221,9 +221,73 @@ pub struct Cli { pub fn parse(args: &[String]) -> Cli { #[cfg(feature = "uefi")] - return uefi::parse(args); + let cli = uefi::parse(args); #[cfg(not(feature = "uefi"))] - return clap_std::parse(args); + let cli = clap_std::parse(args); + + if cfg!(feature = "readonly") { + // Initialize a new Cli with no arguments + // Set all arguments that are readonly/safe + // We explicitly only cope the safe ones so that if we add new arguments in the future, + // which might be unsafe, we can't forget to exclude them from the safe set. + // TODO: Instead of silently ignoring blocked command, we should remind the user + Cli { + verbosity: cli.verbosity, + versions: cli.versions, + version: cli.version, + esrt: cli.esrt, + device: cli.device, + power: cli.power, + thermal: cli.thermal, + sensors: cli.sensors, + // fansetduty + // fansetrpm + // autofanctrl + privacy: cli.privacy, + pd_info: cli.version, + dp_hdmi_info: cli.dp_hdmi_info, + // dp_hdmi_update + audio_card_info: cli.audio_card_info, + pd_bin: cli.pd_bin, + ec_bin: cli.ec_bin, + capsule: cli.capsule, + dump: cli.dump, + h2o_capsule: cli.h2o_capsule, + // dump_ec_flash + // flash_ec + // flash_ro_ec + driver: cli.driver, + test: cli.test, + intrusion: cli.intrusion, + inputdeck: cli.inputdeck, + inputdeck_mode: cli.inputdeck_mode, + expansion_bay: cli.expansion_bay, + // charge_limit + // charge_current_limit + get_gpio: cli.get_gpio, + fp_led_level: cli.fp_led_level, + fp_brightness: cli.fp_brightness, + kblight: cli.kblight, + rgbkbd: cli.rgbkbd, + // tablet_mode + // touchscreen_enable + stylus_battery: cli.stylus_battery, + console: cli.console, + reboot_ec: cli.reboot_ec, + // ec_hib_delay + hash: cli.hash, + pd_addrs: cli.pd_addrs, + pd_ports: cli.pd_ports, + help: cli.help, + info: cli.info, + // allupdate + paginate: cli.paginate, + // raw_command + ..Default::default() + } + } else { + cli + } } fn print_single_pd_details(pd: &PdController) { diff --git a/framework_tool/Cargo.toml b/framework_tool/Cargo.toml index cdd90a2..2bc741d 100644 --- a/framework_tool/Cargo.toml +++ b/framework_tool/Cargo.toml @@ -12,6 +12,10 @@ edition = "2021" name = "framework_tool" path = "src/main.rs" +[features] +default = [ ] +readonly = [ "framework_lib/readonly" ] + [dependencies.framework_lib] path = "../framework_lib" diff --git a/framework_uefi/Cargo.toml b/framework_uefi/Cargo.toml index adc8b14..d27a759 100644 --- a/framework_uefi/Cargo.toml +++ b/framework_uefi/Cargo.toml @@ -14,6 +14,10 @@ rust-version = "1.74" name = "uefitool" path = "src/main.rs" +[features] +default = [ ] +readonly = [ "framework_lib/readonly" ] + [dependencies] uefi = { version = "0.20", features = ["alloc"] } uefi-services = "0.17" From acb91b9f8d48736aa98acc6eb82630cfaa8a1954 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Tue, 1 Jul 2025 14:00:03 +0800 Subject: [PATCH 15/34] Build and upload readonly version of UEFI app Signed-off-by: Daniel Schaefer --- .github/workflows/ci.yml | 10 +++++++--- framework_uefi/Makefile | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 61c0f70..0f5604d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,13 +77,17 @@ jobs: run: rustup show - name: Build UEFI application (no ESP) - run: make -C framework_uefi build/x86_64-unknown-uefi/boot.efi + run: | + make -C framework_uefi build/x86_64-unknown-uefi/boot.efi + mv framework_uefi/build/x86_64-unknown-uefi/boot.efi framework_tool_full.efi + make -C framework_uefi FEATURES=readonly build/x86_64-unknown-uefi/boot.efi + cp framework_uefi/build/x86_64-unknown-uefi/boot.efi framework_tool.efi - name: Upload UEFI App uses: actions/upload-artifact@v4 with: - name: framework.efi - path: framework_uefi/build/x86_64-unknown-uefi/boot.efi + name: framework_efi.zip + path: ./*.efi - name: Install mtools to build ESP and ISO (Linux) run: sudo apt-get install -y mtools genisoimage diff --git a/framework_uefi/Makefile b/framework_uefi/Makefile index 76b03e5..0814ff4 100644 --- a/framework_uefi/Makefile +++ b/framework_uefi/Makefile @@ -1,5 +1,6 @@ TARGET?=x86_64-unknown-uefi BUILD=build/$(TARGET) +FEATURES?='' SRC_DIR=. @@ -18,7 +19,7 @@ all: $(BUILD)/boot.img iso: $(BUILD)/UEFI-Shell-fwk.iso clean: - rm -r $(BUILD) + rm -rf $(BUILD) qemu: $(BUILD)/boot.img $(QEMU) $(QEMU_FLAGS) $< @@ -61,6 +62,7 @@ $(BUILD)/boot.efi: ../Cargo.lock $(SRC_DIR)/Cargo.toml $(SRC_DIR)/src/* mkdir -p $(BUILD) cargo rustc \ --target $(TARGET) \ + --features $(FEATURES) \ --release \ -- \ --emit link=framework_uefi/$@ From 4b2a935231688403c0f38f8d0356a3459beb0944 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 2 Jul 2025 10:11:58 +0800 Subject: [PATCH 16/34] Update blocklist of unsafe commands With newly added arguments Signed-off-by: Daniel Schaefer --- framework_lib/src/commandline/mod.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/framework_lib/src/commandline/mod.rs b/framework_lib/src/commandline/mod.rs index 9447558..265f679 100644 --- a/framework_lib/src/commandline/mod.rs +++ b/framework_lib/src/commandline/mod.rs @@ -235,16 +235,22 @@ pub fn parse(args: &[String]) -> Cli { verbosity: cli.verbosity, versions: cli.versions, version: cli.version, + features: cli.features, esrt: cli.esrt, device: cli.device, + compare_version: cli.compare_version, power: cli.power, thermal: cli.thermal, sensors: cli.sensors, // fansetduty // fansetrpm // autofanctrl + pdports: cli.pdports, privacy: cli.privacy, pd_info: cli.version, + // pd_reset + // pd_disable + // pd_enable dp_hdmi_info: cli.dp_hdmi_info, // dp_hdmi_update audio_card_info: cli.audio_card_info, @@ -256,19 +262,25 @@ pub fn parse(args: &[String]) -> Cli { // dump_ec_flash // flash_ec // flash_ro_ec + // flash_rw_ec driver: cli.driver, test: cli.test, + dry_run: cli.dry_run, + // force intrusion: cli.intrusion, inputdeck: cli.inputdeck, inputdeck_mode: cli.inputdeck_mode, expansion_bay: cli.expansion_bay, // charge_limit // charge_current_limit + // charge_rate_limit get_gpio: cli.get_gpio, fp_led_level: cli.fp_led_level, fp_brightness: cli.fp_brightness, kblight: cli.kblight, + remap_key: cli.remap_key, rgbkbd: cli.rgbkbd, + ps2_enable: cli.ps2_enable, // tablet_mode // touchscreen_enable stylus_battery: cli.stylus_battery, @@ -280,6 +292,8 @@ pub fn parse(args: &[String]) -> Cli { pd_ports: cli.pd_ports, help: cli.help, info: cli.info, + // flash_gpu_descriptor + // flash_gpu_descriptor_file // allupdate paginate: cli.paginate, // raw_command From 3b290e5786a0e4b9a9827c32dd4b733629b6892e Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 2 Jul 2025 10:18:03 +0800 Subject: [PATCH 17/34] Bump to 0.4.5 Signed-off-by: Daniel Schaefer --- Cargo.lock | 6 +++--- framework_lib/Cargo.toml | 2 +- framework_tool/Cargo.toml | 2 +- framework_uefi/Cargo.toml | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8bac508..feb3586 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -408,7 +408,7 @@ dependencies = [ [[package]] name = "framework_lib" -version = "0.4.4" +version = "0.4.5" dependencies = [ "built", "clap", @@ -440,7 +440,7 @@ dependencies = [ [[package]] name = "framework_tool" -version = "0.4.4" +version = "0.4.5" dependencies = [ "embed-resource", "framework_lib", @@ -451,7 +451,7 @@ dependencies = [ [[package]] name = "framework_uefi" -version = "0.4.4" +version = "0.4.5" dependencies = [ "framework_lib", "log", diff --git a/framework_lib/Cargo.toml b/framework_lib/Cargo.toml index 001dbcc..3ba39e3 100644 --- a/framework_lib/Cargo.toml +++ b/framework_lib/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework_lib" -version = "0.4.4" +version = "0.4.5" description = "Library to control Framework Computer systems" homepage = "https://github.com/FrameworkComputer/framework-system" repository = "https://github.com/FrameworkComputer/framework-system" diff --git a/framework_tool/Cargo.toml b/framework_tool/Cargo.toml index fa240e3..6dceeab 100644 --- a/framework_tool/Cargo.toml +++ b/framework_tool/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework_tool" -version = "0.4.4" +version = "0.4.5" description = "Tool to control Framework Computer systems" homepage = "https://github.com/FrameworkComputer/framework-system" repository = "https://github.com/FrameworkComputer/framework-system" diff --git a/framework_uefi/Cargo.toml b/framework_uefi/Cargo.toml index 6c73a81..1995042 100644 --- a/framework_uefi/Cargo.toml +++ b/framework_uefi/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "framework_uefi" -version = "0.4.4" +version = "0.4.5" description = "UEFI Tool to control Framework Computer systems" homepage = "https://github.com/FrameworkComputer/framework-system" repository = "https://github.com/FrameworkComputer/framework-system" From 0bd4f5ce34bb2bc9ac9bf59beebfdb4d2449f7d2 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 23 Jul 2025 16:04:07 +0800 Subject: [PATCH 18/34] --inputdeck: Try Framework 16 if can't detect system type In some cases we can't detect the system type, but if sleep_l GPIO is present, we know it's a Framework 16. Signed-off-by: Daniel Schaefer --- framework_lib/src/commandline/mod.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/framework_lib/src/commandline/mod.rs b/framework_lib/src/commandline/mod.rs index 265f679..d96cc0c 100644 --- a/framework_lib/src/commandline/mod.rs +++ b/framework_lib/src/commandline/mod.rs @@ -980,7 +980,16 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 { Some(PlatformFamily::Framework12) => ec.print_fw12_inputdeck_status(), Some(PlatformFamily::Framework13) => ec.print_fw13_inputdeck_status(), Some(PlatformFamily::Framework16) => ec.print_fw16_inputdeck_status(), - _ => Ok(()), + // If we don't know which platform it is, we can use some heuristics + _ => { + // Only Framework 16 has this GPIO + if ec.get_gpio("sleep_l").is_ok() { + ec.print_fw16_inputdeck_status() + } else { + println!(" Unable to tell"); + Ok(()) + } + } }; print_err(res); } else if let Some(mode) = &args.inputdeck_mode { From fd71dac89899a3ca5700e084008341da3a2a1744 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Thu, 24 Jul 2025 21:57:33 +0800 Subject: [PATCH 19/34] devenv: Add dependencies to build and run uefi tool in QEMU Signed-off-by: Daniel Schaefer --- devenv.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/devenv.nix b/devenv.nix index 413d6a6..e84d152 100644 --- a/devenv.nix +++ b/devenv.nix @@ -3,9 +3,16 @@ { packages = with pkgs; [ systemd # libudev + # For UEFI building and testing + parted + gnumake + qemu ]; - languages.rust.enable = true; - # https://devenv.sh/reference/options/#languagesrustchannel - languages.rust.channel = "stable"; + languages.rust = { + enable = true; + targets = [ "x86_64-unknown-uefi" ]; + # https://devenv.sh/reference/options/#languagesrustchannel + channel = "stable"; + }; } From 3bae3bc285436d825548be03a3f9c7968e5b0fca Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 1 Aug 2025 18:06:25 +0800 Subject: [PATCH 20/34] Add PID For internal test purposes. Signed-off-by: Daniel Schaefer --- framework_lib/src/inputmodule.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/framework_lib/src/inputmodule.rs b/framework_lib/src/inputmodule.rs index 4e28006..43a7ad5 100644 --- a/framework_lib/src/inputmodule.rs +++ b/framework_lib/src/inputmodule.rs @@ -6,6 +6,7 @@ pub const FRAMEWORK16_INPUTMODULE_PIDS: [u16; 6] = [ 0x0014, // Keyboard White Backlight Numpad 0x0018, // Keyboard White Backlight ISO 0x0019, // Keyboard White Backlight JIS + 0x0030, LEDMATRIX_PID, ]; From 77ca7a2a1982b22d834d224f0b53c072b027b558 Mon Sep 17 00:00:00 2001 From: tripplehelix Date: Fri, 1 Aug 2025 17:02:32 +0100 Subject: [PATCH 21/34] framework_lib: Fix array length --- framework_lib/src/inputmodule.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework_lib/src/inputmodule.rs b/framework_lib/src/inputmodule.rs index 43a7ad5..f9e6cc0 100644 --- a/framework_lib/src/inputmodule.rs +++ b/framework_lib/src/inputmodule.rs @@ -1,6 +1,6 @@ pub const FRAMEWORK_VID: u16 = 0x32AC; pub const LEDMATRIX_PID: u16 = 0x0020; -pub const FRAMEWORK16_INPUTMODULE_PIDS: [u16; 6] = [ +pub const FRAMEWORK16_INPUTMODULE_PIDS: [u16; 7] = [ 0x0012, // Keyboard White Backlight ANSI 0x0013, // Keyboard RGB Backlight Numpad 0x0014, // Keyboard White Backlight Numpad From 9b28ae42bc4e7bab3fce5ac0890058ed649b121e Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Wed, 6 Aug 2025 13:22:52 +0800 Subject: [PATCH 22/34] gh-actions: Also upload linux release build (#194) Signed-off-by: Daniel Schaefer --- .github/workflows/ci.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f5604d..c22589d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,9 +62,18 @@ jobs: - name: Upload Linux App uses: actions/upload-artifact@v4 with: - name: framework_tool + name: framework_tool_debug path: target/debug/framework_tool + - name: Build Linux tool (Release) + run: cargo build -p framework_tool --release + + - name: Upload Linux App + uses: actions/upload-artifact@v4 + with: + name: framework_tool + path: target/release/framework_tool + build-uefi: name: Build UEFI runs-on: ubuntu-24.04 From 4ab51be489c612dbb20e5adfcf1b55df8bde0c15 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Thu, 7 Aug 2025 19:32:15 +0800 Subject: [PATCH 23/34] Framework 13 and 16 AMD Ryzen 7040 Windows driver (#197) ACPI device included in new BIOS to let the windows driver load. Signed-off-by: Daniel Schaefer --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c40160a..0c72bef 100644 --- a/README.md +++ b/README.md @@ -27,18 +27,18 @@ On UEFI and FreeBSD raw port I/O is used - on Linux this can also be used as a f | | Port I/O | Linux | Windows | |---------------------|----------| ------|---------| | Framework 12 | | | | -| Intel Core 12th Gen | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Yes | +| Intel Core 12th Gen | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Yes | | Framework 13 | | | | -| Intel Core 11th Gen | Yes | [6.11](https://github.com/torvalds/linux/commit/04ca0a51f1e63bd553fd4af8e9af0fe094fa4f0a) | Not yet | -| Intel Core 12th Gen | Yes | [6.13](https://github.com/torvalds/linux/commit/dcd59d0d7d51b2a4b768fc132b0d74a97dfd6d6a) | Not yet | -| Intel Core 13th Gen | Yes | [6.13](https://github.com/torvalds/linux/commit/dcd59d0d7d51b2a4b768fc132b0d74a97dfd6d6a) | Not yet | -| AMD Ryzen 7040 | Yes | [6.10](https://github.com/torvalds/linux/commit/c8f460d991df93d87de01a96b783cad5a2da9616) | Soon | -| Intel Core Ultra 1S | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Soon | -| AMD Ryzen AI 300 | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Yes | +| Intel Core 11th Gen | Yes | [6.11](https://github.com/torvalds/linux/commit/04ca0a51f1e63bd553fd4af8e9af0fe094fa4f0a) | Not yet | +| Intel Core 12th Gen | Yes | [6.13](https://github.com/torvalds/linux/commit/dcd59d0d7d51b2a4b768fc132b0d74a97dfd6d6a) | Not yet | +| Intel Core 13th Gen | Yes | [6.13](https://github.com/torvalds/linux/commit/dcd59d0d7d51b2a4b768fc132b0d74a97dfd6d6a) | Not yet | +| AMD Ryzen 7040 | Yes | [6.10](https://github.com/torvalds/linux/commit/c8f460d991df93d87de01a96b783cad5a2da9616) | BIOS 3.16+ | +| Intel Core Ultra 1S | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Soon | +| AMD Ryzen AI 300 | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Yes | | Framework 16 | | | | -| AMD Ryzen 7040 | Yes | [6.10](https://github.com/torvalds/linux/commit/c8f460d991df93d87de01a96b783cad5a2da9616) | Soon | +| AMD Ryzen 7040 | Yes | [6.10](https://github.com/torvalds/linux/commit/c8f460d991df93d87de01a96b783cad5a2da9616) | BIOS 3.06+ | | Framework Desktop | | | | -| AMD Ryzen AI Max | Yes | [6.15](https://github.com/torvalds/linux/commit/d83c45aeec9b223fe6db4175e9d1c4f5699cc37a) | Yes | +| AMD Ryzen AI Max | Yes | [6.15](https://github.com/torvalds/linux/commit/d83c45aeec9b223fe6db4175e9d1c4f5699cc37a) | Yes | ###### Firmware Information From 655936854924c287da7c0a0e97cc578b10f7ccd6 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Mon, 11 Aug 2025 16:23:28 +0800 Subject: [PATCH 24/34] Return unnecessary return statements (#199) Recent cargo lint warns about it Signed-off-by: Daniel Schaefer --- framework_lib/src/commandline/mod.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/framework_lib/src/commandline/mod.rs b/framework_lib/src/commandline/mod.rs index 8644026..06edb01 100644 --- a/framework_lib/src/commandline/mod.rs +++ b/framework_lib/src/commandline/mod.rs @@ -1683,7 +1683,6 @@ fn analyze_ccgx_pd_fw(data: &[u8]) { println!("FW 2"); ccgx::binary::print_fw(&versions.main_fw); - return; } else if let Some(versions) = ccgx::binary::read_versions(data, Ccg6) { println!("Detected CCG6 firmware"); println!("FW 1 (Backup)"); @@ -1691,7 +1690,6 @@ fn analyze_ccgx_pd_fw(data: &[u8]) { println!("FW 2 (Main)"); ccgx::binary::print_fw(&versions.main_fw); - return; } else { println!("Failed to read PD versions") } From 56522d2d463e2dcbb77dc8d163a1e37cbb09d95a Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 15 Aug 2025 08:33:43 +0800 Subject: [PATCH 25/34] EXAMPLES_ADVANCED: Document --tablet-mode (#200) Signed-off-by: Daniel Schaefer --- EXAMPLES_ADVANCED.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/EXAMPLES_ADVANCED.md b/EXAMPLES_ADVANCED.md index 0ece899..8e938e1 100644 --- a/EXAMPLES_ADVANCED.md +++ b/EXAMPLES_ADVANCED.md @@ -39,7 +39,7 @@ Left / Ports 23 > sudo framework_tool --pd-enable 0 ``` -### Check EFI Resource Table +## Check EFI Resource Table On Framework Desktop: @@ -60,6 +60,30 @@ ESRT Entry 0 Last Attempt Status: Success ``` +## Manually overriding tablet mode status + +If you have a suspicion that the embedded controller does not control tablet +mode correctly based on Hall and G-Sensor, you can manually force a mode. + +This may also be useful if you want to use the touchpad and keyboard while the +lid is folded back - for example if you're using an external display only (Cyberdeck). +In this case you can force laptop mode. + +Tablet mode: +- Sets a GPIO connected to the touchpad to disable it +- Stops the EC from sending keypresses to the CPU + +``` +# Force tablet mode to disable touchpad and keyboard +> framework_tool --tablet-mode tablet + +# Force laptop mode to always keep touchpad and keyboard enabled +> framework_tool --tablet-mode laptop + +# Let the EC handle tablet mode automatically based on sensors +> framework_tool --tablet-mode auto +``` + ## Flashing EC firmware **IMPORTANT** Flashing EC firmware yourself is not recommended. It may render From 440157c6a375a6daee250cd7638551a2a6054357 Mon Sep 17 00:00:00 2001 From: quinchou Date: Wed, 20 Aug 2025 22:15:00 +0800 Subject: [PATCH 26/34] usbhub: Print firmware version of usb hub (#202) For example on Framework Desktop: [...] USB Hub RTL5424 Firmware Version: 1.8.8 [...] --- framework_lib/src/commandline/mod.rs | 5 +++++ framework_lib/src/lib.rs | 2 ++ framework_lib/src/usbhub.rs | 26 ++++++++++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 framework_lib/src/usbhub.rs diff --git a/framework_lib/src/commandline/mod.rs b/framework_lib/src/commandline/mod.rs index 06edb01..646ea8d 100644 --- a/framework_lib/src/commandline/mod.rs +++ b/framework_lib/src/commandline/mod.rs @@ -60,6 +60,8 @@ use crate::touchpad::print_touchpad_fw_ver; use crate::touchscreen; #[cfg(feature = "uefi")] use crate::uefi::enable_page_break; +#[cfg(feature = "rusb")] +use crate::usbhub::check_usbhub_version; use crate::util::{self, Config, Platform, PlatformFamily}; #[cfg(feature = "hidapi")] use hidapi::HidApi; @@ -705,6 +707,9 @@ fn print_versions(ec: &CrosEc) { #[cfg(feature = "rusb")] let _ignore_err = check_camera_version(); + #[cfg(feature = "rusb")] + let _ignore_err = check_usbhub_version(); + #[cfg(feature = "rusb")] let _ignore_err = check_inputmodule_version(); diff --git a/framework_lib/src/lib.rs b/framework_lib/src/lib.rs index 05adf8f..f205403 100644 --- a/framework_lib/src/lib.rs +++ b/framework_lib/src/lib.rs @@ -25,6 +25,8 @@ pub mod touchpad; pub mod touchscreen; #[cfg(all(feature = "hidapi", windows))] pub mod touchscreen_win; +#[cfg(feature = "rusb")] +pub mod usbhub; #[cfg(feature = "uefi")] #[macro_use] diff --git a/framework_lib/src/usbhub.rs b/framework_lib/src/usbhub.rs new file mode 100644 index 0000000..53f2557 --- /dev/null +++ b/framework_lib/src/usbhub.rs @@ -0,0 +1,26 @@ +pub const REALTEK_VID: u16 = 0x0BDA; +pub const RTL5432_PID: u16 = 0x5432; +pub const RTL5424_PID: u16 = 0x5424; + +/// Get and print the firmware version of the usbhub +pub fn check_usbhub_version() -> Result<(), rusb::Error> { + for dev in rusb::devices().unwrap().iter() { + let dev_descriptor = dev.device_descriptor().unwrap(); + if dev_descriptor.vendor_id() != REALTEK_VID + || (dev_descriptor.product_id() != RTL5432_PID + && dev_descriptor.product_id() != RTL5424_PID) + { + debug!( + "Skipping {:04X}:{:04X}", + dev_descriptor.vendor_id(), + dev_descriptor.product_id() + ); + continue; + } + + let dev_descriptor = dev.device_descriptor()?; + println!("USB Hub RTL{:04X}", dev_descriptor.product_id()); + println!(" Firmware Version: {}", dev_descriptor.device_version()); + } + Ok(()) +} From 0dde5cda9d19d5e2e739624bd80f7bdd15827843 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Mon, 18 Aug 2025 13:21:31 +0800 Subject: [PATCH 27/34] README: Document installation on distros Signed-off-by: Daniel Schaefer --- README.md | 51 ++++++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 0c72bef..69e52ab 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,33 @@ The tool works on Linux, Windows and the UEFI shell. Download it from the latest [GH Actions](https://github.com/FrameworkComputer/framework-system/actions?query=branch%3Amain) run on the main branch. Most features are supported on every "OS". See below for details. +## Installation + +### Linux + +- [NixOS](https://github.com/NixOS/nixpkgs/blob/nixos-25.05/pkgs/by-name/fr/framework-tool/package.nix) + - `nix-shell -p framework-tool` +- [ArchLinux](https://archlinux.org/packages/extra/x86_64/framework-system/) + - `pacman -Sy framework-system` +- [Bazzite](https://github.com/ublue-os/bazzite/pull/3026) +- Others + - Build from source + - Or download [latest binary](https://github.com/FrameworkComputer/framework-system/releases/latest/download/framework_tool) +- ChromeOS + - Build from source + +### Windows + +``` +winget install FrameworkComputer.framework_tool +``` + +### FreeBSD + +``` +sudo pkg install framework-system +``` + ## Features To check which features are supported on which OS and platform, @@ -153,6 +180,9 @@ ls -l framework_uefi/build/x86_64-unknown-uefi/boot.efi # NixOS nix-shell --run fish -p cargo systemd udev hidapi pkg-config direnv shell + +# FreeBSD +sudo pkg install hidapi ``` ## Install local package @@ -226,15 +256,6 @@ Many actions require root. First build with cargo and then run the binary with s cargo build && sudo ./target/debug/framework_tool ``` -###### Running on Windows - -On newly released systems since 2025 the Framework driver installer includes the EC driver. -This includes Framework 12, Framework 13 AMD Ryzen AI 300, Framework Desktop. - -Previous platforms will be enabled next. - -Installing: `winget install FrameworkComputer.framework_tool` - ##### Running on ChromeOS The application can run on ChromeOS but most commands rely on custom host @@ -329,15 +350,3 @@ Keyboard backlight: 0% [DEBUG] send_command(command=0x22, ver=0, data_len=0) Keyboard backlight: 0% ``` - -## FreeBSD - -``` -sudo pkg install hidapi - -# Build the library and tool -cargo build - -# Running the tool -cargo run -``` From a9ebb6976bfadc65b3d8264d3d98e0cc31a8f3f8 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Mon, 18 Aug 2025 13:21:56 +0800 Subject: [PATCH 28/34] README: Move more into advanced example file Clean up readme Signed-off-by: Daniel Schaefer --- EXAMPLES_ADVANCED.md | 83 +++++++++++++++++++++++++++++++++++++++++ README.md | 88 ++------------------------------------------ 2 files changed, 86 insertions(+), 85 deletions(-) diff --git a/EXAMPLES_ADVANCED.md b/EXAMPLES_ADVANCED.md index 8e938e1..a350df3 100644 --- a/EXAMPLES_ADVANCED.md +++ b/EXAMPLES_ADVANCED.md @@ -1,5 +1,33 @@ # Advanced debugging +## Verbosity + +To debug, increase the verbosity from the commandline with `-v`. +The verbosity levels are: + +| Commandline | Level | +|-------------|--------| +| `-q` | No log | +| None | Error | +| `-v` | Warn | +| `-vv` | Info | +| `-vvv` | Debug | +| `-vvvv` | Trace | + +For example it is useful to check which EC driver is used: + +``` +> framework_tool --kblight -vvv +[DEBUG] Chromium EC Driver: CrosEc +[DEBUG] send_command(command=0x22, ver=0, data_len=0) +Keyboard backlight: 0% + +> framework_tool --driver portio --kblight -vvv +[DEBUG] Chromium EC Driver: Portio +[DEBUG] send_command(command=0x22, ver=0, data_len=0) +Keyboard backlight: 0% +``` + ## PD ### Check PD state @@ -189,3 +217,58 @@ Capsule Header Capsule Size: 2180 KB Type: Framework Retimer23 (Right) ``` + +## Version Check + +Check if the firmware version is what you expect, returns exit code 0 on +succcess, 1 on failure. + +``` +# Check which devices it's available for +> ./framework_tool --device + [possible values: bios, ec, pd0, pd1, rtm01, rtm23, ac-left, ac-right] + +For more information try '--help' + +# Successful compare +> ./framework_tool --device bios --compare-version 03.01 +Target Version "03.01" +Comparing BIOS version "03.01" +Compared version: 0 +> echo $? +0 + +# Failed compare +> ./framework_tool --device bios --compare-version 03.00 + Finished dev [unoptimized + debuginfo] target(s) in 0.05s +Target Version "03.00" +Comparing BIOS version "03.01" +Compared version: 1 +Error: "Fail" + +> echo $? +1 +``` + +On UEFI Shell: + +``` +# Check if AC is attached on left side +Shell> fs0:framework_tool.efi --device ac-left --compare-version 1 +Target Version "1" +Comparing AcLeft "1" +Comparison Result: 0 +# It is +Shell> echo %lasterror% +0x0 + +# Check if AC is attached on right side +Shell> fs0:framework_tool.efi --device ac-right --compare-version 1 +Target Version "1" +Comparing AcLeft "0" +Comparison Result: 1 + +# It is not +Shell> echo %lasterror% +0x1 +``` diff --git a/README.md b/README.md index 69e52ab..018fcba 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,9 @@ Rust libraries and tools to interact with the system. The tool works on Linux, Windows and the UEFI shell. -Download it from the latest [GH Actions](https://github.com/FrameworkComputer/framework-system/actions?query=branch%3Amain) run on the main branch. -Most features are supported on every "OS". See below for details. +Most features are supported on every "OS". + +You can find lots of examples in [EXAMPLES.md](./EXAMPLES.md). ## Installation @@ -267,86 +268,3 @@ own EC firmware and flash it. - [x] Basic unit tests - [x] Test parsing real binaries - -## Version Check - -Check if the firmware version is what you expect, returns exit code 0 on -succcess, 1 on failure. - -``` -# Check which devices it's available for -> ./framework_tool --device - [possible values: bios, ec, pd0, pd1, rtm01, rtm23, ac-left, ac-right] - -For more information try '--help' - -# Successful compare -> ./framework_tool --device bios --compare-version 03.01 -Target Version "03.01" -Comparing BIOS version "03.01" -Compared version: 0 -> echo $? -0 - -# Failed compare -> ./framework_tool --device bios --compare-version 03.00 - Finished dev [unoptimized + debuginfo] target(s) in 0.05s -Target Version "03.00" -Comparing BIOS version "03.01" -Compared version: 1 -Error: "Fail" - -> echo $? -1 -``` - -On UEFI Shell: - -``` -# Check if AC is attached on left side -Shell> fs0:framework_tool.efi --device ac-left --compare-version 1 -Target Version "1" -Comparing AcLeft "1" -Comparison Result: 0 -# It is -Shell> echo %lasterror% -0x0 - -# Check if AC is attached on right side -Shell> fs0:framework_tool.efi --device ac-right --compare-version 1 -Target Version "1" -Comparing AcLeft "0" -Comparison Result: 1 - -# It is not -Shell> echo %lasterror% -0x1 -``` - -## Debugging - -To debug, increase the verbosity from the commandline with `-v`. -The verbosity levels are: - -| Commandline | Level | -|-------------|--------| -| `-q` | No log | -| None | Error | -| `-v` | Warn | -| `-vv` | Info | -| `-vvv` | Debug | -| `-vvvv` | Trace | - -For example it is useful to check which EC driver is used: - -``` -> framework_tool --kblight -vvv -[DEBUG] Chromium EC Driver: CrosEc -[DEBUG] send_command(command=0x22, ver=0, data_len=0) -Keyboard backlight: 0% - -> framework_tool --driver portio --kblight -vvv -[DEBUG] Chromium EC Driver: Portio -[DEBUG] send_command(command=0x22, ver=0, data_len=0) -Keyboard backlight: 0% -``` From 6419801fdbf4b2ec8d560133b49ebc5852293316 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Mon, 18 Aug 2025 13:27:20 +0800 Subject: [PATCH 29/34] README: Move more examples away Signed-off-by: Daniel Schaefer --- EXAMPLES.md | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 100 ++++++++------------------------------ 2 files changed, 156 insertions(+), 81 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 2361b19..557d834 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -1,5 +1,142 @@ # Example usage +Built-in help: + +``` +> framework_tool +Swiss army knife for Framework laptops + +Usage: framework_tool [OPTIONS] + +Options: + --flash-gpu-descriptor + + -v, --verbose... + Increase logging verbosity + -q, --quiet... + Decrease logging verbosity + --versions + List current firmware versions + --version + Show tool version information (Add -vv for more details) + --features + Show features support by the firmware + --esrt + Display the UEFI ESRT table + --device + [possible values: bios, ec, pd0, pd1, rtm01, rtm23, ac-left, ac-right] + --compare-version + + --power + Show current power status of battery and AC (Add -vv for more details) + --thermal + Print thermal information (Temperatures and Fan speed) + --sensors + Print sensor information (ALS, G-Sensor) + --fansetduty [...] + Set fan duty cycle (0-100%) + --fansetrpm [...] + Set fan RPM (limited by EC fan table max RPM) + --autofanctrl + Turn on automatic fan speed control + --pdports + Show information about USB-C PD ports + --info + Show info from SMBIOS (Only on UEFI) + --pd-info + Show details about the PD controllers + --pd-reset + Reset a specific PD controller (for debugging only) + --pd-disable + Disable all ports on a specific PD controller (for debugging only) + --pd-enable + Enable all ports on a specific PD controller (for debugging only) + --dp-hdmi-info + Show details about connected DP or HDMI Expansion Cards + --dp-hdmi-update + Update the DisplayPort or HDMI Expansion Card + --audio-card-info + Show details about connected Audio Expansion Cards (Needs root privileges) + --privacy + Show privacy switch statuses (camera and microphone) + --pd-bin + Parse versions from PD firmware binary file + --ec-bin + Parse versions from EC firmware binary file + --capsule + Parse UEFI Capsule information from binary file + --dump + Dump extracted UX capsule bitmap image to a file + --h2o-capsule + Parse UEFI Capsule information from binary file + --dump-ec-flash + Dump EC flash contents + --flash-ec + Flash EC (RO+RW) with new firmware from file - may render your hardware unbootable! + --flash-ro-ec + Flash EC with new RO firmware from file - may render your hardware unbootable! + --flash-rw-ec + Flash EC with new RW firmware from file + --intrusion + Show status of intrusion switch + --inputdeck + Show status of the input modules (Framework 16 only) + --inputdeck-mode + Set input deck power mode [possible values: auto, off, on] (Framework 16 only) [possible values: auto, off, on] + --expansion-bay + Show status of the expansion bay (Framework 16 only) + --charge-limit [] + Get or set max charge limit + --charge-current-limit ... + Set max charge current limit + --charge-rate-limit ... + Set max charge current limit + --get-gpio [] + Get GPIO value by name or all, if no name provided + --fp-led-level [] + Get or set fingerprint LED brightness level [possible values: high, medium, low, ultra-low, auto] + --fp-brightness [] + Get or set fingerprint LED brightness percentage + --kblight [] + Set keyboard backlight percentage or get, if no value provided + --remap-key + Remap a key by changing the scancode + --rgbkbd ... + Set the color of to . Multiple colors for adjacent keys can be set at once. [ ...] Example: 0 0xFF000 0x00FF00 0x0000FF + --tablet-mode + Set tablet mode override [possible values: auto, tablet, laptop] + --touchscreen-enable + Enable/disable touchscreen [possible values: true, false] + --stylus-battery + Check stylus battery level (USI 2.0 stylus only) + --console + Get EC console, choose whether recent or to follow the output [possible values: recent, follow] + --reboot-ec + Control EC RO/RW jump [possible values: reboot, jump-ro, jump-rw, cancel-jump, disable-jump] + --ec-hib-delay [] + Get or set EC hibernate delay (S5 to G3) + --hash + Hash a file of arbitrary data + --driver + Select which driver is used. By default portio is used [possible values: portio, cros-ec, windows] + --pd-addrs + Specify I2C addresses of the PD chips (Advanced) + --pd-ports + Specify I2C ports of the PD chips (Advanced) + -t, --test + Run self-test to check if interaction with EC is possible + -f, --force + Force execution of an unsafe command - may render your hardware unbootable! + --dry-run + Simulate execution of a command (e.g. --flash-ec) + --flash-gpu-descriptor-file + File to write to the gpu EEPROM + --dump-gpu-descriptor-file + File to dump the gpu EEPROM to + -h, --help + Print help +``` + ## Check firmware versions ### BIOS (Mainboard, UEFI, EC, PD, Retimer) diff --git a/README.md b/README.md index 018fcba..440cff0 100644 --- a/README.md +++ b/README.md @@ -137,18 +137,32 @@ All of these need EC communication support in order to work. - [x] Using [Framework EC Windows driver](https://github.com/FrameworkComputer/crosecbus) based on [coolstar's](https://github.com/coolstar/crosecbus) - [x] Using [DHowett's Windows CrosEC driver](https://github.com/DHowett/FrameworkWindowsUtils) -## Prerequisites +## Building -Only [Rustup](https://rustup.rs/) is needed. Based on `rust-toolchain.toml` it -will install the right toolchain and version for this project. +### Dependencies -## Building +[Rustup](https://rustup.rs/) is convenient for setting up the right Rust version. +Based on `rust-toolchain.toml` it will install the right toolchain and version for this project. MSRV (Minimum Supported Rust Version): - 1.74 for Linux/Windows - 1.74 for UEFI +System dependencies + +``` +# NixOS +nix-shell --run fish -p cargo systemd udev hidapi pkg-config +direnv shell + +# Fedora +sudo dnf install systemd-devel hidapi-devel + +# FreeBSD +sudo pkg install hidapi +``` + ```sh # Running linter cargo clippy @@ -175,17 +189,6 @@ make -C framework_uefi ls -l framework_uefi/build/x86_64-unknown-uefi/boot.efi ``` -### Dependencies - -``` -# NixOS -nix-shell --run fish -p cargo systemd udev hidapi pkg-config -direnv shell - -# FreeBSD -sudo pkg install hidapi -``` - ## Install local package ``` @@ -196,75 +199,10 @@ sudo pkg install hidapi ## Running -Run without any arguments to see the help: - -``` -> cargo run -Swiss army knife for Framework laptops - -Usage: framework_tool [OPTIONS] - -Options: - -v, --verbose... More output per occurrence - -q, --quiet... Less output per occurrence - --versions List current firmware versions version - --esrt Display the UEFI ESRT table - --power Show current power status (battery and AC) - --pdports Show information about USB-C PD ports - --info Show info from SMBIOS (Only on UEFI) - --pd-info Show details about the PD controllers - --dp-hdmi-info Show details about connected DP or HDMI Expansion Cards - --dp-hdmi-update Update the DisplayPort or HDMI Expansion Card - --audio-card-info Show details about connected Audio Expansion Cards (Needs root privileges) - --privacy Show privacy switch statuses (camera and microphone) - --pd-bin Parse versions from PD firmware binary file - --ec-bin Parse versions from EC firmware binary file - --capsule Parse UEFI Capsule information from binary file - --dump Dump extracted UX capsule bitmap image to a file - --h2o-capsule Parse UEFI Capsule information from binary file - --intrusion Show status of intrusion switch - --inputdeck Show status of the input deck - --input-deck-mode - Set input deck power mode [possible values: auto, off, on] (Framework 16 only) [possible values: auto, off, on] - --expansion-bay Show status of the expansion bay (Framework 16 only) - --charge-limit [] - Get or set max charge limit - --get-gpio [] - Get GPIO value by name or all, if no name provided - --fp-led-level [] - Get or set fingerprint LED brightness level [possible values: high, medium, low, ultra-low, auto] - --fp-brightness [] - Get or set fingerprint LED brightness percentage - --kblight [] Set keyboard backlight percentage or get, if no value provided - --tablet-mode Set tablet mode override [possible values: auto, tablet, laptop] - --touchscreen-enable - Enable/disable touchscreen [possible values: true, false] - --console Get EC console, choose whether recent or to follow the output [possible values: recent, follow] - --reboot-ec Control EC RO/RW jump [possible values: reboot, jump-ro, jump-rw, cancel-jump, disable-jump] - --hash Hash a file of arbitrary data - --driver Select which driver is used. By default portio is used [possible values: portio, cros-ec, windows] - --pd-addrs - Specify I2C addresses of the PD chips (Advanced) - --pd-ports - Specify I2C ports of the PD chips (Advanced) - -t, --test Run self-test to check if interaction with EC is possible - -h, --help Print help information -``` +Run without any arguments to see the help. Many actions require root. First build with cargo and then run the binary with sudo: ```sh cargo build && sudo ./target/debug/framework_tool ``` - -##### Running on ChromeOS - -The application can run on ChromeOS but most commands rely on custom host -commands that we built into the EC firmware of non-Chromebook Framework laptops. -In theory you could add those patches to the Chromebook platform, build your -own EC firmware and flash it. - -## Tests - -- [x] Basic unit tests -- [x] Test parsing real binaries From 1fcbe45d32c402f1fd7a680805cd3441f75740d8 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Mon, 18 Aug 2025 17:33:58 +0800 Subject: [PATCH 30/34] Intel Core Ultra Windows driver supported in BIOS 3.06 https://community.frame.work/t/framework-laptop-13-intel-core-ultra-series-1-bios-3-06-release-beta/74084 Signed-off-by: Daniel Schaefer --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 440cff0..eb44489 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ On UEFI and FreeBSD raw port I/O is used - on Linux this can also be used as a f | Intel Core 12th Gen | Yes | [6.13](https://github.com/torvalds/linux/commit/dcd59d0d7d51b2a4b768fc132b0d74a97dfd6d6a) | Not yet | | Intel Core 13th Gen | Yes | [6.13](https://github.com/torvalds/linux/commit/dcd59d0d7d51b2a4b768fc132b0d74a97dfd6d6a) | Not yet | | AMD Ryzen 7040 | Yes | [6.10](https://github.com/torvalds/linux/commit/c8f460d991df93d87de01a96b783cad5a2da9616) | BIOS 3.16+ | -| Intel Core Ultra 1S | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Soon | +| Intel Core Ultra S1 | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | BIOS 3.06+ | | AMD Ryzen AI 300 | Yes | [6.12](https://github.com/torvalds/linux/commit/62be134abf4250474a7a694837064bc783d2b291) | Yes | | Framework 16 | | | | | AMD Ryzen 7040 | Yes | [6.10](https://github.com/torvalds/linux/commit/c8f460d991df93d87de01a96b783cad5a2da9616) | BIOS 3.06+ | From 6a0369bd97073f13dd790d7d274fb4f0308c4a34 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Thu, 21 Aug 2025 16:33:42 +0800 Subject: [PATCH 31/34] guid-create: All changes merged upstream Just waiting for release Signed-off-by: Daniel Schaefer --- Cargo.lock | 2 +- framework_lib/Cargo.toml | 2 +- framework_lib/src/capsule.rs | 8 ++++---- framework_lib/src/commandline/mod.rs | 4 ++-- framework_lib/src/esrt/mod.rs | 14 +++++++------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a41533..eda8873 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -584,7 +584,7 @@ dependencies = [ [[package]] name = "guid-create" version = "0.4.1" -source = "git+https://github.com/FrameworkComputer/guid-create?branch=no-rand#84c3ad2e8b64a12beebb460804a65da55434cfd9" +source = "git+https://github.com/kurtlawrence/guid-create#14b53de6d816b9892b8590bbad0f3ba1e282aff3" dependencies = [ "winapi", ] diff --git a/framework_lib/Cargo.toml b/framework_lib/Cargo.toml index 348b6bc..ef3d600 100644 --- a/framework_lib/Cargo.toml +++ b/framework_lib/Cargo.toml @@ -34,7 +34,7 @@ spin = { version = "0.9.8" } no-std-compat = { version = "0.4.1", features = [ "alloc" ] } hidapi = { version = "2.6.3", features = [ "windows-native" ], optional = true } rusb = { version = "0.9.4", optional = true } -guid-create = { git = "https://github.com/FrameworkComputer/guid-create", branch = "no-rand", default-features = false } +guid-create = { git = "https://github.com/kurtlawrence/guid-create", default-features = false } [target.'cfg(target_os = "uefi")'.dependencies] uefi = { version = "0.20", features = ["alloc"] } diff --git a/framework_lib/src/capsule.rs b/framework_lib/src/capsule.rs index e2dff32..8ded649 100644 --- a/framework_lib/src/capsule.rs +++ b/framework_lib/src/capsule.rs @@ -11,7 +11,7 @@ use std::prelude::v1::*; use core::prelude::rust_2021::derive; -use guid_create::Guid; +use guid_create::CGuid; #[cfg(not(feature = "uefi"))] use std::fs::File; #[cfg(not(feature = "uefi"))] @@ -21,7 +21,7 @@ use std::io::prelude::*; #[repr(C)] pub struct EfiCapsuleHeader { /// A GUID that defines the contents of a capsule. - pub capsule_guid: Guid, + pub capsule_guid: CGuid, /// The size of the capsule header. This may be larger than the size of /// the EFI_CAPSULE_HEADER since CapsuleGuid may imply @@ -205,14 +205,14 @@ mod tests { let data = fs::read(capsule_path).unwrap(); let cap = parse_capsule_header(&data).unwrap(); let expected_header = EfiCapsuleHeader { - capsule_guid: Guid::from(esrt::WINUX_GUID), + capsule_guid: CGuid::from(esrt::WINUX_GUID), header_size: 28, flags: 65536, capsule_image_size: 676898, }; assert_eq!(cap, expected_header); - assert_eq!(cap.capsule_guid, Guid::from(esrt::WINUX_GUID)); + assert_eq!(cap.capsule_guid, CGuid::from(esrt::WINUX_GUID)); let ux_header = parse_ux_header(&data); assert_eq!( ux_header, diff --git a/framework_lib/src/commandline/mod.rs b/framework_lib/src/commandline/mod.rs index 646ea8d..e56d348 100644 --- a/framework_lib/src/commandline/mod.rs +++ b/framework_lib/src/commandline/mod.rs @@ -7,7 +7,7 @@ use alloc::format; use alloc::string::String; use alloc::string::ToString; use alloc::vec::Vec; -use guid_create::{Guid, GUID}; +use guid_create::{CGuid, GUID}; use log::Level; use num_traits::FromPrimitive; @@ -1275,7 +1275,7 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 { println!(" Size: {:>20} B", data.len()); println!(" Size: {:>20} KB", data.len() / 1024); if let Some(header) = analyze_capsule(&data) { - if header.capsule_guid == Guid::from(esrt::WINUX_GUID) { + if header.capsule_guid == CGuid::from(esrt::WINUX_GUID) { let ux_header = capsule::parse_ux_header(&data); if let Some(dump_path) = &args.dump { // TODO: Better error handling, rather than just panicking diff --git a/framework_lib/src/esrt/mod.rs b/framework_lib/src/esrt/mod.rs index aa517bf..77ecbf7 100644 --- a/framework_lib/src/esrt/mod.rs +++ b/framework_lib/src/esrt/mod.rs @@ -15,7 +15,7 @@ use log::{debug, error, info, trace}; use std::prelude::v1::*; use core::prelude::v1::derive; -use guid_create::{Guid, GUID}; +use guid_create::{CGuid, GUID}; #[cfg(target_os = "linux")] use std::fs; @@ -193,7 +193,7 @@ pub enum FrameworkGuidKind { Unknown, } -pub fn match_guid_kind(guid: &Guid) -> FrameworkGuidKind { +pub fn match_guid_kind(guid: &CGuid) -> FrameworkGuidKind { match GUID::from(*guid) { TGL_BIOS_GUID => FrameworkGuidKind::TglBios, ADL_BIOS_GUID => FrameworkGuidKind::AdlBios, @@ -292,7 +292,7 @@ impl UpdateStatus { // TODO: Decode into proper Rust types #[derive(Clone)] pub struct EsrtResourceEntry { - pub fw_class: Guid, + pub fw_class: CGuid, pub fw_type: u32, // ResourceType pub fw_version: u32, pub lowest_supported_fw_version: u32, @@ -364,7 +364,7 @@ fn esrt_from_sysfs(dir: &Path) -> io::Result { let last_attempt_version = fs::read_to_string(path.join("last_attempt_version"))?; let last_attempt_status = fs::read_to_string(path.join("last_attempt_status"))?; let esrt = EsrtResourceEntry { - fw_class: Guid::from( + fw_class: CGuid::from( GUID::parse(fw_class.trim()).expect("Kernel provided wrong value"), ), fw_type: fw_type @@ -436,7 +436,7 @@ pub fn get_esrt() -> Option { let ver_str = caps.get(2).unwrap().as_str().to_string(); let guid = GUID::parse(guid_str.trim()).expect("Kernel provided wrong value"); - let guid_kind = match_guid_kind(&Guid::from(guid)); + let guid_kind = match_guid_kind(&CGuid::from(guid)); let ver = u32::from_str_radix(&ver_str, 16).unwrap(); debug!("ESRT Entry {}", i); debug!(" Name: {:?}", guid_kind); @@ -456,7 +456,7 @@ pub fn get_esrt() -> Option { // TODO: The missing fields are present in Device Manager // So there must be a way to get at them let esrt = EsrtResourceEntry { - fw_class: Guid::from(guid), + fw_class: CGuid::from(guid), fw_type, fw_version: ver, // TODO: Not exposed by windows @@ -543,7 +543,7 @@ pub fn get_esrt() -> Option { for table in config_tables { // TODO: Why aren't they the same type? //debug!("Table: {:?}", table); - let table_guid: Guid = unsafe { std::mem::transmute(table.guid) }; + let table_guid: CGuid = unsafe { std::mem::transmute(table.guid) }; let table_guid = GUID::from(table_guid); match table_guid { SYSTEM_RESOURCE_TABLE_GUID => unsafe { From 40556f03d8249f5510b7b4b8a80677244b233696 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 22 Aug 2025 08:28:35 +0800 Subject: [PATCH 32/34] guid-create: Update to 0.5.0 All changes upstreamed and released! Signed-off-by: Daniel Schaefer --- Cargo.lock | 100 ++++++++++++++++++++++++++++++++++++++- framework_lib/Cargo.toml | 2 +- 2 files changed, 99 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index eda8873..00574d8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -568,6 +568,18 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi", +] + [[package]] name = "git2" version = "0.15.0" @@ -583,9 +595,11 @@ dependencies = [ [[package]] name = "guid-create" -version = "0.4.1" -source = "git+https://github.com/kurtlawrence/guid-create#14b53de6d816b9892b8590bbad0f3ba1e282aff3" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c332e3cc6970b85f68ff39438fdb87b5c9e27a0260d720d7d550701d9964baa0" dependencies = [ + "rand", "winapi", ] @@ -955,6 +969,15 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + [[package]] name = "proc-macro2" version = "1.0.93" @@ -993,6 +1016,41 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom", +] + [[package]] name = "redox_hwio" version = "0.1.6" @@ -1421,6 +1479,15 @@ dependencies = [ "libc", ] +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + [[package]] name = "wasm-bindgen" version = "0.2.84" @@ -1825,6 +1892,15 @@ dependencies = [ "version_check", ] +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags 2.6.0", +] + [[package]] name = "wmi" version = "0.15.0" @@ -1839,3 +1915,23 @@ dependencies = [ "windows 0.59.0", "windows-core", ] + +[[package]] +name = "zerocopy" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", +] diff --git a/framework_lib/Cargo.toml b/framework_lib/Cargo.toml index ef3d600..62e0e5d 100644 --- a/framework_lib/Cargo.toml +++ b/framework_lib/Cargo.toml @@ -34,7 +34,7 @@ spin = { version = "0.9.8" } no-std-compat = { version = "0.4.1", features = [ "alloc" ] } hidapi = { version = "2.6.3", features = [ "windows-native" ], optional = true } rusb = { version = "0.9.4", optional = true } -guid-create = { git = "https://github.com/kurtlawrence/guid-create", default-features = false } +guid-create = { version = "0.5.0", default-features = false } [target.'cfg(target_os = "uefi")'.dependencies] uefi = { version = "0.20", features = ["alloc"] } From 8ab61a92dde29b0677257261ea007919854570f9 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 22 Aug 2025 08:59:58 +0800 Subject: [PATCH 33/34] gh-actions: fail if anything changed Signed-off-by: Daniel Schaefer --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c22589d..32037c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -74,6 +74,9 @@ jobs: name: framework_tool path: target/release/framework_tool + - name: Make sure nothing changed (e.g. Cargo.lock) + run: git diff --exit-code + build-uefi: name: Build UEFI runs-on: ubuntu-24.04 From a24ace300650e4df21289502295ad819b46cba5d Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Fri, 22 Aug 2025 08:46:52 +0800 Subject: [PATCH 34/34] Update lockfile Signed-off-by: Daniel Schaefer --- Cargo.lock | 95 ------------------------------------------------------ 1 file changed, 95 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 00574d8..dfee2ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -568,18 +568,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "getrandom" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" -dependencies = [ - "cfg-if", - "libc", - "r-efi", - "wasi", -] - [[package]] name = "git2" version = "0.15.0" @@ -599,7 +587,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c332e3cc6970b85f68ff39438fdb87b5c9e27a0260d720d7d550701d9964baa0" dependencies = [ - "rand", "winapi", ] @@ -969,15 +956,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy", -] - [[package]] name = "proc-macro2" version = "1.0.93" @@ -1016,41 +994,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - -[[package]] -name = "rand" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" -dependencies = [ - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" -dependencies = [ - "getrandom", -] - [[package]] name = "redox_hwio" version = "0.1.6" @@ -1479,15 +1422,6 @@ dependencies = [ "libc", ] -[[package]] -name = "wasi" -version = "0.14.2+wasi-0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" -dependencies = [ - "wit-bindgen-rt", -] - [[package]] name = "wasm-bindgen" version = "0.2.84" @@ -1892,15 +1826,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "wit-bindgen-rt" -version = "0.39.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" -dependencies = [ - "bitflags 2.6.0", -] - [[package]] name = "wmi" version = "0.15.0" @@ -1915,23 +1840,3 @@ dependencies = [ "windows 0.59.0", "windows-core", ] - -[[package]] -name = "zerocopy" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.98", -]