[PATCH] input: mt: Add MT Events reporting to evtest

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch adds new MT events reporting capabilities to evtest tool.
New multi-touch events were added by Henrik Rydberg in the kernel-2.6.30-rc5.


From: Mohamed-Ikbel Boulabiar <ikbel.boulabiar@xxxxxxx>
Tested-by: Stéphane Chatty <chatty@xxxxxxx>



diff -rupN a/utils/evtest.c b/utils/evtest.c
--- a/utils/evtest.c    2009-05-19 23:42:18.000000000 +0100
+++ b/utils/evtest.c    2009-05-19 23:37:11.000000000 +0100
@@ -2,7 +2,7 @@
 * $Id$
 *
 *  Copyright (c) 1999-2000 Vojtech Pavlik
- *
+ *               2009 Mohamed-Ikbel Boulabiar
 *  Event device test program
 */

@@ -49,6 +49,21 @@ char *events[EV_MAX + 1] = {
       [EV_FF_STATUS] = "ForceFeedbackStatus",
 };

+int ev_max[EV_MAX + 1] = {
+       [EV_SYN] = 2,                           [EV_KEY] = KEY_MAX,
+       [EV_REL] = REL_MAX,                     [EV_ABS] = ABS_MAX,
+       [EV_MSC] = MSC_MAX,                     [EV_LED] = LED_MAX,
+       [EV_SND] = SND_MAX,                     [EV_REP] = REP_MAX,
+       [EV_FF] = FF_MAX,                       [EV_PWR] = -1,
+       [EV_FF_STATUS] = FF_STATUS_MAX,
+};
+
+char *syncs[3] = {
+       [SYN_REPORT] = "Report Sync",           [SYN_CONFIG] = "Config Sync",
+       [SYN_MT_REPORT] = "MT Report Sync"
+};
+
+
 char *keys[KEY_MAX + 1] = {
       [0 ... KEY_MAX] = NULL,
       [KEY_RESERVED] = "Reserved",            [KEY_ESC] = "Esc",
@@ -239,19 +254,24 @@ char *relatives[REL_MAX + 1] = {

 char *absolutes[ABS_MAX + 1] = {
       [0 ... ABS_MAX] = NULL,
-       [ABS_X] = "X",                  [ABS_Y] = "Y",
-       [ABS_Z] = "Z",                  [ABS_RX] = "Rx",
-       [ABS_RY] = "Ry",                [ABS_RZ] = "Rz",
-       [ABS_THROTTLE] = "Throttle",    [ABS_RUDDER] = "Rudder",
-       [ABS_WHEEL] = "Wheel",          [ABS_GAS] = "Gas",
-       [ABS_BRAKE] = "Brake",          [ABS_HAT0X] = "Hat0X",
-       [ABS_HAT0Y] = "Hat0Y",          [ABS_HAT1X] = "Hat1X",
-       [ABS_HAT1Y] = "Hat1Y",          [ABS_HAT2X] = "Hat2X",
-       [ABS_HAT2Y] = "Hat2Y",          [ABS_HAT3X] = "Hat3X",
-       [ABS_HAT3Y] = "Hat 3Y",         [ABS_PRESSURE] = "Pressure",
-       [ABS_DISTANCE] = "Distance",    [ABS_TILT_X] = "XTilt",
-       [ABS_TILT_Y] = "YTilt",         [ABS_TOOL_WIDTH] = "Tool Width",
-       [ABS_VOLUME] = "Volume",        [ABS_MISC] = "Misc",
+       [ABS_X] = "X",                                  [ABS_Y] = "Y",
+       [ABS_Z] = "Z",                                  [ABS_RX] = "Rx",
+       [ABS_RY] = "Ry",                                [ABS_RZ] = "Rz",
+       [ABS_THROTTLE] = "Throttle",                    [ABS_RUDDER] = "Rudder",
+       [ABS_WHEEL] = "Wheel",                          [ABS_GAS] = "Gas",
+       [ABS_BRAKE] = "Brake",                          [ABS_HAT0X] = "Hat0X",
+       [ABS_HAT0Y] = "Hat0Y",                          [ABS_HAT1X] = "Hat1X",
+       [ABS_HAT1Y] = "Hat1Y",                          [ABS_HAT2X] = "Hat2X",
+       [ABS_HAT2Y] = "Hat2Y",                          [ABS_HAT3X] = "Hat3X",
+       [ABS_HAT3Y] = "Hat 3Y",                         [ABS_PRESSURE]
= "Pressure",
+       [ABS_DISTANCE] = "Distance",                    [ABS_TILT_X] = "XTilt",
+       [ABS_TILT_Y] = "YTilt",
[ABS_TOOL_WIDTH] = "Tool Width",
+       [ABS_VOLUME] = "Volume",                        [ABS_MISC] = "Misc",
+       [ABS_MT_TOUCH_MAJOR] = "MT Touch Major",
[ABS_MT_TOUCH_MINOR] = "MT
Touch Minor",
+       [ABS_MT_WIDTH_MAJOR] = "MT Major Width",
[ABS_MT_WIDTH_MINOR] = "MT
Minor Width",
+       [ABS_MT_POSITION_X] = "MT Position X",
[ABS_MT_POSITION_Y] = "MT Position Y",
+       [ABS_MT_TOOL_TYPE] = "MT Tool Type",
[ABS_MT_BLOB_ID] = "MT Blob Id",
+       [ABS_MT_ORIENTATION] = "MT Orientation",
 };

 char *misc[MSC_MAX + 1] = {
@@ -283,7 +303,7 @@ char *sounds[SND_MAX + 1] = {

 char **names[EV_MAX + 1] = {
       [0 ... EV_MAX] = NULL,
-       [EV_SYN] = events,                      [EV_KEY] = keys,
+       [EV_SYN] = syncs,                       [EV_KEY] = keys,
       [EV_REL] = relatives,                   [EV_ABS] = absolutes,
       [EV_MSC] = misc,                        [EV_LED] = leds,
       [EV_SND] = sounds,                      [EV_REP] = repeats,
@@ -339,9 +359,9 @@ int main (int argc, char **argv)
       for (i = 0; i < EV_MAX; i++)
               if (test_bit(i, bit[0])) {
                       printf("  Event type %d (%s)\n", i, events[i] ?
events[i] : "?");
-                       if (!i) continue;
+//                     if (!i) continue;
                       ioctl(fd, EVIOCGBIT(i, KEY_MAX), bit[i]);
-                       for (j = 0; j < KEY_MAX; j++)
+                       for (j = 0; j <= ev_max[i]; j++)
                               if (test_bit(j, bit[i])) {
                                       printf("    Event code %d
(%s)\n", j, names[i] ? (names[i][j] ?
names[i][j] : "?") : "?");
                                       if (i == EV_ABS) {
@@ -369,7 +389,8 @@ int main (int argc, char **argv)

                       if (ev[i].type == EV_SYN) {
                               printf("Event: time %ld.%06ld,
-------------- %s ------------\n",
-                                       ev[i].time.tv_sec,
ev[i].time.tv_usec, ev[i].code ? "Config
Sync" : "Report Sync" );
+                                       ev[i].time.tv_sec, ev[i].time.tv_usec,
+                                       names[ev[i].type] ?
(names[ev[i].type][ev[i].code] ?
names[ev[i].type][ev[i].code] : "?") : "?");
                       } else if (ev[i].type == EV_MSC && (ev[i].code
== MSC_RAW ||
ev[i].code == MSC_SCAN)) {
                               printf("Event: time %ld.%06ld, type %d
(%s), code %d (%s), value %02x\n",
                                       ev[i].time.tv_sec,
ev[i].time.tv_usec, ev[i].type,
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux