summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-01-05 10:09:22 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-01-05 10:09:22 +1000
commit4cfd2c98f39af74a297315ed6606becba2a53987 (patch)
treed9b2d40e7e3a4703b6aecc9df05caf6881704f49
parentaaaa2df75f3450d867edef6923835d36f6bd18fc (diff)
De-duplicate event code+value printing.
The only difference for EV_MSC is that the value is printed in hex, the rest of the code is identical. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--evtest.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/evtest.c b/evtest.c
index 410efbc..a5525bf 100644
--- a/evtest.c
+++ b/evtest.c
@@ -451,20 +451,16 @@ int main (int argc, char **argv)
if (ev[i].type == EV_SYN) {
printf("-------------- %s ------------\n", syns[ev[i].code]);
- } else if (ev[i].type == EV_MSC && (ev[i].code == MSC_RAW || ev[i].code == MSC_SCAN)) {
- printf("type %d (%s), code %d (%s), value %02x\n",
- ev[i].type,
- events[ev[i].type] ? events[ev[i].type] : "?",
- ev[i].code,
- names[ev[i].type] ? (names[ev[i].type][ev[i].code] ? names[ev[i].type][ev[i].code] : "?") : "?",
- ev[i].value);
} else {
- printf("type %d (%s), code %d (%s), value %d\n",
+ printf("type %d (%s), code %d (%s), ",
ev[i].type,
events[ev[i].type] ? events[ev[i].type] : "?",
ev[i].code,
- names[ev[i].type] ? (names[ev[i].type][ev[i].code] ? names[ev[i].type][ev[i].code] : "?") : "?",
- ev[i].value);
+ names[ev[i].type] ? (names[ev[i].type][ev[i].code] ? names[ev[i].type][ev[i].code] : "?") : "?");
+ if (ev[i].type == EV_MSC && (ev[i].code == MSC_RAW || ev[i].code == MSC_SCAN))
+ printf("value %02x\n", ev[i].value);
+ else
+ printf("value %d\n", ev[i].value);
}
}