fix(keymap): restore no_init param dropped in refil #3047 cherry-pick#22
Open
TheRickyZhang wants to merge 2 commits into
Open
fix(keymap): restore no_init param dropped in refil #3047 cherry-pick#22TheRickyZhang wants to merge 2 commits into
TheRickyZhang wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human TLDR: I had an issue with my advantage360-pro-zmk artifacts that caused every key to be nullopt upon flash. The fix traced primarily to this branch, as found by claude, and I confirmed it worked afterwards.
Summary (By claude)
Commit
7bb4bd5f("fix(core): Generate correct keymap layer names for all builds (zmkfirmware#3047)") on theadv360-z3.5-2branch is an incomplete port of upstream ZMK zmkfirmware#3047. It drops two matched pieces of the keymap-initialization change, which together leave the keymap empty at runtime. Both compile cleanly — CI stays green and produces a valid.uf2— so nothing flags the problem, but the flashed firmware has no working keys.This PR restores both dropped pieces to match
zmkfirmware/zmk.Bug 1 —
no_initparameter dropped fromKEYMAP_VARThe macro body references
no_init, but the parameter was dropped from the signature (KEYMAP_VAR(_name, _opts)) and both call sites, leavingno_initas an undefined identifier.COND_CODE_0(no_init, (…layers…), (0))therefore silently expands to the else branch(0), zero-initializing the keymap binding array:Effect: every build (Studio and non-Studio) ships a zeroed compile-time keymap.
Bug 2 —
reload_from_stock_keymap()dropped fromkeymap_init()For Studio builds (
CONFIG_ZMK_STUDIO=y),zmk_keymapis intentionally left uninitialized at compile time (no_init) and must be populated at boot fromzmk_stock_keymap. Upstream does this inkeymap_init(); this branch's version omits it:Effect: even after Bug 1 is fixed, Studio builds boot with an all-zero keymap — and a settings reset does not help, because nothing ever copies the stock keymap into the live one. Non-Studio builds are unaffected (their keymap is initialized from devicetree at compile time).
Fix
int keymap_init(void) { #if IS_ENABLED(CONFIG_ZMK_KEYMAP_LAYER_REORDERING) load_stock_keymap_layer_ordering(); #endif +#if IS_ENABLED(CONFIG_ZMK_STUDIO) + reload_from_stock_keymap(); +#endif return 0; }Both hunks match the current
zmkfirmware/zmkapp/src/keymap.c.Testing
KEYMAP_VARmacro andkeymap_init()match the currentzmkfirmware/zmkversion.zmk_keymapis repopulated from the stock keymap at boot; keys function.