Skip to content

Add power-mode and observability hooks#1397

Open
CatalyticArkun wants to merge 11 commits intospruceUI:Developmentfrom
CatalyticArkun:conv-merge
Open

Add power-mode and observability hooks#1397
CatalyticArkun wants to merge 11 commits intospruceUI:Developmentfrom
CatalyticArkun:conv-merge

Conversation

@CatalyticArkun
Copy link
Contributor

Introduce a power mode runtime module and add observability/coordination hooks across scripts. Key changes:

  • Add power_mode.sh: implements a locked, resumable power-mode state file and helpers for running/sleep/waking/shutdown_pending with validation and generation tracking.
  • Refactor archiveUnpacker.sh: add state file, pre_cmd handoff (foreground/background), resumable failure states, robust silent-lock handling, UI visibility flags, more detailed logging and emit traces via system-emit; ensure cleanup and exit tracing.
  • Update firstboot.sh: gate completion on unpack coordinator state, add UI hold flags, timeouts, and tracing; use shared show_firstboot_screen helper.
  • Update helperFunctions.sh, low_power_warning.sh, networkservices.sh and various device platform scripts (AnbernicXXCommon, MiyooMini, Pixel2, SmartProS, trimui_a133p) to emit structured events (brightness/audio/network/power) and improve PyUI writer lifecycle reporting.
  • Add new scripts: power_mode.sh, system-emit (executable) and trace.sh (for tracing/emit support).
  • principal.sh: add autoresume protections and validation for /tmp/cmd_to_run.sh.

Overall this improves robustness for unpacking/firstboot workflows, adds observability and tracing, and provides a canonical power-mode contract for coordinated shutdown/sleep handling.

Introduce a power mode runtime module and add observability/coordination hooks across scripts. Key changes:

- Add power_mode.sh: implements a locked, resumable power-mode state file and helpers for running/sleep/waking/shutdown_pending with validation and generation tracking.
- Refactor archiveUnpacker.sh: add state file, pre_cmd handoff (foreground/background), resumable failure states, robust silent-lock handling, UI visibility flags, more detailed logging and emit traces via system-emit; ensure cleanup and exit tracing.
- Update firstboot.sh: gate completion on unpack coordinator state, add UI hold flags, timeouts, and tracing; use shared show_firstboot_screen helper.
- Update helperFunctions.sh, low_power_warning.sh, networkservices.sh and various device platform scripts (AnbernicXXCommon, MiyooMini, Pixel2, SmartProS, trimui_a133p) to emit structured events (brightness/audio/network/power) and improve PyUI writer lifecycle reporting.
- Add new scripts: power_mode.sh, system-emit (executable) and trace.sh (for tracing/emit support).
- principal.sh: add autoresume protections and validation for /tmp/cmd_to_run.sh.

Overall this improves robustness for unpacking/firstboot workflows, adds observability and tracing, and provides a canonical power-mode contract for coordinated shutdown/sleep handling.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any actual differences here? Is this just a line ending thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No actual difference there - just line endings

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted the line ending noise

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these changes inherited from Sun's branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe these are from overhauling first boot, but I'm not sure if first boot actually requires these.

CatalyticArkun and others added 8 commits March 19, 2026 20:42
Mixed 2/6/8/10-space indent introduced around the system-emit call;
align to the 4-space convention used by the rest of the while loop.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- firstboot.sh: fix ScummVM label ("Installing ScummVM" → "ScummVM") so
  the case match in extract_7z_with_progress activates the ScummVM icon
  and display-text log as intended
- helperFunctions.sh: lift log_scummvm_display_text out of the nested
  position inside extract_7z_with_progress (non-standard POSIX sh; leaked
  into global scope); rename to _log_scummvm_display_text with explicit
  IS_SCUMMVM_SECTION and log-path args; drop dead PROGRESS_TEXT variable
- archiveUnpacker.sh: remove consume_handoff_token_if_present and its
  call site — the startup guard already owns token removal on the hot
  path; the function was unreachable on any other path
- networkservices.sh: fix double-tab indent on two new lines at top of
  disconnect_services (same class as low_power_warning.sh fix)
- save_poweroff.sh: add missing blank line after emit_shutdown_av_trace_fallback

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.

2 participants