2

I am trying to play around with touchpad multitouch events using mtdev-test since evtest is not available for Solus os yet.

So i have found tat magical command called mtdev-test but i cannot really figure out what this output means. I have found out that second column is possibly representing finger count (00=1,01=2,02=3,...) but i have no idea what others mean.

I have tried to find some information in: https://github.com/torvalds/linux/blob/master/drivers/input/mouse/elantech.c

and

https://www.kernel.org/doc/Documentation/input/elantech.txt

and also

https://www.kernel.org/doc/Documentation/input/event-codes.txt

Maybe i am just really dump to find relations between the three.

My goal is to somehow convert output from mtdev-test using java/python/whatever to human understandable data and detect X&Y of each finger

unicornponny@unicornponny ~ $ sudo mtdev-test /dev/input/event14
supported mt events:
   ABS_MT_SLOT
   ABS_MT_TOUCH_MAJOR
   ABS_MT_POSITION_X
   ABS_MT_POSITION_Y
   ABS_MT_TRACKING_ID
   ABS_MT_PRESSURE
0159b6c31962 00 3 0039 3588
0159b6c31962 00 3 0035 2049
0159b6c31962 00 3 0036 690
0159b6c31962 00 3 003a 25
0159b6c31962 00 3 0030 624
0159b6c31962 00 3 001c 4
0159b6c31962 00 1 014a 1
0159b6c31962 00 1 0145 1
0159b6c31962 00 3 0000 2049
0159b6c31962 00 3 0001 690
0159b6c31962 00 3 0018 25
0159b6c31962 00 0 0000 0
0159b6c31969 00 3 003a 21
0159b6c31969 00 3 0018 21
0159b6c31969 00 0 0000 0
0159b6c3196f 00 3 0030 156
0159b6c3196f 00 3 001c 1
0159b6c3196f 00 0 0000 0
0159b6c31979 00 3 0039 -1
0159b6c31979 00 1 014a 0
0159b6c31979 00 1 0145 0
0159b6c31979 00 3 0018 0
0159b6c31979 00 0 0000 0

So can anyone explain how it works,what these data means, or do someone know any resource what i have not found?

Erik Kubica
  • 1,180
  • 3
  • 15
  • 39
  • https://www.kernel.org/doc/Documentation/input/multi-touch-protocol.txt – Alex P. Jan 19 '17 at 15:24
  • thansk Alex, i have seen this document i have forgot to mention it. But still cannot figure out wich column in output data belongs to what, or what kind of values they are. This ouput i have posted is from just one single fast tap on touchpad, and the numbers are so different that makes no sense. if there is any coords like XY number should be nearly same, but they are very different.. do you have any other idea? – Erik Kubica Jan 20 '17 at 06:29

1 Answers1

0

From mtdev-test.c we can see how the values are printed

fprintf(stderr, "%012llx %02d %01d %04x %d\n",
    evtime, slot, ev->type, ev->code, ev->value);

So the format is:

Timestamp Slot Type Code Value

Event types and codes can be found in input-event-codes.h in the Linux kernel:

/*
 * Event types
 */

#define EV_SYN          0x00
#define EV_KEY          0x01
#define EV_REL          0x02
#define EV_ABS          0x03
#define EV_MSC          0x04
#define EV_SW           0x05
#define EV_LED          0x11
#define EV_SND          0x12
#define EV_REP          0x14
#define EV_FF           0x15
#define EV_PWR          0x16
#define EV_FF_STATUS    0x17
#define EV_MAX          0x1f

So 3 is the EV_ABS event type, for which we have event codes (edited for brevity):

#define ABS_X               0x00
#define ABS_Y               0x01
#define ABS_Z               0x02
// <snip>
#define ABS_PRESSURE        0x18
#define ABS_DISTANCE        0x19
// <snip>
#define ABS_MT_SLOT         0x2f    /* MT slot being modified */
#define ABS_MT_TOUCH_MAJOR  0x30    /* Major axis of touching ellipse */
#define ABS_MT_TOUCH_MINOR  0x31    /* Minor axis (omit if circular) */
#define ABS_MT_WIDTH_MAJOR  0x32    /* Major axis of approaching ellipse */
#define ABS_MT_WIDTH_MINOR  0x33    /* Minor axis (omit if circular) */
#define ABS_MT_ORIENTATION  0x34    /* Ellipse orientation */
#define ABS_MT_POSITION_X   0x35    /* Center X touch position */
#define ABS_MT_POSITION_Y   0x36    /* Center Y touch position */
#define ABS_MT_TOOL_TYPE    0x37    /* Type of touching device */
#define ABS_MT_BLOB_ID      0x38    /* Group a set of packets as a blob */
#define ABS_MT_TRACKING_ID  0x39    /* Unique ID of initiated contact */
#define ABS_MT_PRESSURE     0x3a    /* Pressure on contact area */
#define ABS_MT_DISTANCE     0x3b    /* Contact hover distance */
#define ABS_MT_TOOL_X       0x3c    /* Center X tool position */
#define ABS_MT_TOOL_Y       0x3d    /* Center Y tool position */

Now, given the output

0159b6c31962 00 3 0039 3588
0159b6c31962 00 3 0035 2049
0159b6c31962 00 3 0036 690
0159b6c31962 00 3 003a 25
0159b6c31962 00 3 0030 624
0159b6c31962 00 3 001c 4
0159b6c31962 00 1 014a 1
0159b6c31962 00 1 0145 1
0159b6c31962 00 3 0000 2049
0159b6c31962 00 3 0001 690
0159b6c31962 00 3 0018 25
0159b6c31962 00 0 0000 0

We get

1484829956450 ms, Slot 0, 3 (EV_ABS) 0039 (ABS_MT_TRACKING_ID) 3588
1484829956450 ms, Slot 0, 3 (EV_ABS) 0035 (ABS_MT_POSITION_X) 2049
1484829956450 ms, Slot 0, 3 (EV_ABS) 0036 (ABS_MT_POSITION_Y) 690
1484829956450 ms, Slot 0, 3 (EV_ABS) 003a (ABS_MT_PRESSURE) 25
1484829956450 ms, Slot 0, 3 (EV_ABS) 0030 (ABS_MT_TOUCH_MAJOR) 624
1484829956450 ms, Slot 0, 3 (EV_ABS) 001c (ABS_TOOL_WIDTH) 4
1484829956450 ms, Slot 0, 1 (EV_KEY) 014a (BTN_TOUCH) 1
1484829956450 ms, Slot 0, 1 (EV_KEY) 0145 (BTN_TOOL_FINGER) 1
1484829956450 ms, Slot 0, 3 (EV_ABS) 0000 (ABS_X) 2049
1484829956450 ms, Slot 0, 3 (EV_ABS) 0001 (ABS_Y) 690
1484829956450 ms, Slot 0, 3 (EV_ABS) 0018 (ABS_PRESSURE) 25
1484829956450 ms, Slot 0, 0 (EV_SYN) 0000 0

For more details on event packets refer to documentation:

rustyx
  • 80,671
  • 25
  • 200
  • 267