Will something like that be ok???:

---
Dummy process of MT events (protocol A).

The MT-protocol A is the one that sends SYN_MT_REPORT. It is opposed to the new one based on MT_SLOTS (protocol B). (see kernel_src/Documentation/input/multi-touch-protocol.txt)

The processing is "dummy" since there is no computation while receiving mt events: it just stores it at the first available place, i.e. it does not override older mt values. This is valid as this protocol forces the device to send all the values at each frame.
---

Cheers,
Benjamin

Le 01/06/2010 03:35, Peter Hutterer a écrit :
can you pop a short description in why this is "protocol A" so that others
know where to look for this terminology. Just a sentence or two and a
mention of the kernel MT docs will do.

might want to explain why this is a "dummy" processing only in the commit
message as well so one doesn't thave to read through the diff to satisfy
their curiosity ;)

other than that, just a two typos/language fixups

On Sun, May 30, 2010 at 03:08:59PM +0200, Benjamin Tissoires wrote:
In case the driver receives a mt event, it stores it at the first
available place, i.e. it does not overrides older mt values.

"does not override"


At the end, in the EV_SYNC event, it only sends the values it has
filled.

Signed-off-by: Benjamin Tissoires<[email protected]>
---
  src/evdev.c |   36 +++++++++++++++++++++++++++++++++---
  src/evdev.h |    1 +
  2 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index 10fe81b..39a5047 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -412,6 +412,8 @@ EvdevProcessValuators(InputInfoPtr pInfo, int 
v[MAX_VALUATORS], int *num_v,
       */
      else if (pEvdev->abs&&  pEvdev->tool) {
          memcpy(v, pEvdev->vals, sizeof(int) * pEvdev->num_vals);
+        if (pEvdev->mt_current_touchpoint>  pEvdev->mt_max_touchpoints)
+            pEvdev->mt_current_touchpoint = pEvdev->mt_max_touchpoints;

          if (pEvdev->swap_axes) {
              int tmp = v[0];
@@ -438,7 +440,8 @@ EvdevProcessValuators(InputInfoPtr pInfo, int 
v[MAX_VALUATORS], int *num_v,
              v[1] = (pEvdev->absinfo[ABS_Y].maximum - v[1] +
                      pEvdev->absinfo[ABS_Y].minimum);

-        *num_v = pEvdev->num_vals;
+        *num_v = pEvdev->num_vals - (pEvdev->mt_max_touchpoints -
+              pEvdev->mt_current_touchpoint) * pEvdev->mt_num_valuators;
          *first_v = 0;
      }
  }
@@ -540,7 +543,15 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct 
input_event *ev)
      if (EvdevWheelEmuFilterMotion(pInfo, ev))
          return;

-    pEvdev->vals[pEvdev->axis_map[ev->code]] = value;
+    if (ev->code<  ABS_MT_TOUCH_MAJOR)
+        pEvdev->vals[pEvdev->axis_map[ev->code]] = value;
+    else if (pEvdev->mt_current_touchpoint<  pEvdev->mt_max_touchpoints) {
+        /* MT value ->  store it at the first available place */
+        pEvdev->vals[pEvdev->axis_map[ev->code] +
+            pEvdev->mt_current_touchpoint * pEvdev->mt_num_valuators] = value;
+    } else
+        return; /* mt-event, but not enough place to store it */
+
      if (ev->code == ABS_X)
          pEvdev->abs |= ABS_X_VALUE;
      else if (ev->code == ABS_Y)
@@ -682,6 +693,22 @@ EvdevProcessSyncEvent(InputInfoPtr pInfo, struct 
input_event *ev)
      pEvdev->num_queue = 0;
      pEvdev->abs = 0;
      pEvdev->rel = 0;
+    pEvdev->mt_current_touchpoint = 0;
+}
+
+/**
+ * Process the event SYN_MT_REPORT.
+ *
+ * This event is required only in the mt-protocol A (the oldest one). This
+ * protocol now handles devices that does not make tracking, so the processing

"do not support touchpoint tracking"

Cheers,
   Peter

+ * consists in incrementing mt_current_touchpoint to be able to place the next
+ * mt-event after this one in the list of valuators.
+ */
+static void
+EvdevProcessMTSyncReport(InputInfoPtr pInfo, struct input_event *ev)
+{
+    EvdevPtr pEvdev = pInfo->private;
+    pEvdev->mt_current_touchpoint++;
  }

  /**
@@ -702,7 +729,10 @@ EvdevProcessEvent(InputInfoPtr pInfo, struct input_event 
*ev)
              EvdevProcessKeyEvent(pInfo, ev);
              break;
          case EV_SYN:
-            EvdevProcessSyncEvent(pInfo, ev);
+            if (ev->code == SYN_MT_REPORT)
+                EvdevProcessMTSyncReport(pInfo, ev);
+            else
+                EvdevProcessSyncEvent(pInfo, ev);
              break;
      }
  }
diff --git a/src/evdev.h b/src/evdev.h
index 852f06c..49733a7 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -197,6 +197,7 @@ typedef struct {
      unsigned int mt_num_valuators;
      unsigned int mt_max_touchpoints; /* the number of simultaneous touchpoints
                                        * the device can support */
+    unsigned int mt_current_touchpoint;
  } EvdevRec, *EvdevPtr;

  /* Event posting functions */
--
1.7.0.1

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to