Show the actual Triggerhappy state instead of defaulting to off - #788
Open
Gjuju wants to merge 1 commit into
Open
Show the actual Triggerhappy state instead of defaulting to off#788Gjuju wants to merge 1 commit into
Gjuju wants to merge 1 commit into
Conversation
Contributor
|
What would cause the session var to be deleted after its initially set to the default of 0? |
Contributor
Author
|
It's a marginal case. Any Pi user restoring a backup hits this: backup_manager.py extracts moodecfg.ini to /boot, autocfg then sets usb_volknob via setSessVarOnly, so the UI comes back showing On while triggerhappy was never really re-enabled. |
Gjuju
force-pushed
the
contrib/triggerhappy-state-from-systemd
branch
3 times, most recently
from
August 23, 2026 11:46
70b8675 to
1f38b96
Compare
Gjuju
force-pushed
the
contrib/triggerhappy-state-from-systemd
branch
2 times, most recently
from
September 1, 2026 10:08
3b2d277 to
99cc55f
Compare
Gjuju
force-pushed
the
contrib/triggerhappy-state-from-systemd
branch
from
September 8, 2026 07:44
99cc55f to
61d7471
Compare
usb_volknob became a session-only var in f6d4b07, but the state that actually persists across reboots is the service enable state. When the session var is missing the worker assumed off and wrote that default, so after any session reset the UI reported the USB volume knob as off while thd kept running, and the toggle could no longer turn it off: per-config.php only submits the job when the posted value differs from the session one, so clicking OFF on an already-0 session var is a no-op. Refresh the session var from `systemctl is-enabled triggerhappy` at every worker start so the UI and the worker log reflect the running state.
Gjuju
force-pushed
the
contrib/triggerhappy-state-from-systemd
branch
from
September 9, 2026 17:45
61d7471 to
3564c40
Compare
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.
usb_volknob is a session-only , but the state that actually persists across reboots is triggerhappy's service enable state — the usb_volknob job does systemctl enable/disable. The session var is only a mirror of it.
When the session var is missing, worker.php assumed off and wrote that default.
After any session reset the UI then reports the USB volume knob as off while thd is still enabled and running, and the toggle can no longer turn it off: per-config.php submits the job only when the posted value differs from the session one, so clicking OFF on an already-0 session var is a no-op — you have to go ON then OFF to regain control.
This refreshes the session var from systemctl is-enabled triggerhappy at every worker start, so the UI and the worker: log line show the running state.
Note: led_state has no equivalent fix — nothing persists it outside the session file, and at boot /sys/class/leds still holds the firmware default, so reading it back would yield the same 1,1 as today.