Implement power button monitor, document device input devices
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -33,6 +33,19 @@ All required shared libraries are pre-installed. Most are at `/usr/lib/`, some a
|
||||
|
||||
Shared libraries are already present — no need to bundle or build them. A native aarch64 compile (e.g. inside the arm64 Docker container) produces working binaries. Must link against glibc ≤ 2.35.
|
||||
|
||||
## Input Devices
|
||||
|
||||
Three input devices are registered via `/proc/bus/input/devices`:
|
||||
|
||||
| Device | Handlers | Purpose |
|
||||
|--------|----------|---------|
|
||||
| `axp2202-pek` | `event0` | Power button (`KEY_POWER`, code 116) |
|
||||
| `ANBERNIC-keys` | `event1`, `js0` | Gamepad (d-pad, face buttons) |
|
||||
| `dierct-keys-polled` | `event2` | Shoulder buttons, menu/function keys |
|
||||
|
||||
- **logind**: `HandlePowerKey=ignore` in `/etc/systemd/logind.conf` — systemd does not act on the power button, leaving it free for userspace handling.
|
||||
- **evtest**: Available at `/usr/bin/evtest` for debugging input events.
|
||||
|
||||
## Partition Layout
|
||||
|
||||
| Device | Mount point | Filesystem | Contents |
|
||||
|
||||
@@ -43,6 +43,10 @@ This document specifies the functional requirements for an SDL2 based media play
|
||||
|
||||
## 6. Changelog
|
||||
|
||||
### 2026-02-13 — Power button monitor in device wrapper
|
||||
|
||||
- **Power button handling**: The `rg35xx-wrapper.sh` script now monitors `/dev/input/event0` (`axp2202-pek`) for `KEY_POWER` press events via `evtest`. On power button press, sends SIGTERM to sdlamp2 (which saves position and volume), waits 1 second, then calls `poweroff` for a clean shutdown.
|
||||
|
||||
### 2026-02-13 — Clean shutdown on SIGTERM/SIGINT
|
||||
|
||||
- **Signal handling**: sdlamp2 now catches SIGTERM and SIGINT via a `sig_atomic_t` flag checked in the main loop. On signal, the existing cleanup path runs (save position, save volume, close decoder, SDL_Quit) instead of being killed instantly. This ensures position is saved when the system shuts down or the process is terminated by a wrapper script.
|
||||
|
||||
Reference in New Issue
Block a user