Skip to contentSkip to conversation

Mixed "pen" and multitouch input devices

DISCUSSION Thorsten Wissmann 4 participants 13 messages Mar 15, 2012 – Mar 20, 2012 HID

lore
Share & tools
lore
#0 lore raw

Hi,

we are working on already existing multitouch driver for a Promethean ActivBoard, which supports both multiple fingers and pens. The pens behave Wacom-like, i.e. the device actually can tell a cursor position without a button action.

Because of the (up to 4) fingers, we use the input_mt_* functions. Is it possible to just update the cursor position without a button action? (As it is can be done with plain input_* functions?) Or do we have to create two input devices? (one with multitouch input_mt_* and one for the pens?)

Information about our context: We took the partial working and GPL licensed driver code out of /usr/src/ of [3] and enabled the multitouch parts of it.

Thorsten

[1] http://git.cs.fau.de/?p=re06huxa/promethean-activboard
[2] git clone git://git.cs.fau.de/re06huxa/promethean-activboard/
[3] http://activsoftware.co.uk/linux/repos/debian/pool/oss/a/activdriver/activdriver_5.7.23-2~debian~squeeze_amd64.deb

#1 lore raw

2012/3/15 Thorsten Wissmann <[email protected]>:

Quoted 7 lines

Hi,

we are working on already existing multitouch driver for a Promethean ActivBoard, which supports both multiple fingers and pens. The pens behave Wacom-like, i.e. the device actually can tell a cursor position without a button action.

Quoted 9 lines

Because of the (up to 4) fingers, we use the input_mt_* functions. Is it possible to just update the cursor position without a button action? (As it is can be done with plain input_* functions?) Or do we have to create two input devices? (one with multitouch input_mt_* and one for the pens?)

Information about our context: We took the partial working and GPL licensed driver code out of /usr/src/ of [3] and enabled the multitouch parts of it.

I'm not quite sure what you mean by updating cursor position without a button action. By button action, do you mean BTN_TOOL_*? It is true you need to set correct BTN_TOOL_* before updating any X/Y coordinates so user land knows that X/Y maps to.

