Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0712af5
fix: suspend script prematurely exits on kernel error retval
DrFlarp Jan 27, 2026
6b6c261
cleanup: remove debugging from suspend script
DrFlarp Jan 27, 2026
00a070e
suspend: set +e the whole script since we always want to run everything
DrFlarp Jan 27, 2026
635224e
chore: temporarily redirect ota source until upstream is updated (#598)
frysee Jan 27, 2026
71d09b5
Fix: avoid calling bluetoothctl when it is likely to block (#600)
frysee Jan 28, 2026
27c46a2
fix: include tg5050 in the release build (#601)
frysee Jan 28, 2026
13d3e0d
Fix: Update release file wildcard (#602)
frysee Jan 28, 2026
e61d6e9
Fix: misplaced mute override to prevent speaker pop on resume (#603)
frysee Jan 28, 2026
3e85550
fix: delete shadercache on boot (#605)
frysee Jan 28, 2026
ab68e64
Fix a few compile issues for x86-64 devices (#591)
clintonium-119 Jan 28, 2026
9766826
Save States: Improve compatibility with RetroArch savestates imported…
DrFlarp Jan 28, 2026
ef4c5b9
Fix: Multi-file disc-based games not launching (#609)
mohammadsyuhada Jan 29, 2026
d46f8f9
deep sleep: move retry logic out of waitForWake
DrFlarp Jan 29, 2026
9698f5d
fix: tg5040 - fix multiple deep sleep bugs and improve responsiveness
DrFlarp Feb 1, 2026
dff8c6e
chore: indentation
DrFlarp Feb 1, 2026
5bc95d2
Fix: properly sanitize wifi passwords (#614)
frysee Jan 29, 2026
cbdc74c
Fix: Paired Bluetooth devices not showing in bluetooth settings (#615)
frysee Jan 29, 2026
4c2cab7
Fix: wifi fails to come up after reboot, if bluetooth is also enabled…
frysee Jan 30, 2026
55f32e3
Fix: return init scripts to dev null (#617)
frysee Jan 30, 2026
83b2c35
Fix: move wifi config back to original location (#621)
frysee Jan 30, 2026
9fc70c7
Fix: Crash when trying to navigate into merged folders (#624)
frysee Jan 31, 2026
ef55d50
Fix: clock pak (#625)
frysee Jan 31, 2026
0915e8c
Fix: scanning for wifi on tg5050 and stock OS 1.0.1 (#626)
frysee Feb 1, 2026
16f31fe
oops: remove debug stuff
DrFlarp Feb 1, 2026
3349467
Revert excess junk from deep sleep fix code
DrFlarp Feb 2, 2026
cfcb84f
Deep sleep: add workaround for false negative state
DrFlarp Feb 2, 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
67 changes: 45 additions & 22 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
matrix:
toolchain:
- tg5040
- tg5050

steps:
- name: Checkout
Expand All @@ -81,6 +82,7 @@ jobs:
matrix:
toolchain:
- tg5040
- tg5050
core: ${{ fromJson(needs.core-matrix.outputs.cores) }}
steps:
- name: Checkout
Expand All @@ -100,19 +102,11 @@ jobs:

build:
needs:
- build-core
- prepare
- build-core
runs-on: ubuntu-24.04-arm
env:
PLATFORM: ${{ matrix.toolchain }}
RELEASE_NAME: ${{ needs.prepare.outputs.release-name }}
RELEASE_VERSION: ${{ needs.prepare.outputs.next-tag }}
strategy:
fail-fast: true
matrix:
toolchain:
- tg5040

steps:
- name: Checkout
uses: actions/[email protected]
Expand All @@ -125,34 +119,63 @@ jobs:
- name: Setup
run: make setup

- name: Download Cores
- name: Download Cores (tg5040)
uses: actions/[email protected]
with:
path: workspace/${{ env.PLATFORM }}/cores/output/
pattern: core-${{ matrix.toolchain }}-*
path: workspace/tg5040/cores/output/
pattern: core-tg5040-*
merge-multiple: true

- name: Build (tg5040)
run: make tg5040
env:
PLATFORM: tg5040

- name: Download Cores (tg5050)
uses: actions/[email protected]
with:
path: workspace/tg5050/cores/output/
pattern: core-tg5050-*
merge-multiple: true

- name: Build
run: make ${{ matrix.toolchain }}
- name: Build (tg5050)
run: make tg5050
env:
PLATFORM: tg5050

- name: Special
run: make special

# note: when multiple platforms are built
# the package step will need to be revamped to
# merge the release files from each platform into
# a single release
- name: Package
run: make package

- name: Upload Artifacts
- name: Upload All
uses: actions/[email protected]
with:
name: release-${{ matrix.toolchain }}.zip
path: releases/
name: ${{ env.RELEASE_NAME }}-all.zip
path: releases/${{ env.RELEASE_NAME }}-all.zip

- name: Upload Base
uses: actions/[email protected]
with:
name: ${{ env.RELEASE_NAME }}-base.zip
path: releases/${{ env.RELEASE_NAME }}-base.zip

- name: Upload Extras
uses: actions/[email protected]
with:
name: ${{ env.RELEASE_NAME }}-extras.zip
path: releases/${{ env.RELEASE_NAME }}-extras.zip

- name: Skip Attest for PRs from forks
id: skip
if: github.ref != 'refs/heads/main'
run: |
echo '::warning title=Attest skipped::Attest action requires permissions and is performed only for main branch.'

- name: Attest Build Provenance
uses: actions/[email protected]
if: github.ref == 'refs/heads/main'
with:
subject-path: |
releases/${{ env.RELEASE_NAME }}-all.zip
Expand All @@ -174,7 +197,7 @@ jobs:
uses: actions/[email protected]
with:
path: releases/
pattern: release-*
pattern: NextUI-*
merge-multiple: true

- name: Create and Push Tag
Expand Down
12 changes: 12 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@
"preLaunchTask": "make desktop",
"envFile": "${workspaceFolder}/.env_desktop",
},
{
"name": "App: Clock",
"request": "launch",
"type": "cppdbg",
"osx": {
"MIMode": "lldb"
},
"cwd": "${workspaceFolder}/workspace/all/clock/build/desktop",
"program": "${workspaceFolder}/workspace/all/clock/build/desktop/clock.elf",
"preLaunchTask": "make desktop",
"envFile": "${workspaceFolder}/.env_desktop",
},
{
"name": "App: Gametimectl",
"request": "launch",
Expand Down
3 changes: 2 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RELEASE_NAME ?= $(RELEASE_BASE)-$(RELEASE_DOT)
VENDOR_DEST := ./build/VENDOR/Tools
PACKAGE_URL_MAPPINGS := \
"https://github.com/UncleJunVIP/nextui-pak-store/releases/latest/download/Pak.Store.pakz nextui.pak_store.pakz" \
"https://github.com/LanderN/nextui-updater-pak/releases/latest/download/nextui-updater-pak.zip nextui.updater.pakz"
"https://github.com/frysee/nextui-updater-pak/releases/latest/download/nextui.updater.pakz nextui.updater.pakz"
# add more URLs as needed

###########################################################
Expand Down Expand Up @@ -100,6 +100,7 @@ endif
cp ./workspace/all/nextui/build/$(PLATFORM)/nextui.elf ./build/SYSTEM/$(PLATFORM)/bin/
cp ./workspace/all/minarch/build/$(PLATFORM)/minarch.elf ./build/SYSTEM/$(PLATFORM)/bin/
cp ./workspace/all/nextval/build/$(PLATFORM)/nextval.elf ./build/SYSTEM/$(PLATFORM)/bin/
cp ./workspace/all/clock/build/$(PLATFORM)/clock.elf ./build/EXTRAS/Tools/$(PLATFORM)/Clock.pak/
cp ./workspace/all/minput/build/$(PLATFORM)/minput.elf ./build/EXTRAS/Tools/$(PLATFORM)/Input.pak/
cp ./workspace/all/settings/build/$(PLATFORM)/settings.elf ./build/EXTRAS/Tools/$(PLATFORM)/Settings.pak/
ifeq ($(PLATFORM), tg5040)
Expand Down
43 changes: 41 additions & 2 deletions skeleton/SYSTEM/tg5040/bin/suspend
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh
set -euo pipefail
set -uo pipefail
set +e
exec 0<&-

#logfile="/mnt/SDCARD/.userdata/tg5040/logs/suspend_$(date +%Y%m%d_%H%M%S).log"
Expand All @@ -8,6 +9,8 @@ exec 0<&-
wifid_running=
bluetoothd_running=

sleep_retval=

asound_state_dir=/tmp/asound-suspend

before() {
Expand All @@ -28,6 +31,7 @@ before() {
>&2 echo "Stopping wpa_supplicant..."
/etc/wifi/wifi_init.sh stop || true
fi

}

after() {
Expand All @@ -48,10 +52,45 @@ after() {
# alsactl --file "$asound_state_dir/asound.state.pre" restore || true
}


before


>&2 echo "Suspending..."
echo mem >/sys/power/state
sleep_max_tries=5
for i in $(seq 1 $sleep_max_tries); do
>&2 echo "Deep sleep attempt $i of $sleep_max_tries"

sleep_time=$(date +%s)

echo mem >/sys/power/state
sleep_retval=$?

>&2 echo "Deep sleep: kernel returned $sleep_retval"
if [ $sleep_retval -eq 0 ]; then
break
fi

# Really hard to debug this edge case where the system sleeps successfully
# but still returns nonzero
wake_time=$(date +%s)

time_asleep=$(($wake_time-$sleep_time))

# This device has a nasty habit of returning false negatives
# once in a blue moon; if device was asleep for more than
# x seconds, wake up regardless of return value.
if [ $time_asleep -gt 5 ]; then
>&2 echo "Deep sleep: false negative caught - (sleep for $time_asleep secs)"
sleep_retval=0
break
fi


>&2 echo "Deep sleep failed: retrying in 3 seconds"
sleep 3
done

# Resume services in background to reduce UI latency
after &
exit $sleep_retval
39 changes: 19 additions & 20 deletions skeleton/SYSTEM/tg5040/etc/bluetooth/bt_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ start_bt() {
# bluealsa -p a2dp-source --keep-alive=-1 &
bluealsa -p a2dp-source &
sleep 1
# Power on adapter
bluetoothctl power on 2>/dev/null

# Set discoverable and pairable
bluetoothctl discoverable on 2>/dev/null
bluetoothctl pairable on 2>/dev/null

# Set default agent for automatic pairing (no input/output)
bluetoothctl agent NoInputNoOutput 2>/dev/null
bluetoothctl default-agent 2>/dev/null

# Set adapter name
bluetoothctl system-alias "$DEVICE_NAME" 2>/dev/null
}

# Power on adapter
bluetoothctl power on 2>/dev/null

# Set discoverable and pairable
bluetoothctl discoverable on 2>/dev/null
bluetoothctl pairable on 2>/dev/null

# Set default agent for automatic pairing (no input/output)
bluetoothctl agent NoInputNoOutput 2>/dev/null
bluetoothctl default-agent 2>/dev/null

# Set adapter name
bluetoothctl system-alias "$DEVICE_NAME" 2>/dev/null
}

ble_start() {
Expand Down Expand Up @@ -104,16 +104,15 @@ stop_bt() {
# stop bluealsa
killall bluealsa 2>/dev/null

# stop bluetoothctl
bluetoothctl power off 2>/dev/null
#bluetoothctl discoverable off 2>/dev/null
bluetoothctl pairable off 2>/dev/null
#bluetoothctl remove $(bluetoothctl devices | awk '{print $2}') 2>/dev/null
killall bluetoothctl 2>/dev/null

# Stop bluetooth service
d=`ps | grep bluetoothd | grep -v grep`
[ -n "$d" ] && {
# stop bluetoothctl
bluetoothctl power off 2>/dev/null
#bluetoothctl discoverable off 2>/dev/null
bluetoothctl pairable off 2>/dev/null
#bluetoothctl remove $(bluetoothctl devices | awk '{print $2}') 2>/dev/null
killall bluetoothctl 2>/dev/null
killall bluetoothd
sleep 1
}
Expand Down
4 changes: 2 additions & 2 deletions skeleton/SYSTEM/tg5040/etc/wifi/wifi_init.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

WIFI_INTERFACE="wlan0"
WPA_SUPPLICANT_CONF="/etc/wifi/wpa_supplicant/wpa_supplicant.conf"
WPA_SUPPLICANT_CONF="/etc/wifi/wpa_supplicant.conf"

start() {
# Unblock wifi via rfkill
Expand All @@ -11,7 +11,7 @@ start() {
if [ ! -f "$WPA_SUPPLICANT_CONF" ]; then
mkdir -p "$(dirname "$WPA_SUPPLICANT_CONF")"
cat > "$WPA_SUPPLICANT_CONF" << 'EOF'
# cat /etc/wifi/wpa_supplicant/wpa_supplicant.conf
# cat /etc/wifi/wpa_supplicant.conf
ctrl_interface=/etc/wifi/sockets
disable_scan_offload=1
update_config=1
Expand Down
3 changes: 3 additions & 0 deletions skeleton/SYSTEM/tg5040/paks/MinUI.pak/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ if [ -f "/etc/init.d/lcservice" ]; then
rm /etc/init.d/lcservice
fi

# clear shadercache unconditionally, until it properly invalidates itself
rm -rf $SDCARD_PATH/.shadercache

#PD11 pull high for VCC-5v
echo 107 > /sys/class/gpio/export
echo -n out > /sys/class/gpio/gpio107/direction
Expand Down
24 changes: 22 additions & 2 deletions skeleton/SYSTEM/tg5050/bin/suspend
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh
set -euo pipefail
set -uo pipefail
set -e
exec 0<&-

#logfile="/mnt/SDCARD/.userdata/tg5040/logs/suspend_$(date +%Y%m%d_%H%M%S).log"
Expand All @@ -8,6 +9,8 @@ exec 0<&-
wifid_running=
bluetoothd_running=

sleep_retval=

asound_state_dir=/tmp/asound-suspend

before() {
Expand Down Expand Up @@ -51,7 +54,24 @@ after() {
before

>&2 echo "Suspending..."
echo mem >/sys/power/state
sleep_max_tries=10
for i in $(seq 1 $sleep_max_tries); do
>&2 echo "Deep sleep attempt $i of $sleep_max_tries"

# Can't use | true here, it would crash out on non-zero return.
echo mem >/sys/power/state
sleep_retval=$?

>&2 echo "Deep sleep: kernel returned $sleep_retval"
if [ $sleep_retval -eq 0 ]; then
break
fi

>&2 echo "Deep sleep failed: retrying in 2 seconds"
sleep 2
done

# Resume services in background to reduce UI latency
after &

exit $sleep_retval
Loading
Loading