Skip to content

Commit a0ef6a3

Browse files
rydbergdtor
authored andcommitted
Input: MT - handle semi-mt devices in core
Most semi-mt drivers use the slots in a manual way, but really only need to treat the finger count manually. With this patch, a semi-mt driver may use the input-mt core for everything else. Signed-off-by: Henrik Rydberg <rydberg@euromail.se> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent 7a24677 commit a0ef6a3

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

drivers/input/input-mt.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
7979
}
8080
if (flags & INPUT_MT_DIRECT)
8181
__set_bit(INPUT_PROP_DIRECT, dev->propbit);
82+
if (flags & INPUT_MT_SEMI_MT)
83+
__set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
8284
if (flags & INPUT_MT_TRACK) {
8385
unsigned int n2 = num_slots * num_slots;
8486
mt->red = kcalloc(n2, sizeof(*mt->red), GFP_KERNEL);
@@ -246,6 +248,7 @@ void input_mt_sync_frame(struct input_dev *dev)
246248
{
247249
struct input_mt *mt = dev->mt;
248250
struct input_mt_slot *s;
251+
bool use_count = false;
249252

250253
if (!mt)
251254
return;
@@ -259,7 +262,10 @@ void input_mt_sync_frame(struct input_dev *dev)
259262
}
260263
}
261264

262-
input_mt_report_pointer_emulation(dev, (mt->flags & INPUT_MT_POINTER));
265+
if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT))
266+
use_count = true;
267+
268+
input_mt_report_pointer_emulation(dev, use_count);
263269

264270
mt->frame++;
265271
}

include/linux/input/mt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#define INPUT_MT_DIRECT 0x0002 /* direct device, e.g. touchscreen */
2020
#define INPUT_MT_DROP_UNUSED 0x0004 /* drop contacts not seen in frame */
2121
#define INPUT_MT_TRACK 0x0008 /* use in-kernel tracking */
22+
#define INPUT_MT_SEMI_MT 0x0010 /* semi-mt device, finger count handled manually */
2223

2324
/**
2425
* struct input_mt_slot - represents the state of an input MT slot

0 commit comments

Comments
 (0)