Its also true that sharing ABS_X/Y events between both a BTN_TOOL_PEN and a BTN_TOOL_FINGER will confuse most user land apps (they think only touchpads can declare BTN_TOOL_FINGER's but this is a touchscreen) and it also has bad side affects to the kernel's MT pointer emulation functions.

You can look at kernel drivers/input/touchscreen/wacom_w8001.c for an example touchscreen that supports pen and at least 2 MT touches on a single /dev/input device (because HW packets come over single serial interface). It does not declare a BTN_TOOL_FINGER nor use pointer emulation to overcome issues I mentioned and xf86-input-wacom understands how to handle this device.

If you want to work with other unmodified user land apps (perhaps xf86-input-evdev for touches) then its probably easiest to split pen and touch to separate input devices. drivers/input/tablet/wacom_wac.c shows some examples of that approach but that driver doesn't have to work to hard to split in to 2 input devices because the USB device already puts the events on separate USB interfaces.

Chris

#2 lore raw

Thank You for your quick answer!

Quoted 11 lines · Chris Bagwell

2012/3/15 Thorsten Wissmann <[email protected]>:

Quoted 9 lines

we are working on already existing multitouch driver for a Promethean ActivBoard, which supports both multiple fingers and pens. The pens behave Wacom-like, i.e. the device actually can tell a cursor position without a button action.

Because of the (up to 4) fingers, we use the input_mt_* functions. Is it possible to just update the cursor position without a button action? (As it is can be done with plain input_* functions?) Or do we have to create two input devices? (one with multitouch input_mt_* and one for the pens?)

Quoted 4 lines

I'm not quite sure what you mean by updating cursor position without a button action. By button action, do you mean BTN_TOOL_*? It is true you need to set correct BTN_TOOL_* before updating any X/Y coordinates so user land knows that X/Y maps to.

With "updating cursor position without a button action" we meant something like moving a "normal" mouse without pressing any button. (Which generates just mouse motion events for X applications)

Quoted 13 lines

Its also true that sharing ABS_X/Y events between both a BTN_TOOL_PEN and a BTN_TOOL_FINGER will confuse most user land apps (they think only touchpads can declare BTN_TOOL_FINGER's but this is a touchscreen) and it also has bad side affects to the kernel's MT pointer emulation functions.

You can look at kernel drivers/input/touchscreen/wacom_w8001.c for an example touchscreen that supports pen and at least 2 MT touches on a single /dev/input device (because HW packets come over single serial interface). It does not declare a BTN_TOOL_FINGER nor use pointer emulation to overcome issues I mentioned and xf86-input-wacom understands how to handle this device.

Quoted 6 lines

If you want to work with other unmodified user land apps (perhaps xf86-input-evdev for touches) then its probably easiest to split pen and touch to separate input devices. drivers/input/tablet/wacom_wac.c shows some examples of that approach but that driver doesn't have to work to hard to split in to 2 input devices because the USB device already puts the events on separate USB interfaces.

OK. We want the device to work with the xf86-input-evdev driver. So we will split it into two devices.

Thorsten

#3 lore raw
Quoted 21 lines · Thorsten Wissmann
Quoted 13 lines · Chris Bagwell

Its also true that sharing ABS_X/Y events between both a BTN_TOOL_PEN and a BTN_TOOL_FINGER will confuse most user land apps (they think only touchpads can declare BTN_TOOL_FINGER's but this is a touchscreen) and it also has bad side affects to the kernel's MT pointer emulation functions.

You can look at kernel drivers/input/touchscreen/wacom_w8001.c for an example touchscreen that supports pen and at least 2 MT touches on a single /dev/input device (because HW packets come over single serial interface). It does not declare a BTN_TOOL_FINGER nor use pointer emulation to overcome issues I mentioned and xf86-input-wacom understands how to handle this device.

Quoted 6 lines

If you want to work with other unmodified user land apps (perhaps xf86-input-evdev for touches) then its probably easiest to split pen and touch to separate input devices. drivers/input/tablet/wacom_wac.c shows some examples of that approach but that driver doesn't have to work to hard to split in to 2 input devices because the USB device already puts the events on separate USB interfaces.

Quoted 2 lines

OK. We want the device to work with the xf86-input-evdev driver. So we will split it into two devices.

Or you could teach evdev to know how to handle mixed devices :). I think that's the "better" approach over all, but it's up to you.

-- Chase

#4 lore raw
Quoted 9 lines · Chase Douglas
Quoted 8 lines · Thorsten Wissmann
Quoted 6 lines · Chris Bagwell

If you want to work with other unmodified user land apps (perhaps xf86-input-evdev for touches) then its probably easiest to split pen and touch to separate input devices. drivers/input/tablet/wacom_wac.c shows some examples of that approach but that driver doesn't have to work to hard to split in to 2 input devices because the USB device already puts the events on separate USB interfaces.

Quoted 5 lines
Quoted 2 lines

OK. We want the device to work with the xf86-input-evdev driver. So we will split it into two devices.

Or you could teach evdev to know how to handle mixed devices :). I think that's the "better" approach over all, but it's up to you.

Thanks! We didn't thought about this. It turned out that the problem isn't caused by the usage of both BTN_TOOL_PEN and BTN_TOOL_FINGER.

It turned out xf86-input-evdev really discards all non-multitouch events (especially ABS_X and ABS_Y) events in EvdevProcessAbsoluteMotionEvent() in evdev.c, if the device is configured as a multitouch device. So there is a quick fix (or only workaround?), which processes ABS_X and ABS_Y events even if it is a multitouch device:

src/evdev.c +0 -0
index d540b87..b857b83 100644
@@ -832,7 +832,7 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo,

struct input_event *ev)

     if (ev->code >= ABS_MT_SLOT) {
         EvdevProcessTouchEvent(pInfo, ev);
         pEvdev->abs_queued = 1;
-    } else if (!pEvdev->mt_mask) {
+    } else if (!pEvdev->mt_mask || ev->code == ABS_X || ev->code ==
ABS_Y) {
         map = pEvdev->axis_map[ev->code];
         valuator_mask_set(pEvdev->vals, map, value);
         pEvdev->abs_queued = 1;

This patch already is submitted to the xorg bugtracker and can be found at [1].

The only remaining question is: Does it break other drivers?

Max and Thorsten

[1] https://bugs.freedesktop.org/show_bug.cgi?id=47382

Signature · 1 line
1.7.9.3
#5 lore raw
Quoted 41 lines · Thorsten Wissmann
Quoted 9 lines · Chase Douglas
Quoted 8 lines · Thorsten Wissmann
Quoted 6 lines · Chris Bagwell

If you want to work with other unmodified user land apps (perhaps xf86-input-evdev for touches) then its probably easiest to split pen and touch to separate input devices. drivers/input/tablet/wacom_wac.c shows some examples of that approach but that driver doesn't have to work to hard to split in to 2 input devices because the USB device already puts the events on separate USB interfaces.

Quoted 5 lines
Quoted 2 lines

OK. We want the device to work with the xf86-input-evdev driver. So we will split it into two devices.

Or you could teach evdev to know how to handle mixed devices :). I think that's the "better" approach over all, but it's up to you.

