Skip to content
Permalink
Browse files
[powerkey] Add enablers for configuring touchscreen gestures. Fixes M…
…ER#1537

Traditionally the only touchscreen gesture that has been able to wake
the device from suspend has been the double tap. Now there are devices
that support more gestures for waking up the device, but there are no
means to differentiate / configure actions taken based on the various
gestures.

MCE already assumes EV_MSC:MSC_GESTURE event with value 4 is double tap.
Extend on this and assume that also other gestures get reported in the
similar fashion.

Move gesture event handling from tklock.c to powerkey.c.

Drop support for double tap setting and make gesture actions configurable
similarly to what can be done with power key presses.

Increase the number of user configurable dbus actions to 10. Tweak the
related mcetool options so that instead of N similar but separate
options (--set-powerkey-dbus-actionN=args) there is just one that takes
action index as the first parameter (--set-powerkey-dbus-action=N,args).

Add mcetool --set-touchscreen-gesture-actions options for configuring the
gesture actions. Retain the old --set-doubletap-mode as an alias for the
sake of backwards compatibility.
  • Loading branch information
spiiroin committed Mar 7, 2016
1 parent 2192358 commit 9fe42f8b428ea688079ecba77e2fed3734a53e04
Showing with 746 additions and 432 deletions.
  1. +4 −0 .depend
  2. +75 −6 builtin-gconf.c
  3. +17 −0 evdev.h
  4. +10 −7 event-input.c
  5. +443 −62 powerkey.c
  6. +56 −36 powerkey.h
  7. +29 −176 tklock.c
  8. +0 −18 tklock.h
  9. +112 −127 tools/mcetool.c
@@ -914,6 +914,7 @@ powerkey.o:\
powerkey.c\
builtin-gconf.h\
datapipe.h\
evdev.h\
libwakelock.h\
mce-conf.h\
mce-dbus.h\
@@ -922,13 +923,15 @@ powerkey.o:\
mce-lib.h\
mce-log.h\
mce.h\
modules/doubletap.h\
powerkey.h\
tklock.h\

powerkey.pic.o:\
powerkey.c\
builtin-gconf.h\
datapipe.h\
evdev.h\
libwakelock.h\
mce-conf.h\
mce-dbus.h\
@@ -937,6 +940,7 @@ powerkey.pic.o:\
mce-lib.h\
mce-log.h\
mce.h\
modules/doubletap.h\
powerkey.h\
tklock.h\

