1
0
Fork 0
forked from len0rd/rockbox

button: allow disabling software poweroff

On some devices, the button driver allows a "software poweroff" by long-
pressing a certain key. This behavior is inconvnient when that button needs
to be held down for other purposes, such as moving the cursor in rockpaint
or sgt-untangle.

This patch allows selectively disabling the software poweroff (enabled by
default) from both core and plugin code.

Change-Id: I7580752888ae5c7c7c5eb1be5966e3d67f17d4b4
This commit is contained in:
Franklin Wei 2020-06-26 20:53:15 -04:00
parent f49442d7b7
commit a65a341a00
6 changed files with 55 additions and 3 deletions

View file

@ -66,6 +66,21 @@ void backlight_use_settings(void)
#endif /* CONFIG_CHARGING */
}
#ifdef HAVE_SW_POWEROFF
static bool original_sw_poweroff_state = true;
void sw_poweroff_disable(void)
{
original_sw_poweroff_state = rb->button_get_sw_poweroff_state();
rb->button_set_sw_poweroff_state(false);
}
void sw_poweroff_restore(void)
{
rb->button_set_sw_poweroff_state(original_sw_poweroff_state);
}
#endif
#ifdef HAVE_REMOTE_LCD
/* Force the backlight on */
void remote_backlight_force_on(void)

View file

@ -29,6 +29,16 @@
void backlight_force_on(void);
void backlight_ignore_timeout(void);
void backlight_use_settings(void);
#ifdef HAVE_SW_POWEROFF
/**
* Disable and restore software poweroff (i.e. holding PLAY on iPods).
* Only call _restore() if _disable() was called earlier!
*/
void sw_poweroff_disable(void);
void sw_poweroff_restore(void);
#endif
#ifdef HAVE_REMOTE_LCD
void remote_backlight_force_on(void);
void remote_backlight_ignore_timeout(void);