getevent: Fix a couple of bugs.
Fixed a bug printing the event value when using labels.
Stop trying to print the available codes for EV_SYN because
we cannot actually query them. EVIOCGBIT(0, size) is a special
case that returns the set of events that are supported, and
EV_SYN == 0.
Change-Id: Iea086ba24300ca0815e4814a3bc5ff60756612c2
diff --git a/toolbox/getevent.c b/toolbox/getevent.c
index f0a6c24..c0ac94a 100644
--- a/toolbox/getevent.c
+++ b/toolbox/getevent.c
@@ -82,7 +82,7 @@
const char *bit_label;
printf(" events:\n");
- for(i = 0; i <= EV_MAX; i++) {
+ for(i = EV_KEY; i <= EV_MAX; i++) { // skip EV_SYN since we cannot query its available codes
int count = 0;
while(1) {
res = ioctl(fd, EVIOCGBIT(i, bits_size), bits);
@@ -97,10 +97,6 @@
}
res2 = 0;
switch(i) {
- case EV_SYN:
- label = "SYN";
- bit_labels = syn_labels;
- break;
case EV_KEY:
res2 = ioctl(fd, EVIOCGKEY(res), bits + bits_size);
label = "KEY";
@@ -252,7 +248,7 @@
if (value_label)
printf(" %-20.20s", value_label);
else
- printf(" %08x ", code);
+ printf(" %08x ", value);
} else {
printf("%04x %04x %08x", type, code, value);
}