Skip to content

keymon: Refresh system state before acting on SELECT - #1936

Open
robcodedev wants to merge 1 commit into
OnionUI:v4.5-devfrom
robcodedev:keymon-fix-select
Open

keymon: Refresh system state before acting on SELECT#1936
robcodedev wants to merge 1 commit into
OnionUI:v4.5-devfrom
robcodedev:keymon-fix-select

Conversation

@robcodedev

Copy link
Copy Markdown

Fix intermittent SELECT -> MENU shortcut on Miyoo Mini v4 and Miyoo Flip.

system_state is a cached value, only re-read when /tmp/state_changed
exists, on a MENU press, or from deepsleep(). Two situations can leave it
wrong:

  • after a fresh boot it's still MODE_UNKNOWN
  • after returning from a game it's sometimes stale, when keymon consumes
    /tmp/state_changed before MainUI is back up

In both cases the SELECT -> MENU shortcut compares against the wrong value and
does nothing. It starts working once a state transition or MENU press forces an
update, which made it look intermittent rather than broken.

This re-reads the state in the handler before branching on it. The call sits
behind !comboKey_select && val == RELEASED, so it runs once per SELECT tap.

Scope

Deliberately limited to SELECT. Five other handlers read the same cached value
and might have the same problem, but I couldn't reproduce any issues with
other key presses.

Open question

Reported on v4 and Flip but not on Plus. I couldn't find a device-dependent
path in the state logic to explain that, so if anyone knows where the boot
ordering differs I'd like to hear it. The fix isn't device-specific either way.

Testing

  • Fresh boot, SELECT as the first input: shortcut works
  • Launch a game, exit back to MainUI, SELECT: shortcut works
  • SELECT combos still behave as before

system_state is only re-read when /tmp/state_changed exists, on a MENU
press, or from deepsleep(). That leaves it MODE_UNKNOWN after a fresh
boot, and stale after returning from a game, where keymon consumes and
removes the file before MainUI is back up. Either way the SELECT ->
MENU shortcut reads the wrong value and silently does nothing until
something else forces an update, which is what made it look
intermittent.

Re-read the state here before branching on it. This runs once per
SELECT tap, not on repeat, so the process scan it costs isn't on any
hot path.
@robcodedev
robcodedev changed the base branch from main to v4.5-dev September 8, 2026 19:06
Copilot AI added a commit to Amiga500/Onion that referenced this pull request Sep 9, 2026
…1943 OnionUI#1944 OnionUI#1945 OnionUI#1946 (runtime.sh, keymon, lt.lang)

Co-authored-by: Amiga500 <16525337+Amiga500@users.noreply.github.com>
Amiga500 added a commit to Amiga500/Onion that referenced this pull request Sep 9, 2026
Port OnionUI PRs OnionUI#1936OnionUI#1946 (launch prep, fb transitions, GameSwitcher favorites/crash fixes, theme previews) — thanks @robcodedev
Amiga500 added a commit to Amiga500/Onion that referenced this pull request Sep 10, 2026
…view

Refresh README and companion reports for onionplus-compact: ports of OnionUI PRs OnionUI#1936-1946 plus list-cache, installer Flip, boot FB, and AXP percBat fixes.

Co-authored-by: Cursor <cursoragent@cursor.com>
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