summaryrefslogtreecommitdiffstats
path: root/minuitwrp/events.c
diff options
context:
space:
mode:
authorDees_Troy <dees_troy@teamw.in>2013-05-13 21:04:35 +0200
committerDees_Troy <dees_troy@teamw.in>2013-07-01 22:27:21 +0200
commitd86400b59841eca86fb2ea343312e3b333cceee5 (patch)
tree8ed5ca06fa24687b95da13c6ec12cf5bad1c5c96 /minuitwrp/events.c
parentMerge "Allow for more input devices" into twrp2.5 (diff)
downloadandroid_bootable_recovery-d86400b59841eca86fb2ea343312e3b333cceee5.tar
android_bootable_recovery-d86400b59841eca86fb2ea343312e3b333cceee5.tar.gz
android_bootable_recovery-d86400b59841eca86fb2ea343312e3b333cceee5.tar.bz2
android_bootable_recovery-d86400b59841eca86fb2ea343312e3b333cceee5.tar.lz
android_bootable_recovery-d86400b59841eca86fb2ea343312e3b333cceee5.tar.xz
android_bootable_recovery-d86400b59841eca86fb2ea343312e3b333cceee5.tar.zst
android_bootable_recovery-d86400b59841eca86fb2ea343312e3b333cceee5.zip
Diffstat (limited to 'minuitwrp/events.c')
-rw-r--r--minuitwrp/events.c52
1 files changed, 41 insertions, 11 deletions
diff --git a/minuitwrp/events.c b/minuitwrp/events.c
index 0fdddf76f..e73371193 100644
--- a/minuitwrp/events.c
+++ b/minuitwrp/events.c
@@ -331,6 +331,7 @@ static int vk_modify(struct ev *e, struct input_event *ev)
static int discard = 0;
static int lastWasSynReport = 0;
static int touchReleaseOnNextSynReport = 0;
+ static int use_tracking_id_negative_as_touch_release = 0; // On some devices, type: 3 code: 39 value: -1, aka EV_ABS ABS_MT_TRACKING_ID -1 indicates a true touch release
int i;
int x, y;
@@ -433,23 +434,57 @@ static int vk_modify(struct ev *e, struct input_event *ev)
#endif
break;
-#ifdef _EVENT_LOGGING
- // All of these items are strictly for logging purposes only. Return 1 because they don't need to be handled.
case ABS_MT_TOUCH_MINOR: //31
+ if (ev->value == 0) {
+ e->mt_p.x = 0;
+ e->mt_p.y = 0;
+ touchReleaseOnNextSynReport = 1;
+ }
+#ifdef _EVENT_LOGGING
printf("EV: %s => EV_ABS ABS_MT_TOUCH_MINOR %d\n", e->deviceName, ev->value);
- return 1;
+#endif
break;
case ABS_MT_WIDTH_MAJOR: //32
+ if (ev->value == 0) {
+ e->mt_p.x = 0;
+ e->mt_p.y = 0;
+ touchReleaseOnNextSynReport = 1;
+ }
+#ifdef _EVENT_LOGGING
printf("EV: %s => EV_ABS ABS_MT_WIDTH_MAJOR %d\n", e->deviceName, ev->value);
- return 1;
+#endif
break;
case ABS_MT_WIDTH_MINOR: //33
+ if (ev->value == 0) {
+ e->mt_p.x = 0;
+ e->mt_p.y = 0;
+ touchReleaseOnNextSynReport = 1;
+ }
+#ifdef _EVENT_LOGGING
printf("EV: %s => EV_ABS ABS_MT_WIDTH_MINOR %d\n", e->deviceName, ev->value);
- return 1;
+#endif
break;
+ case ABS_MT_TRACKING_ID: //39
+ if (ev->value < 0) {
+ e->mt_p.x = 0;
+ e->mt_p.y = 0;
+ touchReleaseOnNextSynReport = 2;
+ use_tracking_id_negative_as_touch_release = 1;
+#ifdef _EVENT_LOGGING
+ if (use_tracking_id_negative_as_touch_release)
+ printf("using ABS_MT_TRACKING_ID value -1 to indicate touch releases\n");
+#endif
+ }
+#ifdef _EVENT_LOGGING
+ printf("EV: %s => EV_ABS ABS_MT_TRACKING_ID %d\n", e->deviceName, ev->value);
+#endif
+ break;
+
+#ifdef _EVENT_LOGGING
+ // These are for touch logging purposes only
case ABS_MT_ORIENTATION: //34
printf("EV: %s => EV_ABS ABS_MT_ORIENTATION %d\n", e->deviceName, ev->value);
return 1;
@@ -465,11 +500,6 @@ static int vk_modify(struct ev *e, struct input_event *ev)
return 1;
break;
- case ABS_MT_TRACKING_ID: //39
- printf("EV: %s => EV_ABS ABS_MT_TRACKING_ID %d\n", e->deviceName, ev->value);
- return 1;
- break;
-
case ABS_MT_DISTANCE: //3b
printf("EV: %s => EV_ABS ABS_MT_DISTANCE %d\n", e->deviceName, ev->value);
return 1;
@@ -503,7 +533,7 @@ static int vk_modify(struct ev *e, struct input_event *ev)
// Discard the MT versions
if (ev->code == SYN_MT_REPORT) return 0;
- if (lastWasSynReport == 1 || touchReleaseOnNextSynReport == 1)
+ if (((lastWasSynReport == 1 || touchReleaseOnNextSynReport == 1) && !use_tracking_id_negative_as_touch_release) || (use_tracking_id_negative_as_touch_release && touchReleaseOnNextSynReport == 2))
{
// Reset the value
touchReleaseOnNextSynReport = 0;