Thanks! We didn't thought about this. It turned out that the problem isn't caused by the usage of both BTN_TOOL_PEN and BTN_TOOL_FINGER.

It turned out xf86-input-evdev really discards all non-multitouch events (especially ABS_X and ABS_Y) events in EvdevProcessAbsoluteMotionEvent() in evdev.c, if the device is configured as a multitouch device. So there is a quick fix (or only workaround?), which processes ABS_X and ABS_Y events even if it is a multitouch device:

src/evdev.c +1 -1
index d540b87..b857b83 100644
@@ -832,7 +832,7 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo,
 struct input_event *ev)
     if (ev->code >= ABS_MT_SLOT) {
         EvdevProcessTouchEvent(pInfo, ev);
         pEvdev->abs_queued = 1;
-    } else if (!pEvdev->mt_mask) {
+    } else if (!pEvdev->mt_mask || ev->code == ABS_X || ev->code ==
 ABS_Y) {
         map = pEvdev->axis_map[ev->code];
         valuator_mask_set(pEvdev->vals, map, value);
         pEvdev->abs_queued = 1;
Quoted 8 lines

This patch already is submitted to the xorg bugtracker and can be found at [1].

The only remaining question is: Does it break other drivers?

Max and Thorsten

[1] https://bugs.freedesktop.org/show_bug.cgi?id=47382

Great!

I haven't fully thought about it enough to give a reviewed-by, but it seems sane.

I suggest sending the patch to [email protected]. That's where most patch reviews are handled. You will likely get faster results there.

-- Chase

#6 lore raw
Quoted 32 lines · Chase Douglas
Quoted 22 lines · Thorsten Wissmann

It turned out xf86-input-evdev really discards all non-multitouch events (especially ABS_X and ABS_Y) events in EvdevProcessAbsoluteMotionEvent() in evdev.c, if the device is configured as a multitouch device. So there is a quick fix (or only workaround?), which processes ABS_X and ABS_Y events even if it is a multitouch device:

src/evdev.c +1 -1
index d540b87..b857b83 100644
@@ -832,7 +832,7 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo,
 struct input_event *ev)
     if (ev->code >= ABS_MT_SLOT) {
         EvdevProcessTouchEvent(pInfo, ev);
         pEvdev->abs_queued = 1;
-    } else if (!pEvdev->mt_mask) {
+    } else if (!pEvdev->mt_mask || ev->code == ABS_X || ev->code ==
 ABS_Y) {
         map = pEvdev->axis_map[ev->code];
         valuator_mask_set(pEvdev->vals, map, value);
         pEvdev->abs_queued = 1;
Quoted 6 lines

This patch already is submitted to the xorg bugtracker and can be found at [1].

The only remaining question is: Does it break other drivers?

[1] https://bugs.freedesktop.org/show_bug.cgi?id=47382

Great!

Quoted 5 lines

I haven't fully thought about it enough to give a reviewed-by, but it seems sane.

I suggest sending the patch to [email protected]. That's where most patch reviews are handled. You will likely get faster results there.

I have sent it to [email protected]. (I haven't noticed it, because only the web-bugtracker is noted in the README)

Thank you very much

Max
Thorsten

#7 lore raw
In reply to Chase Douglas
Quoted 53 lines · Chase Douglas
Quoted 41 lines · Thorsten Wissmann
Quoted 9 lines · Chase Douglas
Quoted 8 lines · Thorsten Wissmann
Quoted 6 lines · Chris Bagwell

If you want to work with other unmodified user land apps (perhaps xf86-input-evdev for touches) then its probably easiest to split pen and touch to separate input devices.  drivers/input/tablet/wacom_wac.c shows some examples of that approach but that driver doesn't have to work to hard to split in to 2 input devices because the USB device already puts the events on separate USB  interfaces.

Quoted 5 lines
Quoted 2 lines

OK. We want the device to work with the xf86-input-evdev driver. So we will split it into two devices.

Or you could teach evdev to know how to handle mixed devices :). I think that's the "better" approach over all, but it's up to you.

Thanks! We didn't thought about this. It turned out that the problem isn't caused by the usage of both BTN_TOOL_PEN and BTN_TOOL_FINGER.

It turned out xf86-input-evdev really discards all non-multitouch events (especially ABS_X and ABS_Y) events in EvdevProcessAbsoluteMotionEvent() in evdev.c, if the device is configured as a multitouch device. So there is a quick fix (or only workaround?), which processes ABS_X and ABS_Y events even if it is a multitouch device:

src/evdev.c +1 -1
index d540b87..b857b83 100644
@@ -832,7 +832,7 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo,
 struct input_event *ev)
      if (ev->code >= ABS_MT_SLOT) {
          EvdevProcessTouchEvent(pInfo, ev);
          pEvdev->abs_queued = 1;
-    } else if (!pEvdev->mt_mask) {
+    } else if (!pEvdev->mt_mask || ev->code == ABS_X || ev->code ==
 ABS_Y) {
          map = pEvdev->axis_map[ev->code];

         valuator_mask_set(pEvdev->vals, map, value); pEvdev->abs_queued = 1;

Quoted 8 lines

This patch already is submitted to the xorg bugtracker and can be found at [1].

The only remaining question is: Does it break other drivers?

    Max and Thorsten

[1] https://bugs.freedesktop.org/show_bug.cgi?id=47382

Great!

Quoted 7 lines

I haven't fully thought about it enough to give a reviewed-by, but it seems sane.

I suggest sending the patch to [email protected]. That's where most patch reviews are handled. You will likely get faster results there.

-- Chase

Yep, agree thats also a great way to go.

One thing I might suggest is to include with patch your thinking on how a pen+multitouch device should send events to help in review of the patch. Just the basics. For example, from above patch I have an assumption that your sending ABS_X/Y only for PEN events and ABS_MT_POSITION_X/Y only for touch events; but then again I'm not 100% sure of that .

If ABS_X/Y is only for PEN events, then pEvdev->in_proximity in xf86-input-evdev may be a less restrictive check to allow even BTN_STYLUS and ABS_X/Y events to be processed.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw
Quoted 33 lines · Chris Bagwell
Quoted 32 lines · Chase Douglas
Quoted 22 lines · Thorsten Wissmann

It turned out xf86-input-evdev really discards all non-multitouch events (especially ABS_X and ABS_Y) events in EvdevProcessAbsoluteMotionEvent() in evdev.c, if the device is configured as a multitouch device. So there is a quick fix (or only workaround?), which processes ABS_X and ABS_Y events even if it is a multitouch device:

src/evdev.c +1 -1
index d540b87..b857b83 100644
@@ -832,7 +832,7 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo,
 struct input_event *ev)
      if (ev->code >= ABS_MT_SLOT) {
          EvdevProcessTouchEvent(pInfo, ev);
          pEvdev->abs_queued = 1;
-    } else if (!pEvdev->mt_mask) {
+    } else if (!pEvdev->mt_mask || ev->code == ABS_X || ev->code ==
 ABS_Y) {
          map = pEvdev->axis_map[ev->code];

         valuator_mask_set(pEvdev->vals, map, value); pEvdev->abs_queued = 1;

Quoted 6 lines

This patch already is submitted to the xorg bugtracker and can be found at [1].

The only remaining question is: Does it break other drivers?

[1] https://bugs.freedesktop.org/show_bug.cgi?id=47382

Great!

Quoted 7 lines
Quoted 5 lines

I haven't fully thought about it enough to give a reviewed-by, but it seems sane.

I suggest sending the patch to [email protected]. That's where most patch reviews are handled. You will likely get faster results there.

Yep, agree thats also a great way to go.

Thanks!

Quoted 6 lines

One thing I might suggest is to include with patch your thinking on how a pen+multitouch device should send events to help in review of the patch. Just the basics. For example, from above patch I have an assumption that your sending ABS_X/Y only for PEN events and ABS_MT_POSITION_X/Y only for touch events; but then again I'm not 100% sure of that.

That's correct. In our case, it's ABS_X/Y for pen, ABS_MT_* for fingers (normal touches). But maybe other devices behave different. So we should send something like this as an addition to the patch on the x.org list?

# finger touch
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID 42
    ABS_MT_POSITION_X finger_x
    ABS_MT_POSITION_Y finger_y
    SYN_MT_REPORT
    SYN_REPORT
# finger release
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID -1
    SYN_REPORT
# pen motion
    ABS_X pen_x
    ABS_Y pen_y
    SYN_REPORT
Quoted 3 lines

If ABS_X/Y is only for PEN events, then pEvdev->in_proximity in xf86-input-evdev may be a less restrictive check to allow even BTN_STYLUS and ABS_X/Y events to be processed.

The actual event source (if PEN or STYLUS or ...) shouldn't matter. (Or I just don't get your point)

