Dispatch Brick Fn keys with a spruce-native watchdog#1573
Open
Felixmil wants to merge 2 commits into
Open
Conversation
- spruce/brick/fnkey_watchdog.sh:
- new watchdog that reads Fn key-down events via getevent and runs the action mapped in /usr/trimui/fnkeys/f1key_launch and f2key_launch
- spruce/scripts/platform/device_functions/trimui_a133p.sh:
- add launch_startup_watchdogs to launch and pin the Fn key watchdog alongside the common watchdogs
- spruce/scripts/platform/device_functions/trimui_a133p.sh:
- drop the Brick-only launch_startup_watchdogs from the shared A133P base
- spruce/scripts/platform/device_functions/Brick.sh:
- add launch_startup_watchdogs to launch and pin the Fn key watchdog
Author
|
Heads-up on ordering: PR #1549 (Brick Fn action + volume-key sync) is stacked on top of this one and should merge after it. That PR reuses the Fn key watchdog added here to dispatch its LED/backlight Fn actions, and moves its Brick-only watchdog launch into the same |
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.
On the TrimUI Brick, the "Fn Key and Switch Settings" app lets you map an action to each of the two physical Fn keys, but pressing them did nothing. This adds Fn key support the spruce-native way: a small watchdog reads the Fn key presses and runs the mapped action, with no stock
keymon.This supersedes the earlier approach in #1548, which enabled Fn keys by adding the stock
keymondaemon to the boot blob list. That PR was closed because spruce deliberately does not runkeymon(it was removed across the project and replaced with spruce's owngeteventwatchdogs;keymonis kept only for the Miyoo Mini, where it is a different, stock component). This PR delivers the same feature using the existing watchdog pattern instead, so it fits that decision.Fn key watchdog
spruce/brick/fnkey_watchdog.shreads Fn key-down events from$EVENT_PATH_READ_INPUTS_SPRUCEwithgetevent(the same idiom ashomebutton_watchdog.sh) and runs the action thefneditorapp mapped to each key. The chosen action is read fresh on every press from/usr/trimui/fnkeys/f1key_launch(left) andf2key_launch(right), so remapping in the editor takes effect immediately, and an unmapped key is ignored. The action scripts are stateless togglers invoked with no argument, so the watchdog just executes the launch path, exactly askeymondid.On the Brick the left/right Fn keys report as
$B_L3(1 317) and$B_R3(1 318) onevent3; the Brick has no analog sticks, so those codes are exclusively the Fn keys. The node is read non-exclusively, alongside the home and buttons watchdogs that already read it, so there is no double-handling.Boot wiring
launch_startup_watchdogsintrimui_a133p.shlaunches and CPU-pins the watchdog next to the common startup watchdogs, matching how the other durable watchdogs are started. The boot blob list is unchanged (nokeymon).Validation
Tested on a physical Brick (FW 1.1.1) from a clean reboot:
keymonis not running,fnkey_watchdog.shstarts and is pinned, and it coexists with the home, buttons, power, and volume watchdogs on the sharedevent3node. The right Fn key (mapped to the LCD brightness cycle) works end to end through spruce's own backlight control. The left Fn key's LED toggle dispatches correctly, but the stock LED action script is a no-op under spruce (it writes/tmp/system/enable_led, which the stock firmware daemons consume and spruce does not); making the physical RGB respond is a separate, pre-existing gap in that action script and is left for a follow-up.Closes #1440