aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Tissoires <benjamin.tissoires@gmail.com>2013-03-13 17:00:53 +0100
committerPeter Hutterer <peter.hutterer@who-t.net>2013-03-14 07:13:46 +1000
commita79bb4423091f4f88f4de37b95e7e4ea4db0b07c (patch)
tree8735ebf4617b626b9f1482726283b15b548cac41
parent65520efa7ed1792a58615caf7da6d424e8662f17 (diff)
downloadexternal_evtest-a79bb4423091f4f88f4de37b95e7e4ea4db0b07c.tar.gz
external_evtest-a79bb4423091f4f88f4de37b95e7e4ea4db0b07c.tar.bz2
external_evtest-a79bb4423091f4f88f4de37b95e7e4ea4db0b07c.zip
Print EV_REP properties and values of those properties
Needs a bit of special treatment, EV_REP bits are not set by the kernel on EVIOCGBIT as properties between 0 and REP_MAX are always set. Hack around that so the output is preventing EV_REP to appear as an event. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--evtest.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/evtest.c b/evtest.c
index 61d0a37..4d60a3c 100644
--- a/evtest.c
+++ b/evtest.c
@@ -729,6 +729,20 @@ static void print_absdata(int fd, int axis)
printf(" %s %6d\n", absval[k], abs[k]);
}
+static void print_repdata(int fd)
+{
+ int i;
+ unsigned int rep[2];
+
+ ioctl(fd, EVIOCGREP, rep);
+
+ for (i = 0; i <= REP_MAX; i++) {
+ printf(" Property code %d (%s)\n", i, names[EV_REP] ? (names[EV_REP][i] ? names[EV_REP][i] : "?") : "?");
+ printf(" Value %6d\n", rep[i]);
+ }
+
+}
+
/**
* Print static device information (no events). This information includes
* version numbers, device name and all bits supported by this device.
@@ -767,7 +781,7 @@ static int print_device_info(int fd)
printf("Supported events:\n");
for (i = 0; i < EV_MAX; i++)
- if (test_bit(i, bit[0])) {
+ if (test_bit(i, bit[0]) && i != EV_REP) {
printf(" Event type %d (%s)\n", i, events[i] ? events[i] : "?");
if (!i) continue;
ioctl(fd, EVIOCGBIT(i, KEY_MAX), bit[i]);
@@ -783,6 +797,10 @@ static int print_device_info(int fd)
memset(propbits, 0, sizeof(propbits));
ioctl(fd, EVIOCGPROP(sizeof(propbits)), propbits);
printf("Properties:\n");
+ if (test_bit(EV_REP, bit[0])) {
+ printf(" Property type %d (%s)\n", EV_REP, events[EV_REP] ? events[EV_REP] : "?");
+ print_repdata(fd);
+ }
for (i = 0; i < INPUT_PROP_MAX; i++) {
if (test_bit(i, propbits))
printf(" Property type %d (%s)\n", i, props[i] ? props[i] : "?");