From 1aa6a6465d12d239c3d4fbc03398331dc0dcbe83 Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Sun, 11 Oct 2026 23:19:37 +0800 Subject: [PATCH 1/2] fix: sync RMK dependencies for per-board battery config --- Cargo.lock | 8 ++--- Cargo.toml | 4 +-- tests/cli.rs | 36 ++++++++++++++++++--- tests/fixtures/battery_split.toml | 49 +++++++++++++++++++++++++++++ tests/fixtures/battery_unibody.toml | 27 ++++++++++++++++ 5 files changed, 114 insertions(+), 10 deletions(-) create mode 100644 tests/fixtures/battery_split.toml create mode 100644 tests/fixtures/battery_unibody.toml diff --git a/Cargo.lock b/Cargo.lock index fcd31f8..8562ac2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1754,7 +1754,7 @@ dependencies = [ [[package]] name = "rmk-config" version = "0.8.0" -source = "git+https://github.com/rmk-rs/rmk?rev=5f06e5bfda227df7240d8ad148f704bb27667f0d#5f06e5bfda227df7240d8ad148f704bb27667f0d" +source = "git+https://github.com/rmk-rs/rmk?rev=6e84c364eaa2d400d58cbcaaa441415b7340fe14#6e84c364eaa2d400d58cbcaaa441415b7340fe14" dependencies = [ "config", "miniz_oxide 0.9.1", @@ -1771,7 +1771,7 @@ dependencies = [ [[package]] name = "rmk-types" version = "0.4.0" -source = "git+https://github.com/rmk-rs/rmk?rev=5f06e5bfda227df7240d8ad148f704bb27667f0d#5f06e5bfda227df7240d8ad148f704bb27667f0d" +source = "git+https://github.com/rmk-rs/rmk?rev=6e84c364eaa2d400d58cbcaaa441415b7340fe14#6e84c364eaa2d400d58cbcaaa441415b7340fe14" dependencies = [ "bitfield-struct", "cobs", @@ -1879,7 +1879,7 @@ checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" [[package]] name = "rynk" version = "0.3.0" -source = "git+https://github.com/rmk-rs/rmk?rev=5f06e5bfda227df7240d8ad148f704bb27667f0d#5f06e5bfda227df7240d8ad148f704bb27667f0d" +source = "git+https://github.com/rmk-rs/rmk?rev=6e84c364eaa2d400d58cbcaaa441415b7340fe14#6e84c364eaa2d400d58cbcaaa441415b7340fe14" dependencies = [ "critical-section", "embassy-futures", @@ -1897,7 +1897,7 @@ dependencies = [ [[package]] name = "rynk-kle" version = "0.3.0" -source = "git+https://github.com/rmk-rs/rmk?rev=5f06e5bfda227df7240d8ad148f704bb27667f0d#5f06e5bfda227df7240d8ad148f704bb27667f0d" +source = "git+https://github.com/rmk-rs/rmk?rev=6e84c364eaa2d400d58cbcaaa441415b7340fe14#6e84c364eaa2d400d58cbcaaa441415b7340fe14" dependencies = [ "kle-serial", "rmk-config", diff --git a/Cargo.toml b/Cargo.toml index a8a32f2..2782269 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,10 +11,10 @@ license = "Apache-2.0" [dependencies] # Pins the `keyboard.toml` schema; `deny_unknown_fields` rejects keys added later. # Tracks rmk `main` between releases — move back to crates.io before publishing. -rmk-config = { git = "https://github.com/rmk-rs/rmk", rev = "5f06e5bfda227df7240d8ad148f704bb27667f0d" } +rmk-config = { git = "https://github.com/rmk-rs/rmk", rev = "6e84c364eaa2d400d58cbcaaa441415b7340fe14" } # The KLE/Vial ↔ [layout] engine behind `rmkit layout`. It pins rmk-config # exactly, so both deps must point at the same source. -rynk-kle = { git = "https://github.com/rmk-rs/rmk", rev = "5f06e5bfda227df7240d8ad148f704bb27667f0d" } +rynk-kle = { git = "https://github.com/rmk-rs/rmk", rev = "6e84c364eaa2d400d58cbcaaa441415b7340fe14" } clap = { version = "4.5.23", features = ["derive", "string"] } toml = "0.9.8" serde = "1.0" diff --git a/tests/cli.rs b/tests/cli.rs index cb8ba36..120f52c 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -1,7 +1,7 @@ -//! End-to-end: run the built binary (`rmkit layout convert`) on fixture inputs -//! (vial.json and raw KLE exports) and check the output (including that the -//! generated `[layout]` passes rmk-config validation, which the command reports -//! on stderr and exits non-zero on failure). +//! End-to-end: run the built binary on keyboard configs and layout fixtures. +//! Layout conversion also checks that the generated `[layout]` passes +//! rmk-config validation, which the command reports on stderr and exits +//! non-zero on failure. use std::process::Command; @@ -13,6 +13,34 @@ fn run(fixture: &str) -> std::process::Output { .expect("failed to run rmkit") } +fn check_battery_config(fixture: &str) { + let path = format!("{}/tests/fixtures/{fixture}", env!("CARGO_MANIFEST_DIR")); + // get-chip also creates the project directory. Keep it out of the repo + // and isolate the two tests when the test runner executes them in parallel. + let dir = std::env::temp_dir().join(format!("rmkit_battery_{fixture}_{}", std::process::id())); + std::fs::create_dir(&dir).unwrap(); + let out = Command::new(env!("CARGO_BIN_EXE_rmkit")) + .current_dir(&dir) + .args(["get-chip", "--keyboard-toml-path", &path]) + .output() + .expect("failed to run rmkit"); + std::fs::remove_dir_all(&dir).unwrap(); + + let stderr = String::from_utf8_lossy(&out.stderr); + assert!(out.status.success(), "{fixture} failed:\n{stderr}"); + assert_eq!(String::from_utf8_lossy(&out.stdout).trim(), "nrf52840"); +} + +#[test] +fn get_chip_accepts_unibody_battery_table() { + check_battery_config("battery_unibody.toml"); +} + +#[test] +fn get_chip_accepts_split_battery_tables() { + check_battery_config("battery_split.toml"); +} + #[test] fn ansi60_split_backspace_converts_and_validates() { let out = run("ansi60_splitbs.json"); diff --git a/tests/fixtures/battery_split.toml b/tests/fixtures/battery_split.toml new file mode 100644 index 0000000..e01f7cc --- /dev/null +++ b/tests/fixtures/battery_split.toml @@ -0,0 +1,49 @@ +# Minimal regression for RMK's use_config/nrf52840_ble_split example (issue #19). +[keyboard] +name = "Battery Split" +vendor_id = 0x4c4b +product_id = 0x4643 +chip = "nrf52840" + +[layout] +rows = 1 +cols = 2 +map = "(0,0) (0,1)" + +[keymap] +layers = 1 + +[[keymap.layer]] +keys = "A B" + +[ble] +enabled = true + +[split] +connection = "ble" + +[split.central] +rows = 1 +cols = 1 +row_offset = 0 +col_offset = 0 +ble_addr = [0x18, 0xe2, 0x21, 0x80, 0xc0, 0xc7] +matrix = { row_pins = ["P0_12"], col_pins = ["P0_14"] } + +[split.central.battery] +battery_adc_pin = "P0_05" +adc_divider_measured = 2000 +adc_divider_total = 2806 + +[[split.peripheral]] +rows = 1 +cols = 1 +row_offset = 0 +col_offset = 1 +ble_addr = [0x7e, 0xfe, 0x73, 0x9e, 0x66, 0xe3] +matrix = { row_pins = ["P1_11"], col_pins = ["P0_30"] } + +[split.peripheral.battery] +battery_adc_pin = "P0_05" +adc_divider_measured = 2000 +adc_divider_total = 2806 diff --git a/tests/fixtures/battery_unibody.toml b/tests/fixtures/battery_unibody.toml new file mode 100644 index 0000000..b181ff4 --- /dev/null +++ b/tests/fixtures/battery_unibody.toml @@ -0,0 +1,27 @@ +# Minimal regression for RMK's use_config/nrf52840_ble example (issue #19). +[keyboard] +name = "Battery Unibody" +vendor_id = 0x4c4b +product_id = 0x4643 +chip = "nrf52840" + +[matrix] +row_pins = ["P1_00"] +col_pins = ["P1_05"] + +[layout] +rows = 1 +cols = 1 +map = "(0,0)" + +[keymap] +layers = 1 + +[[keymap.layer]] +keys = "A" + +[ble] +enabled = true + +[battery] +battery_adc_pin = "vddh" From 9139f27dffdb9739bc359b8a3939bf9adf8ca08d Mon Sep 17 00:00:00 2001 From: Haobo Gu Date: Sun, 11 Oct 2026 23:24:27 +0800 Subject: [PATCH 2/2] chore: limit battery schema fix to dependency updates --- tests/cli.rs | 36 +++------------------ tests/fixtures/battery_split.toml | 49 ----------------------------- tests/fixtures/battery_unibody.toml | 27 ---------------- 3 files changed, 4 insertions(+), 108 deletions(-) delete mode 100644 tests/fixtures/battery_split.toml delete mode 100644 tests/fixtures/battery_unibody.toml diff --git a/tests/cli.rs b/tests/cli.rs index 120f52c..cb8ba36 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -1,7 +1,7 @@ -//! End-to-end: run the built binary on keyboard configs and layout fixtures. -//! Layout conversion also checks that the generated `[layout]` passes -//! rmk-config validation, which the command reports on stderr and exits -//! non-zero on failure. +//! End-to-end: run the built binary (`rmkit layout convert`) on fixture inputs +//! (vial.json and raw KLE exports) and check the output (including that the +//! generated `[layout]` passes rmk-config validation, which the command reports +//! on stderr and exits non-zero on failure). use std::process::Command; @@ -13,34 +13,6 @@ fn run(fixture: &str) -> std::process::Output { .expect("failed to run rmkit") } -fn check_battery_config(fixture: &str) { - let path = format!("{}/tests/fixtures/{fixture}", env!("CARGO_MANIFEST_DIR")); - // get-chip also creates the project directory. Keep it out of the repo - // and isolate the two tests when the test runner executes them in parallel. - let dir = std::env::temp_dir().join(format!("rmkit_battery_{fixture}_{}", std::process::id())); - std::fs::create_dir(&dir).unwrap(); - let out = Command::new(env!("CARGO_BIN_EXE_rmkit")) - .current_dir(&dir) - .args(["get-chip", "--keyboard-toml-path", &path]) - .output() - .expect("failed to run rmkit"); - std::fs::remove_dir_all(&dir).unwrap(); - - let stderr = String::from_utf8_lossy(&out.stderr); - assert!(out.status.success(), "{fixture} failed:\n{stderr}"); - assert_eq!(String::from_utf8_lossy(&out.stdout).trim(), "nrf52840"); -} - -#[test] -fn get_chip_accepts_unibody_battery_table() { - check_battery_config("battery_unibody.toml"); -} - -#[test] -fn get_chip_accepts_split_battery_tables() { - check_battery_config("battery_split.toml"); -} - #[test] fn ansi60_split_backspace_converts_and_validates() { let out = run("ansi60_splitbs.json"); diff --git a/tests/fixtures/battery_split.toml b/tests/fixtures/battery_split.toml deleted file mode 100644 index e01f7cc..0000000 --- a/tests/fixtures/battery_split.toml +++ /dev/null @@ -1,49 +0,0 @@ -# Minimal regression for RMK's use_config/nrf52840_ble_split example (issue #19). -[keyboard] -name = "Battery Split" -vendor_id = 0x4c4b -product_id = 0x4643 -chip = "nrf52840" - -[layout] -rows = 1 -cols = 2 -map = "(0,0) (0,1)" - -[keymap] -layers = 1 - -[[keymap.layer]] -keys = "A B" - -[ble] -enabled = true - -[split] -connection = "ble" - -[split.central] -rows = 1 -cols = 1 -row_offset = 0 -col_offset = 0 -ble_addr = [0x18, 0xe2, 0x21, 0x80, 0xc0, 0xc7] -matrix = { row_pins = ["P0_12"], col_pins = ["P0_14"] } - -[split.central.battery] -battery_adc_pin = "P0_05" -adc_divider_measured = 2000 -adc_divider_total = 2806 - -[[split.peripheral]] -rows = 1 -cols = 1 -row_offset = 0 -col_offset = 1 -ble_addr = [0x7e, 0xfe, 0x73, 0x9e, 0x66, 0xe3] -matrix = { row_pins = ["P1_11"], col_pins = ["P0_30"] } - -[split.peripheral.battery] -battery_adc_pin = "P0_05" -adc_divider_measured = 2000 -adc_divider_total = 2806 diff --git a/tests/fixtures/battery_unibody.toml b/tests/fixtures/battery_unibody.toml deleted file mode 100644 index b181ff4..0000000 --- a/tests/fixtures/battery_unibody.toml +++ /dev/null @@ -1,27 +0,0 @@ -# Minimal regression for RMK's use_config/nrf52840_ble example (issue #19). -[keyboard] -name = "Battery Unibody" -vendor_id = 0x4c4b -product_id = 0x4643 -chip = "nrf52840" - -[matrix] -row_pins = ["P1_00"] -col_pins = ["P1_05"] - -[layout] -rows = 1 -cols = 1 -map = "(0,0)" - -[keymap] -layers = 1 - -[[keymap.layer]] -keys = "A" - -[ble] -enabled = true - -[battery] -battery_adc_pin = "vddh"