Skip to content

launcher: report battery level over USB and 2.4 GHz (A7 31) - #15

Open
JanitorHead wants to merge 1 commit into
Keychron:rtl8762gfrom
JanitorHead:launcher-battery-query
Open

JanitorHead wants to merge 1 commit into
Keychron:rtl8762gfrom
JanitorHead:launcher-battery-query

Conversation

@JanitorHead

@JanitorHead JanitorHead commented Nov 22, 2026 •

Copy link
Copy Markdown

On the Ultra 8K keyboards the battery level only reaches the host over Bluetooth. Over the USB cable and over the Ultra-Link 8K receiver nothing reports it: the receiver link carries keys, consumer, mouse, device info and Launcher data, and no Launcher command returns the battery. Anyone who uses the 2.4 GHz receiver, which is the point of an 8K board, cannot see the battery from the computer.

This adds one kc_user_cmd sub-command, 0x31. The host sends A7 31 on the raw HID interface (usage page 0xFF60) and the keyboard answers A7 31 <percent> <charging>, using zmk_battery_state_of_charge() and get_charge_state(). Launcher already forwards raw HID through the receiver (LAUNCHER_PATH_PPT), so the same request works on the cable and on 2.4 GHz with no receiver change. Unknown sub-commands are unaffected.

Testing.

Source build. This branch builds for the V3 Ultra 8K ISO (west build -s app -b keychron -- -DSHIELD=keychron_v3_ultra_iso, zmkfirmware/zmk-build-arm:3.5, Zephyr SDK 0.16.3). I also built its parent commit without the change.

  • In the unchanged build, kc_user_cmd is byte-identical to the one in the official V3 Ultra 8K ISO v1.0.2-ZK image (KCZKV38I, build Feb 27 2026) once link-time addresses are masked. So this patch applies to the handler that ships.
  • I ran kc_user_cmd from both ELFs in an emulator (Unicorn, Cortex-M33). With the change, 0x31 answers 31 49 01 for 73 % charging, 31 64 00 for 100 % and 31 05 00 for 5 %. The other 255 sub-commands give the same reply as without the change.

I did not flash the source build. Its prebuilt 2.4 GHz library (hal_realtek 2.4G, "Add 2.4G lib", May 22 2026) is newer than the one in v1.0.2. Matched function by function against the official image, ppt_driver, ppt_sync and ppt_simple are the same, but 22 of 44 ppt_sync_master functions differ. The older libppt_sync_master.a no longer links with this app (whiten_and_calculate_crc_fast, md1r_seq), so I could not reproduce the shipped radio from source.

On the keyboard. I applied the same change as a binary patch to the official v1.0.2 image, flashed it with the Launcher update protocol, and checked it:

  • USB cable (3434:0C31): A7 31 64 01 → 100 %, charging
  • Ultra-Link 8K receiver (3434:D028): A7 31 64 00 → 100 %, on battery
  • Every other kc_user_cmd sub-command gives the same reply as stock (checked by emulating the stock and patched handlers side by side).

It would be great to have this in the official firmware, and ideally shown in Launcher, so users do not need patched images to see the battery over 2.4 GHz.

Add kc_user_cmd sub-command 0x31. The reply is A7 31 <percent> <charging>, so Launcher or any host tool can read the battery over the USB cable and over the Ultra-Link 8K receiver; until now the level only reached the host over Bluetooth.
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.

1 participant