All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] input: mt: Identify pointer emulation contact
@ 2010-12-09 23:19 Henrik Rydberg
  2010-12-09 23:49 ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Henrik Rydberg @ 2010-12-09 23:19 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Jiri Kosina, linux-input, linux-kernel, Henrik Rydberg

For MT applications, the tracking id provides a robust way to know
when a touch is new; essential information to determine when _not_ to
emit motion events, for instance.  Currently, ST applications do not
have the equivalent information, but instead rely on global properties
such as a change in number of fingers. Moreover, some MT applications
need to know which contact correponds to the pointer. This patch adds
the ABS_TRACKING_ID axis and emits it in
input_mt_report_pointer_emulation(), provided the proper absbit is
setup by the driver.

Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
---
 drivers/input/input-mt.c |    4 +++-
 include/linux/input.h    |    1 +
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c
index afaf059..bcd2c22 100644
--- a/drivers/input/input-mt.c
+++ b/drivers/input/input-mt.c
@@ -105,7 +105,8 @@ EXPORT_SYMBOL(input_mt_report_slot_state);
  * @dev: input device with allocated MT slots
  *
  * Performs legacy pointer emulation via BTN_TOUCH, ABS_X, ABS_Y and
- * ABS_PRESSURE. Touchpad finger count is emulated using
+ * ABS_PRESSURE. If enabled, ABS_TRACKING_ID is emitted whenever the
+ * pointer contact changes. Touchpad finger count is emulated using
  * BTN_TOOL_FINGER, BTN_TOOL_DOUBLETAP, BTN_TOOL_TRIPLETAP and
  * BTN_TOOL_QUADTAP.
  *
@@ -146,6 +147,7 @@ void input_mt_report_pointer_emulation(struct input_dev *dev)
 		input_event(dev, EV_ABS, ABS_X, x);
 		input_event(dev, EV_ABS, ABS_Y, y);
 		input_event(dev, EV_ABS, ABS_PRESSURE, p);
+		input_event(dev, EV_ABS, ABS_TRACKING_ID, oldid);
 	} else {
 		input_event(dev, EV_ABS, ABS_PRESSURE, 0);
 	}
diff --git a/include/linux/input.h b/include/linux/input.h
index 65f7799..01dde9b 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -716,6 +716,7 @@ struct input_keymap_entry {
 #define ABS_TILT_X		0x1a
 #define ABS_TILT_Y		0x1b
 #define ABS_TOOL_WIDTH		0x1c
+#define ABS_TRACKING_ID		0x1d	/* ID of contact governing ABS_{X,Y} */
 
 #define ABS_VOLUME		0x20
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] input: mt: Identify pointer emulation contact
  2010-12-09 23:19 [PATCH] input: mt: Identify pointer emulation contact Henrik Rydberg
@ 2010-12-09 23:49 ` Dmitry Torokhov
  2010-12-10  7:28   ` Henrik Rydberg
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2010-12-09 23:49 UTC (permalink / raw)
  To: Henrik Rydberg; +Cc: Jiri Kosina, linux-input, linux-kernel

On Fri, Dec 10, 2010 at 12:19:05AM +0100, Henrik Rydberg wrote:
> For MT applications, the tracking id provides a robust way to know
> when a touch is new; essential information to determine when _not_ to
> emit motion events, for instance.  Currently, ST applications do not
> have the equivalent information, but instead rely on global properties
> such as a change in number of fingers. Moreover, some MT applications
> need to know which contact correponds to the pointer. This patch adds
> the ABS_TRACKING_ID axis and emits it in
> input_mt_report_pointer_emulation(), provided the proper absbit is
> setup by the driver.
> 

So how do you propose userspace will use it? Obviously it will not help
old dumb (ST) applications and new smart applications should understand
MT protocol and thus do not need to pay much attention to ST events
anyway. Apparently you have some new dumb userspace in mind here?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] input: mt: Identify pointer emulation contact
  2010-12-09 23:49 ` Dmitry Torokhov
@ 2010-12-10  7:28   ` Henrik Rydberg
  2010-12-10 15:11     ` Chris Bagwell
  0 siblings, 1 reply; 4+ messages in thread
From: Henrik Rydberg @ 2010-12-10  7:28 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Jiri Kosina, linux-input, linux-kernel

>

> So how do you propose userspace will use it? Obviously it will not help
> old dumb (ST) applications and new smart applications should understand
> MT protocol and thus do not need to pay much attention to ST events
> anyway. Apparently you have some new dumb userspace in mind here?


You are right, it is a dumb idea. Consider this one dropped.

Thanks,
Henrik

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] input: mt: Identify pointer emulation contact
  2010-12-10  7:28   ` Henrik Rydberg
@ 2010-12-10 15:11     ` Chris Bagwell
  0 siblings, 0 replies; 4+ messages in thread
From: Chris Bagwell @ 2010-12-10 15:11 UTC (permalink / raw)
  To: Henrik Rydberg; +Cc: Dmitry Torokhov, Jiri Kosina, linux-input, linux-kernel

On Fri, Dec 10, 2010 at 1:28 AM, Henrik Rydberg <rydberg@euromail.se> wrote:
>>
>
>> So how do you propose userspace will use it? Obviously it will not help
>> old dumb (ST) applications and new smart applications should understand
>> MT protocol and thus do not need to pay much attention to ST events
>> anyway. Apparently you have some new dumb userspace in mind here?
>
>
> You are right, it is a dumb idea. Consider this one dropped.

If anyone is working on clickpad support, they may want to keep this
idea in mind.  I guess I mean working on clickpads and with simple ST
apps.

If user clicks with one finger, I think currently that user expects
dragging that one finger will move cursor still (click-and-drag).  I'd
think its more usable though to click with one finger and drag with
the other.  During this use case we need to switch pointer tracking
from one finger to the other.

Sending a new tracking ID is an easy way to inform apps about expected
jump in values during switch.  I thought of things like
BTN_TOOL_FINGER=0; sync; BTN_TOOL_FINGER=1 but that looks like tapping
is occurring.

Anyways, as you suggestion, this can be solved by forcing apps to
process MT events so not to big a deal long term.

Chris

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-12-10 15:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-09 23:19 [PATCH] input: mt: Identify pointer emulation contact Henrik Rydberg
2010-12-09 23:49 ` Dmitry Torokhov
2010-12-10  7:28   ` Henrik Rydberg
2010-12-10 15:11     ` Chris Bagwell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.