Thorsten
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw
Quoted 55 lines · Thorsten Wissmann
Quoted 33 lines · Chris Bagwell
Quoted 32 lines · Chase Douglas
Quoted 22 lines · Thorsten Wissmann

It turned out xf86-input-evdev really discards all non-multitouch events (especially ABS_X and ABS_Y) events in EvdevProcessAbsoluteMotionEvent() in evdev.c, if the device is configured as a multitouch device. So there is a quick fix (or only workaround?), which processes ABS_X and ABS_Y events even if it is a multitouch device:

src/evdev.c +1 -1
index d540b87..b857b83 100644
@@ -832,7 +832,7 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo,
 struct input_event *ev)
     if (ev->code >= ABS_MT_SLOT) {
         EvdevProcessTouchEvent(pInfo, ev);
         pEvdev->abs_queued = 1;
-    } else if (!pEvdev->mt_mask) {
+    } else if (!pEvdev->mt_mask || ev->code == ABS_X || ev->code ==
 ABS_Y) {
         map = pEvdev->axis_map[ev->code];
         valuator_mask_set(pEvdev->vals, map, value);
         pEvdev->abs_queued = 1;
Quoted 6 lines

This patch already is submitted to the xorg bugtracker and can be found at [1].

The only remaining question is: Does it break other drivers?

[1] https://bugs.freedesktop.org/show_bug.cgi?id=47382

Great!

Quoted 7 lines
Quoted 5 lines

I haven't fully thought about it enough to give a reviewed-by, but it seems sane.

I suggest sending the patch to [email protected]. That's where most patch reviews are handled. You will likely get faster results there.

Yep, agree thats also a great way to go.

Thanks!

Quoted 6 lines

One thing I might suggest is to include with patch your thinking on how a pen+multitouch device should send events to help in review of the patch. Just the basics. For example, from above patch I have an assumption that your sending ABS_X/Y only for PEN events and ABS_MT_POSITION_X/Y only for touch events; but then again I'm not 100% sure of that.

That's correct. In our case, it's ABS_X/Y for pen, ABS_MT_* for fingers (normal touches). But maybe other devices behave different. So we should send something like this as an addition to the patch on the x.org list?

Quoted 15 lines
# finger touch
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID 42
    ABS_MT_POSITION_X finger_x
    ABS_MT_POSITION_Y finger_y
    SYN_MT_REPORT
    SYN_REPORT
# finger release
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID -1
    SYN_REPORT
# pen motion
    ABS_X pen_x
    ABS_Y pen_y
    SYN_REPORT

The proper way to send events through evdev when there are two different "tools" (pen and touch) is to use BTN_TOOL_*. In your example above, it would be:

# finger touch (Note lack of tool, it's assumed to be finger)
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID 42
    ABS_MT_POSITION_X finger_x
    ABS_MT_POSITION_Y finger_y
    SYN_MT_REPORT
    ABS_X finger_x
    ABS_Y finger_y
    SYN_REPORT
# finger release
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID -1
    SYN_REPORT
# pen motion
    BTN_TOOL_PEN 1
    ABS_X pen_x
    ABS_Y pen_y
    SYN_REPORT
# finger touch begin
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID 42
    ABS_MT_POSITION_X finger_x
    ABS_MT_POSITION_Y finger_y
    SYN_MT_REPORT
    BTN_TOOL_PEN 0
    ABS_X finger_x
    ABS_Y finger_y
    SYN_REPORT
etc.

Then, xf86-input-evdev ignores ABS_{X,Y} events when there is no BTN_TOOL_* active.

-- Chase

#10 lore raw
Quoted 34 lines

The proper way to send events through evdev when there are two different "tools" (pen and touch) is to use BTN_TOOL_*. In your example above, it would be:

# finger touch (Note lack of tool, it's assumed to be finger)
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID 42
    ABS_MT_POSITION_X finger_x
    ABS_MT_POSITION_Y finger_y
    SYN_MT_REPORT
    ABS_X finger_x
    ABS_Y finger_y
    SYN_REPORT
# finger release
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID -1
    SYN_REPORT
# pen motion
    BTN_TOOL_PEN 1
    ABS_X pen_x
    ABS_Y pen_y
    SYN_REPORT
# finger touch begin
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID 42
    ABS_MT_POSITION_X finger_x
    ABS_MT_POSITION_Y finger_y
    SYN_MT_REPORT
    BTN_TOOL_PEN 0
    ABS_X finger_x
    ABS_Y finger_y
    SYN_REPORT
etc.
Quoted 2 lines

Then, xf86-input-evdev ignores ABS_{X,Y} events when there is no BTN_TOOL_* active.

On the subject how pen and touch could work going forward, the MT protocol is prepared to deal with tool type per slot. It makes a lot of sense to move away from the above example, towards a fully parallel representation of pen and touch data. Today's multitouch interfaces are really tremendously restrictive; I am looking forward to the day when one does not need to worry about touching or resting on a surface in order to operate it.

In short, why not make xf86-input-evdev aware of MT_TOOL_TYPE?

Thanks,
Henrik

#11 lore raw
Quoted 45 lines · Henrik Rydberg
Quoted 34 lines

The proper way to send events through evdev when there are two different "tools" (pen and touch) is to use BTN_TOOL_*. In your example above, it would be:

# finger touch (Note lack of tool, it's assumed to be finger)
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID 42
    ABS_MT_POSITION_X finger_x
    ABS_MT_POSITION_Y finger_y
    SYN_MT_REPORT
    ABS_X finger_x
    ABS_Y finger_y
    SYN_REPORT
# finger release
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID -1
    SYN_REPORT
# pen motion
    BTN_TOOL_PEN 1
    ABS_X pen_x
    ABS_Y pen_y
    SYN_REPORT
# finger touch begin
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID 42
    ABS_MT_POSITION_X finger_x
    ABS_MT_POSITION_Y finger_y
    SYN_MT_REPORT
    BTN_TOOL_PEN 0
    ABS_X finger_x
    ABS_Y finger_y
    SYN_REPORT
etc.
Quoted 2 lines

Then, xf86-input-evdev ignores ABS_{X,Y} events when there is no BTN_TOOL_* active.

On the subject how pen and touch could work going forward, the MT protocol is prepared to deal with tool type per slot. It makes a lot of sense to move away from the above example, towards a fully parallel representation of pen and touch data. Today's multitouch interfaces are really tremendously restrictive; I am looking forward to the day when one does not need to worry about touching or resting on a surface in order to operate it.

Quoted 1 line

In short, why not make xf86-input-evdev aware of MT_TOOL_TYPE?

There's no reason it can't be made aware. The question is whether you want to create separate X input devices, or annotate events with the tool type. No one has really bothered looking into it outside of wacom devices, but my understanding is that wacom is a big special cased situation due to historical reasons anyway.

If we merely annotate events by setting valuator values, that's a trivial change that may even be already supported out of the box. Splitting the evdev device into multiple X input devices is also possible, since xf86-input-wacom does it, but would require a large refactoring of xf86-input-evdev.

-- Chase

#12 lore raw

2012/3/19 Chase Douglas <[email protected]>:

Quoted 54 lines · Henrik Rydberg
Quoted 45 lines
Quoted 34 lines

The proper way to send events through evdev when there are two different "tools" (pen and touch) is to use BTN_TOOL_*. In your example above, it would be:

# finger touch (Note lack of tool, it's assumed to be finger)
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID 42
    ABS_MT_POSITION_X finger_x
    ABS_MT_POSITION_Y finger_y
    SYN_MT_REPORT
    ABS_X finger_x
    ABS_Y finger_y
    SYN_REPORT
# finger release
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID -1
    SYN_REPORT
# pen motion
    BTN_TOOL_PEN 1
    ABS_X pen_x
    ABS_Y pen_y
    SYN_REPORT
# finger touch begin
    ABS_MT_SLOT 0
    ABS_MT_TRACKING_ID 42
    ABS_MT_POSITION_X finger_x
    ABS_MT_POSITION_Y finger_y
    SYN_MT_REPORT
    BTN_TOOL_PEN 0
    ABS_X finger_x
    ABS_Y finger_y
    SYN_REPORT
etc.
Quoted 2 lines

Then, xf86-input-evdev ignores ABS_{X,Y} events when there is no BTN_TOOL_* active.

On the subject how pen and touch could work going forward, the MT protocol is prepared to deal with tool type per slot. It makes a lot of sense to move away from the above example, towards a fully parallel representation of pen and touch data. Today's multitouch interfaces are really tremendously restrictive; I am looking forward to the day when one does not need to worry about touching or resting on a surface in order to operate it.

Quoted 1 line

In short, why not make xf86-input-evdev aware of MT_TOOL_TYPE?

There's no reason it can't be made aware. The question is whether you want to create separate X input devices, or annotate events with the tool type. No one has really bothered looking into it outside of wacom devices, but my understanding is that wacom is a big special cased situation due to historical reasons anyway.

Quoted 6 lines

If we merely annotate events by setting valuator values, that's a trivial change that may even be already supported out of the box. Splitting the evdev device into multiple X input devices is also possible, since xf86-input-wacom does it, but would require a large refactoring of xf86-input-evdev.

FWIW, non-wacom pen+touch devices should work with current xf86-input-wacom if they use above events. You will get split devices as long as you modify xorg.conf.d to route this input. MT events will be treated roughly like xf86-input-synaptics would treat DOUBLETAP though (internal 1 and 2 finger gesture support only).

My plan is to take your xf86-input-evdev/synaptics X Input 2.2 work and merge it into xf86-input-wacom soon to benefit from those improvements. In addition to Wacom MT hardware, I try to occasionally test xf86-input-wacom with a hid-multitouch touchscreen to verify it isn't needlessly wacom specific.

Having said that, I think its good to improve multi-tool support in xf86-input-evdev in parallel to the multi-touch improvements. In addition, xf86-input-evdev would be a much better base to start experimenting with annotating events.

Chris
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html