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:
parent
f49442d7b7
commit
a65a341a00
6 changed files with 55 additions and 3 deletions
|
@ -65,6 +65,9 @@ static bool phones_present = false;
|
|||
#ifdef HAVE_LINEOUT_DETECTION
|
||||
static bool lineout_present = false;
|
||||
#endif
|
||||
#ifdef HAVE_SW_POWEROFF
|
||||
static bool enable_sw_poweroff = true;
|
||||
#endif
|
||||
|
||||
/* how long until repeat kicks in, in centiseconds */
|
||||
#define REPEAT_START (30*HZ/100)
|
||||
|
@ -280,7 +283,8 @@ static void button_tick(void)
|
|||
which doesn't shut down easily with the OFF
|
||||
key */
|
||||
#ifdef HAVE_SW_POWEROFF
|
||||
if ((btn & POWEROFF_BUTTON
|
||||
if (enable_sw_poweroff &&
|
||||
(btn & POWEROFF_BUTTON
|
||||
#ifdef RC_POWEROFF_BUTTON
|
||||
|| btn == RC_POWEROFF_BUTTON
|
||||
#endif
|
||||
|
@ -773,3 +777,13 @@ void button_enable_touch(bool en)
|
|||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SW_POWEROFF
|
||||
void button_set_sw_poweroff_state(bool en) {
|
||||
enable_sw_poweroff = en;
|
||||
}
|
||||
|
||||
bool button_get_sw_poweroff_state() {
|
||||
return enable_sw_poweroff;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue