Skip to content

Commit fecda01

Browse files
committed
rgbkbd: Accept hex values
``` sudo framework_tool --rgbkbd 0 0xFF0000 0x00FF00 0x0000FF ``` Signed-off-by: Daniel Schaefer <[email protected]>
1 parent a3bcede commit fecda01

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

Cargo.lock

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

framework_lib/Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cross_freebsd = ["unix", "freebsd_pio"]
1818
# Windows does not have the cros_ec driver nor raw port I/O access to userspace
1919
windows = ["std", "smbios", "dep:windows", "win_driver", "raw_pio", "hidapi", "rusb", "dep:wmi"]
2020
smbios = ["dep:smbios-lib"]
21-
std = ["dep:clap", "dep:clap-verbosity-flag", "dep:env_logger", "smbios-lib?/std"]
21+
std = ["dep:clap", "dep:clap-num", "dep:clap-verbosity-flag", "dep:env_logger", "smbios-lib?/std"]
2222
rusb = ["dep:rusb"]
2323
hidapi = ["dep:hidapi"]
2424
uefi = [
@@ -51,6 +51,7 @@ regex = { version = "1.11.1", default-features = false }
5151
redox_hwio = { git = "https://github.com/FrameworkComputer/rust-hwio", branch = "freebsd", default-features = false }
5252
libc = { version = "0.2.155", optional = true }
5353
clap = { version = "4.5", features = ["derive"], optional = true }
54+
clap-num = { version = "1.2.0", optional = true }
5455
clap-verbosity-flag = { version = "2.2.1", optional = true }
5556
nix = { version = "0.29.0", features = ["ioctl", "user"], optional = true }
5657
num = { version = "0.4", default-features = false }

framework_lib/src/commandline/clap_std.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//! This way we can use it in the regular OS commandline tool on Linux and Windows,
33
//! as well as on the UEFI shell tool.
44
use clap::Parser;
5+
use clap_num::maybe_hex;
56

67
use crate::chromium_ec::commands::EC_RGBKBD_MAX_KEY_COUNT;
78
use crate::chromium_ec::CrosEcDriverType;
@@ -150,7 +151,7 @@ struct ClapCli {
150151
/// <key> <RGB> [<RGB> ...]
151152
/// Example: 0 0xFF000 0x00FF00 0x0000FF
152153
#[clap(num_args = 2..EC_RGBKBD_MAX_KEY_COUNT)]
153-
#[arg(long)]
154+
#[arg(long, value_parser=maybe_hex::<u64>)]
154155
rgbkbd: Vec<u64>,
155156

156157
/// Set tablet mode override

0 commit comments

Comments
 (0)