Skip to content

Fix uefi commandline parsing#286

Merged
JohnAZoidberg merged 7 commits intomainfrom
uefi-help
Mar 14, 2026
Merged

Fix uefi commandline parsing#286
JohnAZoidberg merged 7 commits intomainfrom
uefi-help

Conversation

@JohnAZoidberg
Copy link
Member

No description provided.

@JohnAZoidberg JohnAZoidberg changed the title Fix uefi commandline Fix uefi commandline parsing Mar 14, 2026
@JohnAZoidberg JohnAZoidberg requested a review from Copilot March 14, 2026 13:17
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the UEFI command-line parsing and help output to align with newer CLI options and fix several typos/mismatched messages in the Framework tool.

Changes:

  • Fix/standardize option names and messages (e.g., --autofanctrl, --ps2-enable, --ec-hib-delay, --device, --test-retimer, --pd-disable assignment).
  • Add UEFI parsing for --remap-key <ROW> <COL> <SCANCODE> and ensure some options correctly mark found_an_option.
  • Expand the UEFI-only help text with additional options (PD reset/enable/disable, ME info, GPU descriptor dump, advanced PD addressing/ports, etc.).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
framework_lib/src/commandline/uefi.rs Fixes/extends UEFI argument parsing (new --remap-key, corrected flag names/messages, some parsing flow fixes).
framework_lib/src/commandline/mod.rs Updates the UEFI help text to document additional options.
Comments suppressed due to low confidence (2)

framework_lib/src/commandline/uefi.rs:385

  • --rgbkbd parsing currently iterates from i + 1..args.len() and unwrap()s each value. This will (a) consume/attempt to parse subsequent flags (e.g. --tablet-mode) and panic, and (b) it doesn't accept hex values like 0xFF0000 that the Clap CLI supports. Consider stopping when the next arg starts with - (similar to --host-command) and parsing with a hex-or-dec helper, returning an empty vec (or leaving unset) with a clear error instead of panicking.
            cli.rgbkbd = if args.len() > i + 2 {
                let mut colors = Vec::<u64>::new();
                for color_i in i + 1..args.len() {
                    // TODO: Fail parsing instead of unwrap()
                    colors.push(args[color_i].parse::<u64>().unwrap());

framework_lib/src/commandline/uefi.rs:581

  • The validation/error message for --pd-disable says the PD number "Must be 0 or 1", but the rest of the codebase treats PD controller 2 (back) as valid as well (see commandline/mod.rs handling of pd_disable). This message should be updated to reflect the actual supported range (e.g. 0-2) to avoid confusing users.
            cli.pd_disable = if args.len() > i + 1 {
                if let Ok(pd) = args[i + 1].parse::<u8>() {
                    Some(pd)
                } else {
                    println!(
                        "Invalid value for --pd-disable: '{}'. Must be 0 or 1.",
                        args[i + 1],

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +1872 to +1874
--pd-addrs <PD_ADDRS> <PD_ADDRS>
Specify I2C addresses of the PD chips (Advanced)
--pd-ports <PD_PORTS> <PD_PORTS>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes!

They were recently added or forgotten earlier.

Signed-off-by: Daniel Schaefer <dhs@frame.work>
Signed-off-by: Daniel Schaefer <dhs@frame.work>
Signed-off-by: Daniel Schaefer <dhs@frame.work>
Signed-off-by: Daniel Schaefer <dhs@frame.work>
It's used to print help if no valid option was found

Signed-off-by: Daniel Schaefer <dhs@frame.work>
Signed-off-by: Daniel Schaefer <dhs@frame.work>
used already for --test -t

Signed-off-by: Daniel Schaefer <dhs@frame.work>
@JohnAZoidberg JohnAZoidberg merged commit 3ebe6bb into main Mar 14, 2026
10 checks passed
@JohnAZoidberg JohnAZoidberg deleted the uefi-help branch March 14, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants