[PATCH evtest 7/9] Use temp variables for type/code when printing events
Peter Hutterer
peter.hutterer at who-t.net
Wed Aug 21 20:46:52 PDT 2013
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
evtest.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/evtest.c b/evtest.c
index aff972f..fd30774 100644
--- a/evtest.c
+++ b/evtest.c
@@ -837,20 +837,25 @@ static int print_events(int fd)
}
for (i = 0; i < rd / sizeof(struct input_event); i++) {
+ unsigned int type, code;
+
+ type = ev[i].type;
+ code = ev[i].code;
+
printf("Event: time %ld.%06ld, ", ev[i].time.tv_sec, ev[i].time.tv_usec);
- if (ev[i].type == EV_SYN) {
- if (ev[i].code == SYN_MT_REPORT)
- printf("++++++++++++++ %s ++++++++++++\n", syns[ev[i].code]);
+ if (type == EV_SYN) {
+ if (code == SYN_MT_REPORT)
+ printf("++++++++++++++ %s ++++++++++++\n", syns[code]);
else
- printf("-------------- %s ------------\n", syns[ev[i].code]);
+ printf("-------------- %s ------------\n", syns[code]);
} else {
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] : "?") : "?");
- if (ev[i].type == EV_MSC && (ev[i].code == MSC_RAW || ev[i].code == MSC_SCAN))
+ type,
+ events[type] ? events[type] : "?",
+ code,
+ names[type] ? (names[type][code] ? names[type][code] : "?") : "?");
+ if (type == EV_MSC && (code == MSC_RAW || code == MSC_SCAN))
printf("value %02x\n", ev[i].value);
else
printf("value %d\n", ev[i].value);
--
1.8.2.1
More information about the Input-tools
mailing list