1
0
Fork 0
forked from len0rd/rockbox

rgnano: Instant play support and proper system brightness/volume handling

Instant play is a Funkey OS feature that allows it to relaunch at boot the last program it was running before shutting down, which means that if the handheld is powered off (holding the power button) while rockbox is running the next time it's powered on rockbox will launch at boot.

This commit also handles system brightness/volume in rockbox itself instead of the launch script, so the values are properly reset when powering off the handheld while rockbox is running.

Change-Id: Ie1adbf71069aeed5fbf6670971718a2f718716a3
This commit is contained in:
Hairo R. Carela 2025-08-05 22:56:17 -04:00 committed by Solomon Peachy
parent 16a6ad032f
commit 46d10dda33
5 changed files with 167 additions and 7 deletions

View file

@ -50,6 +50,11 @@
#include "maemo-thread.h"
#endif
#ifdef RG_NANO
#include <signal.h>
#include "instant_play.h"
#endif
#define SIMULATOR_DEFAULT_ROOT "simdisk"
#if SDL_MAJOR_VERSION == 1
@ -193,6 +198,11 @@ void power_off(void)
/* wait for event thread to finish */
SDL_WaitThread(evt_thread, NULL);
#ifdef RG_NANO
/* Reset volume/brightness to the values before launching rockbox */
ip_reset_values();
#endif
#ifdef HAVE_SDL_THREADS
/* lock again before entering the scheduler */
sim_thread_lock(t);
@ -240,6 +250,13 @@ void system_init(void)
g_type_init();
#endif
#ifdef RG_NANO
/* Instant play handling */
struct sigaction ip_sa;
ip_sa.sa_handler = ip_handle_sigusr1;
sigaction(SIGUSR1, &ip_sa, NULL);
#endif
if (SDL_InitSubSystem(SDL_INIT_TIMER))
panicf("%s", SDL_GetError());
@ -284,6 +301,11 @@ void system_init(void)
void system_reboot(void)
{
#ifdef RG_NANO
/* Reset volume/brightness to the values before launching rockbox */
ip_reset_values();
#endif
#ifdef HAVE_SDL_THREADS
sim_thread_exception_wait();
#else