From: Mohamed Ikbel Boulabiar <medikbel@lii-enac.fr>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
USB list <linux-input@vger.kernel.org>,
Henrik Rydberg <rydberg@euromail.se>
Cc: boulabiar@gmail.com, "Stéphane Chatty" <chatty@enac.fr>, vojtech@suse.cz
Subject: [PATCH] input: mt: Add MT Events reporting to evtest
Date: Tue, 19 May 2009 23:20:08 +0100 [thread overview]
Message-ID: <45cc95260905191520w7d834124k2c8f970d82981809@mail.gmail.com> (raw)
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@enac.fr>
Tested-by: Stéphane Chatty <chatty@enac.fr>
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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2009-05-19 22:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-19 22:20 Mohamed Ikbel Boulabiar [this message]
2009-05-19 22:42 ` [PATCH] input: mt: Add MT Events reporting to evtest Mohamed Ikbel Boulabiar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=45cc95260905191520w7d834124k2c8f970d82981809@mail.gmail.com \
--to=medikbel@lii-enac.fr \
--cc=boulabiar@gmail.com \
--cc=chatty@enac.fr \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=rydberg@euromail.se \
--cc=vojtech@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).