forked from len0rd/rockbox
rgnano: Sleep timer and idle poweroff support
Actually power off the handheld with the sleep timer and idle poweroff functions instead of closing rockbox. This commit also moves setting system volume to max from the launch script to system-sdl.c so it works when running rockbox via instant play. Change-Id: I174b67c6abef451faa05f4a8f52b8d9eeed98a22
This commit is contained in:
parent
5ecb5832e1
commit
c9e16e4888
6 changed files with 38 additions and 28 deletions
|
@ -80,9 +80,7 @@ void ip_reset_values(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ip_handle_sigusr1(int sig)
|
void ip_power_off(void)
|
||||||
{
|
|
||||||
if (sig == SIGUSR1)
|
|
||||||
{
|
{
|
||||||
/* Stop the powerdown countdown */
|
/* Stop the powerdown countdown */
|
||||||
system("powerdown handle");
|
system("powerdown handle");
|
||||||
|
@ -103,4 +101,11 @@ void ip_handle_sigusr1(int sig)
|
||||||
/* Powerdown the handheld after writting the file */
|
/* Powerdown the handheld after writting the file */
|
||||||
system("powerdown now");
|
system("powerdown now");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ip_handle_sigusr1(int sig)
|
||||||
|
{
|
||||||
|
if (sig == SIGUSR1)
|
||||||
|
{
|
||||||
|
ip_power_off();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#ifndef _INSTANT_PLAY_H_
|
#ifndef _INSTANT_PLAY_H_
|
||||||
#define _INSTANT_PLAY_H_
|
#define _INSTANT_PLAY_H_
|
||||||
|
|
||||||
void ip_handle_sigusr1(int sig);
|
|
||||||
void ip_reset_values(void);
|
void ip_reset_values(void);
|
||||||
|
void ip_power_off(void);
|
||||||
|
void ip_handle_sigusr1(int sig);
|
||||||
#endif /* _INSTANT_PLAY_H_ */
|
#endif /* _INSTANT_PLAY_H_ */
|
||||||
|
|
|
@ -586,16 +586,18 @@ static void button_event(int key, bool pressed)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if (CONFIG_PLATFORM & PLATFORM_PANDORA) || defined(RG_NANO)
|
#if (CONFIG_PLATFORM & PLATFORM_PANDORA)
|
||||||
#ifdef RG_NANO
|
|
||||||
case SDLK_q:
|
|
||||||
#else
|
|
||||||
case SDLK_LCTRL:
|
case SDLK_LCTRL:
|
||||||
#endif
|
|
||||||
/* Will post SDL_USEREVENT in shutdown_hw() if successful. */
|
/* Will post SDL_USEREVENT in shutdown_hw() if successful. */
|
||||||
sys_poweroff();
|
sys_poweroff();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef RG_NANO
|
||||||
|
case SDLK_q:
|
||||||
|
/* Use reboot to exit without shutting down */
|
||||||
|
sys_reboot();
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
#ifdef HAS_BUTTON_HOLD
|
#ifdef HAS_BUTTON_HOLD
|
||||||
case SDLK_h:
|
case SDLK_h:
|
||||||
if(pressed)
|
if(pressed)
|
||||||
|
|
|
@ -202,6 +202,7 @@ void power_off(void)
|
||||||
#if defined(RG_NANO) && !defined(SIMULATOR)
|
#if defined(RG_NANO) && !defined(SIMULATOR)
|
||||||
/* Reset volume/brightness to the values before launching rockbox */
|
/* Reset volume/brightness to the values before launching rockbox */
|
||||||
ip_reset_values();
|
ip_reset_values();
|
||||||
|
ip_power_off();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SDL_THREADS
|
#ifdef HAVE_SDL_THREADS
|
||||||
|
@ -252,6 +253,9 @@ void system_init(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(RG_NANO) && !defined(SIMULATOR)
|
#if defined(RG_NANO) && !defined(SIMULATOR)
|
||||||
|
/* Set system volume to max with amixer */
|
||||||
|
system("amixer -q sset 'Headphone' 63 unmute");
|
||||||
|
|
||||||
/* Instant play handling */
|
/* Instant play handling */
|
||||||
struct sigaction ip_sa;
|
struct sigaction ip_sa;
|
||||||
ip_sa.sa_handler = ip_handle_sigusr1;
|
ip_sa.sa_handler = ip_handle_sigusr1;
|
||||||
|
@ -305,6 +309,8 @@ void system_reboot(void)
|
||||||
#if defined(RG_NANO) && !defined(SIMULATOR)
|
#if defined(RG_NANO) && !defined(SIMULATOR)
|
||||||
/* Reset volume/brightness to the values before launching rockbox */
|
/* Reset volume/brightness to the values before launching rockbox */
|
||||||
ip_reset_values();
|
ip_reset_values();
|
||||||
|
SDL_Quit();
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SDL_THREADS
|
#ifdef HAVE_SDL_THREADS
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# .cfg file created by rockbox c145f41658-250621 - http://www.rockbox.org
|
# .cfg file created by rockbox c145f41658-250621 - http://www.rockbox.org
|
||||||
|
|
||||||
idle poweroff: 0
|
|
||||||
font: /FunKey/.rockbox/fonts/16-GNU-Unifont.fnt
|
font: /FunKey/.rockbox/fonts/16-GNU-Unifont.fnt
|
||||||
database scan paths: /Music
|
database scan paths: /Music
|
||||||
qs top: brightness
|
qs top: brightness
|
||||||
|
|
|
@ -39,9 +39,6 @@ if [ ! -f $CFGFILE ]; then
|
||||||
cp ./config.cfg $CFGFILE
|
cp ./config.cfg $CFGFILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set volume to max with amixer so it's not permanent
|
|
||||||
amixer -q sset 'Headphone' 63 unmute
|
|
||||||
|
|
||||||
# Need to send SIGUSR1 to the rockbox process for instant play support
|
# Need to send SIGUSR1 to the rockbox process for instant play support
|
||||||
trap _send_sigusr1 SIGUSR1
|
trap _send_sigusr1 SIGUSR1
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue