Skip to content
Open
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
49c2f3e
Offline RetroAchievements Support (#707)
clintonium-119 May 12, 2026
e0b0013
squash pick DrFlarp/shaders_origtexture (generic_video.c only) (#720)
frysee May 12, 2026
1860006
Pre- and Post App/ROM launch hooks (#690)
Helaas May 12, 2026
02d3dc0
fix: crash on out-of-bound access when loading cheats (#718)
nborodikhin May 12, 2026
7dd51d9
Feature/podman (#711)
carroarmato0 May 12, 2026
8cc8110
Clarified hooks
frysee May 14, 2026
6990d47
feat: Replace userspace CPU governor with kernel scaling governors (#…
pvaibhav May 14, 2026
afb3783
fix: slowdowns on Auto cpu speed (#727)
pvaibhav May 17, 2026
2a9c0d4
refactor: break minarch.c monolith into focused modules (#721)
carroarmato0 May 18, 2026
a3bcf9d
fix: defer Rewind_init until after core initialization to prevent cra…
Helaas May 19, 2026
e9e9113
fix: cpu stuck in performance mode on fresh install (#733)
pvaibhav May 20, 2026
2a5a53c
fix: call readyResume when navigating to a directory via Quick Menu (…
carroarmato0 May 26, 2026
44461cb
feat: support custom fonts in system settings (#729)
ericreinsmidt May 26, 2026
14cae47
feat: font style is now configurable (fixes #748) (#749)
frysee May 27, 2026
d4c01a3
fix: properly detect usb-c cards plugged in before booting (#750)
frysee May 27, 2026
28b7a30
fix: wrong label on game switcher entries w/o save state (#751)
frysee May 27, 2026
11c38be
Merge branch 'main' into my355-latest
apommel May 31, 2026
66e16a2
my355: Adjustments for kernel CPU governors and hooks
apommel Jun 3, 2026
393e222
feat: Port usb-c cards improvements to my355 and use tinyalsa for spe…
apommel Jun 4, 2026
1fbe2b8
fix: Correctly detect Jack and HDMI on my355 at boot
apommel Jun 4, 2026
c24b36d
feat: White point colour correction for tg5040 (#760)
pvaibhav Jun 28, 2026
dfb02b0
Feat: Alpha channel for theme colors and better pill sprite handling …
frysee Jul 3, 2026
372f92c
fix: refresh a2600 core patches for tg5040/tg5050
Copilot Jul 5, 2026
57e53bb
chore: remove unmaintained platforms
frysee Jul 5, 2026
d98888a
Update README with license transition notice
frysee Jul 8, 2026
1ff26e4
Add a missing quote in hook command parser
apommel Jul 8, 2026
1a73536
Merge branch 'main' into my355-latest-rebase
apommel Jul 8, 2026
d392978
my355: No-op functions for white point calibration
apommel Jul 8, 2026
c532ade
my355: refresh a2600 core patch
apommel Jul 8, 2026
f00f430
Chore(deps): Bump actions/checkout from 4.2.2 to 7.0.0 (#768)
dependabot[bot] Jul 9, 2026
410c159
Chore(deps): Bump softprops/action-gh-release from 2 to 3 (#767)
dependabot[bot] Jul 9, 2026
0d32f0d
feat: configurable button hint styles (#763)
frysee Jul 9, 2026
347bfd2
Chore(deps): Bump actions/upload-artifact from 4.6.2 to 7.0.1 (#771)
dependabot[bot] Jul 9, 2026
0012958
Chore(deps): Bump actions/attest-build-provenance from 2.3.0 to 4.1.1…
dependabot[bot] Jul 9, 2026
1672c89
Chore(deps): Bump actions/download-artifact from 4.3.0 to 8.0.1 (#770)
dependabot[bot] Jul 9, 2026
a3f75b8
Merge branch 'main' into my355-latest-rebase
apommel Jul 9, 2026
f91a135
Align my355 launch.sh with other platforms
apommel Jul 9, 2026
0719464
feat: Trimui Brick Pro support (tg4040) (#766)
frysee Jul 10, 2026
89843ef
fix: Don't resume from suspent when lid is closed
apommel Jul 10, 2026
11820a6
my355: add Wi-Fi and BT stop and resume at suspend
apommel Jul 10, 2026
8690158
my355: various fixes
apommel Jul 10, 2026
3bca8b7
fix: unify color parsing (#774)
frysee Jul 10, 2026
d47fb07
fix: trigger LEDs not addressable
frysee Jul 10, 2026
cdeee49
Merge branch 'main' into my355-latest-rebase
apommel Jul 11, 2026
e981d18
fix: L4 and R4 buttons for my355 (NA)
apommel Jul 11, 2026
bade2a4
feat: minput now visualizes stick movements
frysee Jul 12, 2026
45406e1
fix: white point calibration resetting itself
frysee Jul 12, 2026
cd8d31d
fix: playstation symbol mapping for X/Y
frysee Jul 12, 2026
64160e9
fix: brick pro display calibration to be closer to regular Brick
frysee Jul 12, 2026
a2cff6d
fix: cardinal symbol mapping for X/Y
frysee Jul 12, 2026
9dffb9e
fix: L4 and R4 button mappings (#776)
frysee Jul 12, 2026
f524d3b
build: add CONTAINER_MOUNT_OPTS to toolchain container runs (#779)
Pobega Jul 16, 2026
6056a87
Merge remote-tracking branch 'upstream/main' into my355-latest-rebase
apommel Jul 17, 2026
ae262ee
fix(suspend): allow charging on my355 when lid is closed
apommel Jul 17, 2026
ff20289
feat: align Brick/Pro rumble strength a bit more
frysee Jul 17, 2026
a20481b
feat: tuned down the FN key rumble as well
frysee Jul 17, 2026
76c22e9
feat: color palettes (#787)
frysee Jul 19, 2026
983cae5
fix: doubled selection pill title when hardware indicator is shown (#…
ericreinsmidt Jul 19, 2026
aa3e624
feat(tg5040): keep device awake while connected as a USB gadget (#783)
Pobega Jul 19, 2026
73e160c
feat: FN1/FN2/HOME can now launch user-assigned actions (#788)
frysee Jul 19, 2026
ebac427
fix: RetroAchievements identification for custom Paks and multi-syste…
apommel Jul 20, 2026
f964ecc
Merge remote-tracking branch 'upstream/main' into my355-latest-rebase
apommel Jul 20, 2026
337e9db
Add no-op for #783 and #788 on my355
apommel Jul 20, 2026
999c126
Add isUSBConnected impl from tg5040 from #783 to my355
apommel Jul 20, 2026
432b94b
fix: additional consistency with other platforms
apommel Aug 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,8 @@ audiomon.elf

workspace/hash.txt
workspace/readmes
workspace/.container_runtime

AGENTS.md
CLAUDE.md
.worktrees/
87 changes: 87 additions & 0 deletions HOOKS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# About NextUI hooks

## The idea

Hooks are platform-specific, just like paks. The launcher reads them from:

```
$USERDATA_PATH/.hooks/
boot.d/ # scripts run on boot
pre-launch.d/ # scripts run before launch
post-launch.d/ # scripts run after launch exits
pre-sleep.d/ # scripts run before device goes to sleep
post-resume.d/ # scripts run after device wakes from sleep
```

On device, `USERDATA_PATH` resolves to:

```
/mnt/SDCARD/.userdata/$PLATFORM
```

So the actual hook directories on device are:

```
/mnt/SDCARD/.userdata/<platform>/.hooks/pre-launch.d/
/mnt/SDCARD/.userdata/<platform>/.hooks/post-launch.d/

```

Example installed hook path:

```
/mnt/SDCARD/.userdata/tg5040/.hooks/post-launch.d/shortcuts-resume.sh

```

If these directories don't exist, nothing happens and there is no overhead.

## Environment variables

Hook scripts inherit all standard NextUI environment variables (`SDCARD_PATH`, `PLATFORM`, `USERDATA_PATH`, `SHARED_USERDATA_PATH`, etc.) plus these launch-specific ones:

| Variable | Description |
|---|---|
| `HOOK_PHASE` | `pre` or `post` |
| `HOOK_TYPE` | `rom` or `pak` |
| `HOOK_CMD` | The raw launch command |
| `HOOK_EMU_PATH` | Path to the emulator or pak `launch.sh` |
| `HOOK_ROM_PATH` | Path to the ROM file (empty for pak launches) |
| `HOOK_LAST` | Contents of `/tmp/last.txt` (the last selected menu entry) |

These can then be used by the underlying Pak to ingest information about the hook that just occurred.

## Writing a hook script

A hook script is any executable `.sh` file in one of the hook directories. Scripts run in alphabetical order.

```sh
#!/bin/sh
# my-hook.sh — log every ROM launch

[ "$HOOK_TYPE" = "rom" ] || exit 0
echo "$(date): launched $HOOK_ROM_PATH" >> "$LOGS_PATH/launches.log"
```

## Rules

- Each script runs in a subshell. A crash or non-zero exit will not affect the launcher or other hooks.
- Script output (stdout/stderr) is suppressed. If you need logging, write to your own log file.
- Pre-launch hooks cannot cancel the launch. They are for observation and setup only.
- Keep hooks fast. A slow hook delays the launch or the return to the menu.
- Unlike auto.sh, each pak should manage their own hook and use a descriptive filename to avoid collisions.


## Example: sync after ROM exit

```sh
#!/bin/sh
# shortcuts-resume.sh — one-shot resume metadata sync after a ROM exits

[ "$HOOK_TYPE" = "rom" ] || exit 0

SHORTCUTS_PAK="$SDCARD_PATH/Tools/$PLATFORM/Shortcuts.pak"
[ -x "$SHORTCUTS_PAK/shortcuts" ] || exit 0

"$SHORTCUTS_PAK/shortcuts" --resume-sync-hook >> "$LOGS_PATH/shortcuts-resume-sync.txt" 2>&1
```
3 changes: 2 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,9 @@ ifneq (,$(filter $(PLATFORM),tg5040 tg5050 my355))
cp ./workspace/all/minarch/build/$(PLATFORM)/liblzma.so.* ./build/SYSTEM/$(PLATFORM)/lib/
cp ./workspace/all/minarch/build/$(PLATFORM)/libzstd.so.* ./build/SYSTEM/$(PLATFORM)/lib/

# libchdr for RetroAchievements CHD hashing
# libchdr and libcrypto for RetroAchievements
cp ./workspace/all/minarch/build/$(PLATFORM)/libchdr.so.* ./build/SYSTEM/$(PLATFORM)/lib/
cp ./workspace/all/minarch/build/$(PLATFORM)/libcrypto.so.* ./build/SYSTEM/$(PLATFORM)/lib/

ifneq (,$(filter $(PLATFORM),tg5040 my355))
# liblz4 for Rewind support
Expand Down
44 changes: 35 additions & 9 deletions makefile.toolchain
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# there is no reason to use this makefile manually

.PHONY: build clean
.PHONY: build clean _runtime_check

ifeq (,$(PLATFORM))
$(error please specify PLATFORM, eg. make PLATFORM=trimui)
Expand All @@ -13,28 +13,54 @@ GIT_IF_NECESSARY=toolchains/$(PLATFORM)-toolchain
INIT_IF_NECESSARY=toolchains/$(PLATFORM)-toolchain/.build
IMAGE_NAME=ghcr.io/loveretro/$(PLATFORM)-toolchain:latest

CONTAINER_RUNTIME ?= $(shell command -v docker 2>/dev/null || command -v podman 2>/dev/null)
ifeq (,$(CONTAINER_RUNTIME))
$(error Neither docker nor podman found in PATH)
endif

RUNTIME_MARKER := $(HOST_WORKSPACE)/.container_runtime
LAST_RUNTIME := $(shell cat $(RUNTIME_MARKER) 2>/dev/null)
CURRENT_RUNTIME := $(notdir $(CONTAINER_RUNTIME))

all: $(INIT_IF_NECESSARY)
docker run -it --rm -v $(HOST_WORKSPACE):$(GUEST_WORKSPACE) $(IMAGE_NAME) /bin/bash
$(CONTAINER_RUNTIME) run -it --rm -v $(HOST_WORKSPACE):$(GUEST_WORKSPACE) $(IMAGE_NAME) /bin/bash

$(INIT_IF_NECESSARY): $(GIT_IF_NECESSARY)
cd toolchains/$(PLATFORM)-toolchain && make .build

$(GIT_IF_NECESSARY):
mkdir -p toolchains
git clone https://github.com/LoveRetro/$(PLATFORM)-toolchain/ toolchains/$(PLATFORM)-toolchain
docker pull $(IMAGE_NAME) && touch toolchains/$(PLATFORM)-toolchain/.build
$(CONTAINER_RUNTIME) pull $(IMAGE_NAME) && touch toolchains/$(PLATFORM)-toolchain/.build

clean:
cd toolchains/$(PLATFORM)-toolchain && make clean

build: $(INIT_IF_NECESSARY)
docker run --rm -v $(HOST_WORKSPACE):$(GUEST_WORKSPACE) -e COMPILE_CORES=$(COMPILE_CORES) $(IMAGE_NAME) /bin/bash -c '. ~/.bashrc && cd /root/workspace && make'
_runtime_check:
@if [ -n "$(LAST_RUNTIME)" ] && [ "$(LAST_RUNTIME)" != "$(CURRENT_RUNTIME)" ]; then \
echo "Container runtime changed ($(LAST_RUNTIME) -> $(CURRENT_RUNTIME)), cleaning workspace build artifacts..."; \
PREV=$$(command -v $(LAST_RUNTIME) 2>/dev/null); \
if [ -n "$$PREV" ]; then \
$$PREV run --rm -v $(HOST_WORKSPACE):$(GUEST_WORKSPACE) $(IMAGE_NAME) /bin/bash -c \
'find $(GUEST_WORKSPACE) -depth -user root -delete 2>/dev/null; true'; \
else \
echo "Error: previous runtime $(LAST_RUNTIME) not available to clean root-owned artifacts."; \
echo "Run: sudo rm -rf $(HOST_WORKSPACE)/*/build $(HOST_WORKSPACE)/$(PLATFORM)/other"; \
exit 1; \
fi; \
fi

build: $(INIT_IF_NECESSARY) _runtime_check
$(CONTAINER_RUNTIME) run --rm -v $(HOST_WORKSPACE):$(GUEST_WORKSPACE) -e COMPILE_CORES=$(COMPILE_CORES) $(IMAGE_NAME) /bin/bash -c '. ~/.bashrc && cd /root/workspace && make'
@echo "$(CURRENT_RUNTIME)" > $(RUNTIME_MARKER)

build-cores: $(INIT_IF_NECESSARY)
docker run --rm -v $(HOST_WORKSPACE):$(GUEST_WORKSPACE) -e COMPILE_CORES=$(COMPILE_CORES) $(IMAGE_NAME) /bin/bash -c '. ~/.bashrc && cd /root/workspace && make cores'
build-cores: $(INIT_IF_NECESSARY) _runtime_check
$(CONTAINER_RUNTIME) run --rm -v $(HOST_WORKSPACE):$(GUEST_WORKSPACE) -e COMPILE_CORES=$(COMPILE_CORES) $(IMAGE_NAME) /bin/bash -c '. ~/.bashrc && cd /root/workspace && make cores'
@echo "$(CURRENT_RUNTIME)" > $(RUNTIME_MARKER)

build-core: $(INIT_IF_NECESSARY)
build-core: $(INIT_IF_NECESSARY) _runtime_check
ifndef CORE
$(error CORE is not set)
endif
docker run --rm -v $(HOST_WORKSPACE):$(GUEST_WORKSPACE) -e COMPILE_CORES=$(COMPILE_CORES) -e CORE=$(CORE) $(IMAGE_NAME) /bin/bash -c '. ~/.bashrc && cd /root/workspace && make core'
$(CONTAINER_RUNTIME) run --rm -v $(HOST_WORKSPACE):$(GUEST_WORKSPACE) -e COMPILE_CORES=$(COMPILE_CORES) -e CORE=$(CORE) $(IMAGE_NAME) /bin/bash -c '. ~/.bashrc && cd /root/workspace && make core'
@echo "$(CURRENT_RUNTIME)" > $(RUNTIME_MARKER)
36 changes: 36 additions & 0 deletions skeleton/SYSTEM/desktop/bin/run_hooks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh
# run_hooks.sh - shared hook runner for NextUI
# Usage: run_hooks.sh <dir-name> [--sync-only]
#
# dir-name: directory name under $USERDATA_PATH/.hooks/ (e.g. pre-launch.d, boot.d)
# --sync-only: force all scripts to run synchronously
#
# By default, scripts run in the background. Scripts ending in .sync.sh
# always run synchronously. All background scripts are waited on before exit.

DIR_NAME="$1"
SYNC_ONLY="${2:-}"

: "${SDCARD_PATH:=/var/tmp/nextui/sdcard}"
: "${PLATFORM:=desktop}"
: "${USERDATA_PATH:=$SDCARD_PATH/.userdata/$PLATFORM}"

HOOK_DIR="$USERDATA_PATH/.hooks/$DIR_NAME"
[ -d "$HOOK_DIR" ] || exit 0

case "$DIR_NAME" in
pre-*) export HOOK_PHASE="pre" ;;
post-*) export HOOK_PHASE="post" ;;
boot*) export HOOK_PHASE="boot" ;;
esac
export HOOK_CATEGORY="$DIR_NAME"

for script in "$HOOK_DIR"/*.sh; do
[ -f "$script" ] || continue
if [ "$SYNC_ONLY" = "--sync-only" ] || echo "$script" | grep -q '\.sync\.sh$'; then
( "$script" ) > /dev/null 2>&1 || true
else
( "$script" ) > /dev/null 2>&1 &
fi
done
wait
26 changes: 26 additions & 0 deletions skeleton/SYSTEM/desktop/paks/MinUI.pak/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export CORES_PATH="$SYSTEM_PATH/cores"
export USERDATA_PATH="$SDCARD_PATH/.userdata/$PLATFORM"
export SHARED_USERDATA_PATH="$SDCARD_PATH/.userdata/shared"
export LOGS_PATH="$USERDATA_PATH/logs"
export HOOKS_PATH="$USERDATA_PATH/.hooks"
export DATETIME_PATH="$SHARED_USERDATA_PATH/datetime.txt"

mkdir -p "$BIOS_PATH"
Expand All @@ -26,6 +27,7 @@ mkdir -p "$SAVES_PATH"
mkdir -p "$CHEATS_PATH"
mkdir -p "$USERDATA_PATH"
mkdir -p "$LOGS_PATH"
mkdir -p "$HOOKS_PATH"
mkdir -p "$SHARED_USERDATA_PATH/.minui"

export IS_NEXT="yes"
Expand All @@ -45,8 +47,29 @@ if [ -f "$AUTO_PATH" ]; then
"$AUTO_PATH"
fi

# Composable boot hooks (run after auto.sh for backward compatibility)
"$SYSTEM_PATH/bin/run_hooks.sh" boot.d

cd $(dirname "$0")

#######################################
# Hook system

parse_hook_cmd() {
HOOK_CMD="$1"
HOOK_EMU_PATH=$(echo "$HOOK_CMD" | sed "s/^'\\([^']*\\)'.*/\\1/")
_remainder=$(echo "$HOOK_CMD" | sed "s/^'[^']*'//")
if echo "$_remainder" | grep -q "'"; then
HOOK_TYPE="rom"
HOOK_ROM_PATH=$(echo "$_remainder" | sed "s/.*'\\([^']*\\)'.*/\\1/")
else
HOOK_TYPE="pak"
HOOK_ROM_PATH=""
fi
[ -f /tmp/last.txt ] && HOOK_LAST=$(cat /tmp/last.txt) || HOOK_LAST=""
export HOOK_CMD HOOK_EMU_PATH HOOK_TYPE HOOK_ROM_PATH HOOK_LAST
}

#######################################

EXEC_PATH="/tmp/nextui_exec"
Expand All @@ -57,7 +80,10 @@ touch "$EXEC_PATH" && sync

if [ -f $NEXT_PATH ]; then
CMD=`cat $NEXT_PATH`
parse_hook_cmd "$CMD"
"$SYSTEM_PATH/bin/run_hooks.sh" pre-launch.d
eval $CMD
"$SYSTEM_PATH/bin/run_hooks.sh" post-launch.d
rm -f $NEXT_PATH
fi
#done
58 changes: 58 additions & 0 deletions skeleton/SYSTEM/my355/bin/governor.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/sh
# governor.sh - CPU governor controller for MY355
# Usage: governor.sh <mode>
# Modes: auto, performance, powersave

MODE="$1"
[ -z "$MODE" ] && MODE="auto"

set_policy() {
local policy_path="$1"
local governor="$2"
local max_type="$3" # "second_max", "max", or "mid"

[ -f "$policy_path/scaling_available_frequencies" ] || return 0
FREQS=$(cat "$policy_path/scaling_available_frequencies" | tr ' ' '\n' | grep -v '^$' | sort -n)
MIN_FREQ=$(echo "$FREQS" | head -1)

case "$max_type" in
second_max)
MAX_FREQ=$(echo "$FREQS" | tail -2 | head -1)
;;
max)
MAX_FREQ=$(echo "$FREQS" | tail -1)
;;
mid)
COUNT=$(echo "$FREQS" | wc -l)
MID=$(( (COUNT + 1) / 2 ))
MAX_FREQ=$(echo "$FREQS" | sed -n "${MID}p")
;;
*)
MAX_FREQ=$(echo "$FREQS" | tail -1)
;;
esac

echo "$governor" > "$policy_path/scaling_governor" 2>/dev/null || true
echo "$MIN_FREQ" > "$policy_path/scaling_min_freq"
echo "$MAX_FREQ" > "$policy_path/scaling_max_freq"
}

case "$MODE" in
auto)
# schedutil governor, min freq to one step below max (408-1800 MHz on MY355)
set_policy /sys/devices/system/cpu/cpufreq/policy0 "schedutil" "second_max"
;;
performance)
# performance governor, max freq (1992 MHz on MY355)
set_policy /sys/devices/system/cpu/cpufreq/policy0 "performance" "max"
;;
powersave)
# conservative governor, min freq to midpoint max (408-1200 MHz on MY355)
set_policy /sys/devices/system/cpu/cpufreq/policy0 "conservative" "mid"
;;
*)
echo "governor.sh: unknown mode '$MODE'" >&2
echo " Valid modes: auto, performance, powersave" >&2
exit 1
;;
esac
36 changes: 36 additions & 0 deletions skeleton/SYSTEM/my355/bin/run_hooks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh
# run_hooks.sh - shared hook runner for NextUI
# Usage: run_hooks.sh <dir-name> [--sync-only]
#
# dir-name: directory name under $USERDATA_PATH/.hooks/ (e.g. pre-launch.d, boot.d)
# --sync-only: force all scripts to run synchronously
#
# By default, scripts run in the background. Scripts ending in .sync.sh
# always run synchronously. All background scripts are waited on before exit.

DIR_NAME="$1"
SYNC_ONLY="${2:-}"

: "${SDCARD_PATH:=/mnt/SDCARD}"
: "${PLATFORM:=my355}"
: "${USERDATA_PATH:=$SDCARD_PATH/.userdata/$PLATFORM}"

HOOK_DIR="$USERDATA_PATH/.hooks/$DIR_NAME"
[ -d "$HOOK_DIR" ] || exit 0

case "$DIR_NAME" in
pre-*) export HOOK_PHASE="pre" ;;
post-*) export HOOK_PHASE="post" ;;
boot*) export HOOK_PHASE="boot" ;;
esac
export HOOK_CATEGORY="$DIR_NAME"

for script in "$HOOK_DIR"/*.sh; do
[ -f "$script" ] || continue
if [ "$SYNC_ONLY" = "--sync-only" ] || echo "$script" | grep -q '\.sync\.sh$'; then
( "$script" ) > /dev/null 2>&1 || true
else
( "$script" ) > /dev/null 2>&1 &
fi
done
wait
7 changes: 7 additions & 0 deletions skeleton/SYSTEM/my355/bin/suspend
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ fix_sleep_sound_bug() {
before() {
log "Preparing for suspend..."

# Run pre-sleep hooks synchronously before services are stopped.
# Subshell ensures a crashing hook cannot block suspend.
( "$SYSTEM_PATH/bin/run_hooks.sh" pre-sleep.d --sync-only ) >/dev/null 2>&1 || true

# Probably not necessary and dangerous actually
# log "Turning off input"
# echo 0 > /sys/module/gpio_keys_polled/parameters/button_enable
Expand All @@ -35,6 +39,9 @@ after() {
# log "Turning on input"
# echo 1 > /sys/module/gpio_keys_polled/parameters/button_enable

# Run post-resume hooks in background immediately after wake.
( "$SYSTEM_PATH/bin/run_hooks.sh" post-resume.d ) >/dev/null 2>&1 &

log "Restoring brightness"
# TODO save and restore backlight settings
echo 100 > /sys/class/leds/work/brightness
Expand Down
Loading