Skip to content

Commit 3c8387d

Browse files
committed
--remap-key: Implement in UEFI
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent d69f7d7 commit 3c8387d

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

framework_lib/src/commandline/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,6 +1857,8 @@ Options:
18571857
--fp-led-level [<VAL>] Get or set fingerprint LED brightness level [possible values: high, medium, low]
18581858
--fp-brightness [<VAL>]Get or set fingerprint LED brightness percentage
18591859
--kblight [<KBLIGHT>] Set keyboard backlight percentage or get, if no value provided
1860+
--remap-key <ROW> <COL> <SCANCODE>
1861+
Remap a key by changing the scancode
18601862
--rgbkbd <START> <HEXCOLOR> [<HEXCOLOR> ...]
18611863
Set the color of a key to RGB. Multiple colors for adjacent keys can be set at once
18621864
--tablet-mode <MODE> Set tablet mode override [possible values: auto, tablet, laptop]

framework_lib/src/commandline/uefi.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,20 @@ pub fn parse(args: &[String]) -> Cli {
363363
Some(None)
364364
};
365365
found_an_option = true;
366+
} else if arg == "--remap-key" {
367+
if args.len() > i + 3 {
368+
let row = parse_hex_or_dec_u8(&args[i + 1]);
369+
let col = parse_hex_or_dec_u8(&args[i + 2]);
370+
let scancode = parse_hex_or_dec_u16(&args[i + 3]);
371+
if let (Some(row), Some(col), Some(scancode)) = (row, col, scancode) {
372+
cli.remap_key = Some((row, col, scancode));
373+
} else {
374+
println!("Invalid values for --remap-key. Must be: <ROW> <COL> <SCANCODE>");
375+
}
376+
} else {
377+
println!("--remap-key requires 3 arguments: <ROW> <COL> <SCANCODE>");
378+
}
379+
found_an_option = true;
366380
} else if arg == "--rgbkbd" {
367381
cli.rgbkbd = if args.len() > i + 2 {
368382
let mut colors = Vec::<u64>::new();

0 commit comments

Comments
 (0)