@@ -1245,12 +1245,6 @@ static const setting_t gconf_defaults[] =
.type = "b",
.def = G_STRINGIFY(DEFAULT_TK_INPUT_POLICY_ENABLED),
},
{
// MCE_GCONF_TK_DOUBLE_TAP_GESTURE_PATH @ tklock.h
.key = "/system/osso/dsm/locks/tklock_double_tap_gesture",
.type = "i",
.def = "1",
},
{
.key = MCE_GCONF_TK_VOLKEY_POLICY,
.type = "i",
@@ -1673,6 +1667,61 @@ static const setting_t gconf_defaults[] =
.type = "s",
.def = DEFAULT_POWERKEY_ACTIONS_LONG_OFF,
},
{
.key = MCE_GCONF_POWERKEY_ACTIONS_GESTURE0,
.type = "s",
.def = DEFAULT_POWERKEY_ACTIONS_GESTURE0,
},
{
.key = MCE_GCONF_POWERKEY_ACTIONS_GESTURE1,
.type = "s",
.def = DEFAULT_POWERKEY_ACTIONS_GESTURE1,
},
{
.key = MCE_GCONF_POWERKEY_ACTIONS_GESTURE2,
.type = "s",
.def = DEFAULT_POWERKEY_ACTIONS_GESTURE2,
},
{
.key = MCE_GCONF_POWERKEY_ACTIONS_GESTURE3,
.type = "s",
.def = DEFAULT_POWERKEY_ACTIONS_GESTURE3,
},
{
.key = MCE_GCONF_POWERKEY_ACTIONS_GESTURE4,
.type = "s",
.def = DEFAULT_POWERKEY_ACTIONS_GESTURE4,
},
{
.key = MCE_GCONF_POWERKEY_ACTIONS_GESTURE5,
.type = "s",
.def = DEFAULT_POWERKEY_ACTIONS_GESTURE5,
},
{
.key = MCE_GCONF_POWERKEY_ACTIONS_GESTURE6,
.type = "s",
.def = DEFAULT_POWERKEY_ACTIONS_GESTURE6,
},
{
.key = MCE_GCONF_POWERKEY_ACTIONS_GESTURE7,
.type = "s",
.def = DEFAULT_POWERKEY_ACTIONS_GESTURE7,
},
{
.key = MCE_GCONF_POWERKEY_ACTIONS_GESTURE8,
.type = "s",
.def = DEFAULT_POWERKEY_ACTIONS_GESTURE8,
},
{
.key = MCE_GCONF_POWERKEY_ACTIONS_GESTURE9,
.type = "s",
.def = DEFAULT_POWERKEY_ACTIONS_GESTURE9,
},
{
.key = MCE_GCONF_POWERKEY_ACTIONS_GESTURE10,
.type = "s",
.def = DEFAULT_POWERKEY_ACTIONS_GESTURE10,
},
{
.key = MCE_GCONF_POWERKEY_DBUS_ACTION1,
.type = "s",
@@ -1703,6 +1752,26 @@ static const setting_t gconf_defaults[] =
.type = "s",
.def = DEFAULT_POWERKEY_DBUS_ACTION6,
},
{
.key = MCE_GCONF_POWERKEY_DBUS_ACTION7,
.type = "s",
.def = DEFAULT_POWERKEY_DBUS_ACTION7,
},
{
.key = MCE_GCONF_POWERKEY_DBUS_ACTION8,
.type = "s",
.def = DEFAULT_POWERKEY_DBUS_ACTION8,
},
{
.key = MCE_GCONF_POWERKEY_DBUS_ACTION9,
.type = "s",
.def = DEFAULT_POWERKEY_DBUS_ACTION9,
},
{
.key = MCE_GCONF_POWERKEY_DBUS_ACTION10,
.type = "s",
.def = DEFAULT_POWERKEY_DBUS_ACTION10,
},
{
.key = MCE_GCONF_MEMNOTIFY_WARNING_USED,
.type = "i",
17 evdev.h
@@ -13,6 +13,23 @@ extern "C" {
} /* fool JED indentation ... */
#endif

/** Assumed EV_MSC:MSC_GESTURE event values
*
* Actual gestures / values depend on hw and kernel driver - these are
* meant to be used mainly to improve code readability.
*
* However GESTURE_DOUBLETAP is a special case as it is assumed by
* mce to always mean doubletap.
*/
typedef enum {
GESTURE_SWIPE_FROM_LEFT = 0,
GESTURE_SWIPE_FROM_RIGHT = 1,
GESTURE_SWIPE_FROM_TOP = 2,
GESTURE_SWIPE_FROM_BOTTOM = 3,
GESTURE_DOUBLETAP = 4, /* To conform with value used in
* Nokia N9 kernel driver */
} gesture_t;

const char *evdev_get_event_code_name(int etype, int ecode);
const char *evdev_get_event_type_name(int etype);

@@ -1723,7 +1723,7 @@ evin_iomon_touchscreen_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read)
mce_log(LL_DEVEL, "[doubletap] emulated from touch input");
ev->type = EV_MSC;
ev->code = MSC_GESTURE;
ev->value = 0x4;
ev->value = GESTURE_DOUBLETAP;
}
break;
default:
@@ -1756,7 +1756,7 @@ evin_iomon_touchscreen_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read)
*/
ev->type = EV_MSC;
ev->code = MSC_GESTURE;
ev->value = 0x4;
ev->value = GESTURE_DOUBLETAP;
}

/* Ignore unwanted events */
@@ -1775,11 +1775,14 @@ evin_iomon_touchscreen_cb(mce_io_mon_t *iomon, gpointer data, gsize bytes_read)
if( submode & MCE_EVEATER_SUBMODE )
goto EXIT;

/* Only send pressure and gesture events */
if( (ev->type == EV_ABS && ev->code == ABS_PRESSURE) ||
(ev->type == EV_KEY && ev->code == BTN_TOUCH ) ||
(ev->type == EV_MSC && ev->code == MSC_GESTURE ) ) {
/* For now there's no reason to cache the value */
if( ev->type == EV_MSC && ev->code == MSC_GESTURE ) {
/* Gesture events are handled in powerkey.c */
execute_datapipe(&keypress_pipe, &ev,
USE_INDATA, DONT_CACHE_INDATA);
}
else if( (ev->type == EV_ABS && ev->code == ABS_PRESSURE) ||
(ev->type == EV_KEY && ev->code == BTN_TOUCH ) ) {
/* Only send pressure events */
execute_datapipe(&touchscreen_pipe, &ev,
USE_INDATA, DONT_CACHE_INDATA);
}

0 comments on commit 9fe42f8

Please sign in to comment.