mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
FS13241: Get rid of the hacky hold switch emulation on the X3ii & X20
It doesn't work properly and interferes with the power button in the keymap. Rework WPS keymap a bit to make single-tap power emulate lock. Change-Id: I9d9b9b4adcea3764e6e427f484e051c9bab9d13b
This commit is contained in:
parent
c6f66cf696
commit
914114fd21
6 changed files with 8 additions and 48 deletions
|
|
@ -49,7 +49,7 @@ static const struct button_mapping button_context_standard[] = {
|
||||||
|
|
||||||
static const struct button_mapping button_context_wps[] = {
|
static const struct button_mapping button_context_wps[] = {
|
||||||
{ ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
|
{ ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
|
||||||
{ ACTION_WPS_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
|
{ ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
|
||||||
{ ACTION_WPS_SKIPPREV, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
|
{ ACTION_WPS_SKIPPREV, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
|
||||||
{ ACTION_WPS_SEEKBACK, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
|
{ ACTION_WPS_SEEKBACK, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
{ ACTION_WPS_STOPSEEK, BUTTON_PREV|BUTTON_REL, BUTTON_PREV|BUTTON_REPEAT },
|
{ ACTION_WPS_STOPSEEK, BUTTON_PREV|BUTTON_REL, BUTTON_PREV|BUTTON_REPEAT },
|
||||||
|
|
@ -61,10 +61,11 @@ static const struct button_mapping button_context_wps[] = {
|
||||||
{ ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
|
{ ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
|
||||||
{ ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
{ ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
{ ACTION_WPS_BROWSE, BUTTON_HOME|BUTTON_REL, BUTTON_HOME },
|
{ ACTION_WPS_BROWSE, BUTTON_HOME|BUTTON_REL, BUTTON_HOME },
|
||||||
{ ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
|
{ ACTION_WPS_CONTEXT, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME },
|
||||||
{ ACTION_WPS_MENU, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION },
|
{ ACTION_WPS_MENU, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION },
|
||||||
{ ACTION_WPS_QUICKSCREEN, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_OPTION },
|
{ ACTION_WPS_QUICKSCREEN, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_OPTION },
|
||||||
{ ACTION_WPS_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME },
|
|
||||||
|
{ ACTION_STD_KEYLOCK, BUTTON_POWER, BUTTON_NONE },
|
||||||
|
|
||||||
LAST_ITEM_IN_LIST
|
LAST_ITEM_IN_LIST
|
||||||
}; /* button_context_wps */
|
}; /* button_context_wps */
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ static const struct button_mapping button_context_standard[] = {
|
||||||
|
|
||||||
static const struct button_mapping button_context_wps[] = {
|
static const struct button_mapping button_context_wps[] = {
|
||||||
{ ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
|
{ ACTION_WPS_PLAY, BUTTON_PLAY|BUTTON_REL, BUTTON_PLAY },
|
||||||
{ ACTION_WPS_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
|
{ ACTION_WPS_STOP, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
|
||||||
{ ACTION_WPS_SKIPPREV, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
|
{ ACTION_WPS_SKIPPREV, BUTTON_PREV|BUTTON_REL, BUTTON_PREV },
|
||||||
{ ACTION_WPS_SEEKBACK, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
|
{ ACTION_WPS_SEEKBACK, BUTTON_PREV|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
{ ACTION_WPS_STOPSEEK, BUTTON_PREV|BUTTON_REL, BUTTON_PREV|BUTTON_REPEAT },
|
{ ACTION_WPS_STOPSEEK, BUTTON_PREV|BUTTON_REL, BUTTON_PREV|BUTTON_REPEAT },
|
||||||
|
|
@ -61,10 +61,11 @@ static const struct button_mapping button_context_wps[] = {
|
||||||
{ ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
|
{ ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
|
||||||
{ ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
{ ACTION_WPS_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
{ ACTION_WPS_BROWSE, BUTTON_HOME|BUTTON_REL, BUTTON_HOME },
|
{ ACTION_WPS_BROWSE, BUTTON_HOME|BUTTON_REL, BUTTON_HOME },
|
||||||
{ ACTION_WPS_CONTEXT, BUTTON_PLAY|BUTTON_REPEAT, BUTTON_PLAY },
|
{ ACTION_WPS_CONTEXT, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME },
|
||||||
{ ACTION_WPS_MENU, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION },
|
{ ACTION_WPS_MENU, BUTTON_OPTION|BUTTON_REL, BUTTON_OPTION },
|
||||||
{ ACTION_WPS_QUICKSCREEN, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_OPTION },
|
{ ACTION_WPS_QUICKSCREEN, BUTTON_OPTION|BUTTON_REPEAT, BUTTON_OPTION },
|
||||||
{ ACTION_WPS_HOTKEY, BUTTON_HOME|BUTTON_REPEAT, BUTTON_HOME },
|
|
||||||
|
{ ACTION_STD_KEYLOCK, BUTTON_POWER, BUTTON_NONE },
|
||||||
|
|
||||||
LAST_ITEM_IN_LIST
|
LAST_ITEM_IN_LIST
|
||||||
}; /* button_context_wps */
|
}; /* button_context_wps */
|
||||||
|
|
|
||||||
|
|
@ -73,9 +73,6 @@
|
||||||
/* KeyPad configuration for plugins */
|
/* KeyPad configuration for plugins */
|
||||||
#define CONFIG_KEYPAD XDUOO_X20_PAD
|
#define CONFIG_KEYPAD XDUOO_X20_PAD
|
||||||
|
|
||||||
/* Define this if a programmable hotkey is mapped */
|
|
||||||
#define HAVE_HOTKEY
|
|
||||||
|
|
||||||
/* define this if the target has volume keys which can be used in the lists */
|
/* define this if the target has volume keys which can be used in the lists */
|
||||||
#define HAVE_VOLUME_IN_LIST
|
#define HAVE_VOLUME_IN_LIST
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,9 +73,6 @@
|
||||||
/* KeyPad configuration for plugins */
|
/* KeyPad configuration for plugins */
|
||||||
#define CONFIG_KEYPAD XDUOO_X3II_PAD
|
#define CONFIG_KEYPAD XDUOO_X3II_PAD
|
||||||
|
|
||||||
/* Define this if a programmable hotkey is mapped */
|
|
||||||
#define HAVE_HOTKEY
|
|
||||||
|
|
||||||
/* define this if the target has volume keys which can be used in the lists */
|
/* define this if the target has volume keys which can be used in the lists */
|
||||||
#define HAVE_VOLUME_IN_LIST
|
#define HAVE_VOLUME_IN_LIST
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,6 @@
|
||||||
#ifndef _BUTTON_TARGET_H_
|
#ifndef _BUTTON_TARGET_H_
|
||||||
#define _BUTTON_TARGET_H_
|
#define _BUTTON_TARGET_H_
|
||||||
|
|
||||||
#define HAS_BUTTON_HOLD
|
|
||||||
|
|
||||||
/* Main unit's buttons */
|
/* Main unit's buttons */
|
||||||
#define BUTTON_POWER 0x00000001
|
#define BUTTON_POWER 0x00000001
|
||||||
#define BUTTON_HOME 0x00000002
|
#define BUTTON_HOME 0x00000002
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,6 @@
|
||||||
#include "backlight-target.h"
|
#include "backlight-target.h"
|
||||||
#include "xduoolinux_codec.h"
|
#include "xduoolinux_codec.h"
|
||||||
|
|
||||||
static bool soft_hold = false;
|
|
||||||
#ifndef BOOTLOADER
|
|
||||||
static unsigned soft_hold_counter = 0;
|
|
||||||
#define SOFT_HOLD_BUTTON BUTTON_POWER
|
|
||||||
#define SOFT_HOLD_CNTMAX_1 (HZ)
|
|
||||||
#define SOFT_HOLD_CNTMAX_2 (HZ*2)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define NR_POLL_DESC 3
|
#define NR_POLL_DESC 3
|
||||||
static struct pollfd poll_fds[NR_POLL_DESC];
|
static struct pollfd poll_fds[NR_POLL_DESC];
|
||||||
|
|
||||||
|
|
@ -141,27 +133,6 @@ int button_read_device(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef BOOTLOADER
|
|
||||||
if (button_bitmap == SOFT_HOLD_BUTTON) {
|
|
||||||
soft_hold_counter++;
|
|
||||||
if (soft_hold_counter == SOFT_HOLD_CNTMAX_1) {
|
|
||||||
soft_hold = !soft_hold;
|
|
||||||
backlight_hold_changed(soft_hold);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if (soft_hold_counter == SOFT_HOLD_CNTMAX_2) {
|
|
||||||
soft_hold = false;
|
|
||||||
backlight_hold_changed(soft_hold);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
soft_hold_counter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((soft_hold) && (button_bitmap != SOFT_HOLD_BUTTON)) {
|
|
||||||
return BUTTON_NONE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return button_bitmap;
|
return button_bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -187,8 +158,3 @@ void button_close_device(void)
|
||||||
close(poll_fds[i].fd);
|
close(poll_fds[i].fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool button_hold(void)
|
|
||||||
{
|
|
||||||
return soft_hold;
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue