Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: MT - add INPUT_MT_TOTAL_FORCE flags

Add a flag to generate ABS_PRESSURE as sum of ABS_MT_PRESSURE across
all slots.
This flag should be set if one knows a device reports true force and would
like to report total force to the userspace.

Signed-off-by: Angela Czubak <aczubak@google.com>
Co-developed-by: Jonathan Denose <jdenose@google.com>
Signed-off-by: Jonathan Denose <jdenose@google.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>

authored by

Angela Czubak and committed by
Benjamin Tissoires
4e584ac7 a77efca3

+11 -4
+10 -4
drivers/input/input-mt.c
··· 198 198 struct input_mt *mt = dev->mt; 199 199 struct input_mt_slot *oldest; 200 200 int oldid, count, i; 201 + int p, reported_p = 0; 201 202 202 203 if (!mt) 203 204 return; ··· 216 215 if ((id - oldid) & TRKID_SGN) { 217 216 oldest = ps; 218 217 oldid = id; 218 + } 219 + if (test_bit(ABS_MT_PRESSURE, dev->absbit)) { 220 + p = input_mt_get_value(ps, ABS_MT_PRESSURE); 221 + if (mt->flags & INPUT_MT_TOTAL_FORCE) 222 + reported_p += p; 223 + else if (oldid == id) 224 + reported_p = p; 219 225 } 220 226 count++; 221 227 } ··· 253 245 input_event(dev, EV_ABS, ABS_X, x); 254 246 input_event(dev, EV_ABS, ABS_Y, y); 255 247 256 - if (test_bit(ABS_MT_PRESSURE, dev->absbit)) { 257 - int p = input_mt_get_value(oldest, ABS_MT_PRESSURE); 258 - input_event(dev, EV_ABS, ABS_PRESSURE, p); 259 - } 248 + if (test_bit(ABS_MT_PRESSURE, dev->absbit)) 249 + input_event(dev, EV_ABS, ABS_PRESSURE, reported_p); 260 250 } else { 261 251 if (test_bit(ABS_MT_PRESSURE, dev->absbit)) 262 252 input_event(dev, EV_ABS, ABS_PRESSURE, 0);
+1
include/linux/input/mt.h
··· 17 17 #define INPUT_MT_DROP_UNUSED 0x0004 /* drop contacts not seen in frame */ 18 18 #define INPUT_MT_TRACK 0x0008 /* use in-kernel tracking */ 19 19 #define INPUT_MT_SEMI_MT 0x0010 /* semi-mt device, finger count handled manually */ 20 + #define INPUT_MT_TOTAL_FORCE 0x0020 /* calculate total force from slots pressure */ 20 21 21 22 /** 22 23 * struct input_mt_slot - represents the state of an input MT slot