* [PATCH] Input: MT - handle semi-mt devices in core
@ 2013-04-07 19:41 Henrik Rydberg
2013-04-08 4:07 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Henrik Rydberg @ 2013-04-07 19:41 UTC (permalink / raw)
To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, Henrik Rydberg
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>
---
Hi Dmitry,
an earlier version of this patch came about as a test to handle the
synaptics profile sensor without too much extra work. I do not know
how that test panned out (no response), but this patch will likely be
useful regardless.
Henrik
drivers/input/input-mt.c | 8 +++++++-
include/linux/input/mt.h | 1 +
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index 71db193..d398f13 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -79,6 +79,8 @@ int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,
}
if (flags & INPUT_MT_DIRECT)
__set_bit(INPUT_PROP_DIRECT, dev->propbit);
+ if (flags & INPUT_MT_SEMI_MT)
+ __set_bit(INPUT_PROP_SEMI_MT, dev->propbit);
if (flags & INPUT_MT_TRACK) {
unsigned int n2 = num_slots * num_slots;
mt->red = kcalloc(n2, sizeof(*mt->red), GFP_KERNEL);
@@ -246,6 +248,7 @@ void input_mt_sync_frame(struct input_dev *dev)
{
struct input_mt *mt = dev->mt;
struct input_mt_slot *s;
+ bool use_count = false;
if (!mt)
return;
@@ -259,7 +262,10 @@ void input_mt_sync_frame(struct input_dev *dev)
}
}
- input_mt_report_pointer_emulation(dev, (mt->flags & INPUT_MT_POINTER));
+ if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT))
+ use_count = true;
+
+ input_mt_report_pointer_emulation(dev, use_count);
mt->frame++;
}
diff --git a/include/linux/input/mt.h b/include/linux/input/mt.h
index 2e86bd0..1b1dfa8 100644
--- a/include/linux/input/mt.h
+++ b/include/linux/input/mt.h
@@ -19,6 +19,7 @@
#define INPUT_MT_DIRECT 0x0002 /* direct device, e.g. touchscreen */
#define INPUT_MT_DROP_UNUSED 0x0004 /* drop contacts not seen in frame */
#define INPUT_MT_TRACK 0x0008 /* use in-kernel tracking */
+#define INPUT_MT_SEMI_MT 0x0010 /* semi-mt device, finger count handled manually */
/**
* struct input_mt_slot - represents the state of an input MT slot
--
1.8.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Input: MT - handle semi-mt devices in core
2013-04-07 19:41 [PATCH] Input: MT - handle semi-mt devices in core Henrik Rydberg
@ 2013-04-08 4:07 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2013-04-08 4:07 UTC (permalink / raw)
To: Henrik Rydberg; +Cc: linux-input, linux-kernel
On Sun, Apr 07, 2013 at 09:41:32PM +0200, Henrik Rydberg wrote:
> 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>
Applied, thank you Henrik.
--
Dmitry
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-08 4:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-07 19:41 [PATCH] Input: MT - handle semi-mt devices in core Henrik Rydberg
2013-04-08 4:07 ` Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®