]> granicus.if.org Git - strace/commitdiff
evdev: decode keycode value in EVIOC[GS]KEYCODE_V2 commands
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 21 Feb 2015 23:05:26 +0000 (23:05 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 22 Feb 2015 02:29:55 +0000 (02:29 +0000)
* evdev.c (keycode_V2_ioctl): Use evdev_keycode to print
input_keymap_entry.keycode.

evdev.c

diff --git a/evdev.c b/evdev.c
index e26896fa846fc93499efcad2de4f2f92084792f5..9a7430db4d86b782066ded982066381ed1909110 100644 (file)
--- a/evdev.c
+++ b/evdev.c
@@ -178,7 +178,6 @@ static int
 keycode_V2_ioctl(struct tcb *tcp, long arg)
 {
        struct input_keymap_entry ike;
-       unsigned i;
 
        if (!arg) {
                tprints(", NULL");
@@ -188,15 +187,19 @@ keycode_V2_ioctl(struct tcb *tcp, long arg)
        if (!verbose(tcp) || umove(tcp, arg, &ike) < 0)
                return 0;
 
-       tprintf(", {flags=%" PRIu8 ", len=%" PRIu8,
-               ike.flags, ike.len);
+       tprintf(", {flags=%" PRIu8 ", len=%" PRIu8, ike.flags, ike.len);
        if (!abbrev(tcp)) {
-               tprintf(", index=%" PRIu16 ", keycode=%" PRIu32,
-                       ike.index, ike.keycode);
-               tprints(", scancode={");
-               for (i = 0; i < ARRAY_SIZE(ike.scancode); i++)
-                       tprintf(" %" PRIx8, ike.scancode[i]);
-               tprints("}}");
+               unsigned int i;
+
+               tprintf(", index=%" PRIu16 ", keycode=", ike.index);
+               printxval(evdev_keycode, ike.keycode, "KEY_???");
+               tprints(", scancode=[");
+               for (i = 0; i < ARRAY_SIZE(ike.scancode); i++) {
+                       if (i > 0)
+                               tprints(", ");
+                       tprintf("%" PRIx8, ike.scancode[i]);
+               }
+               tprints("]}");
        } else {
                tprints(", ...}");
        }