Skip to content

Commit 132ea82

Browse files
Thomas KuehneJiri Kosina
authored andcommitted
HID: hid-debug: more informative output for EV_KEY
Currently hid-debug's hid_resolv_event prints questions marks for all entries without explicit mapping information. This makes debugging unnecessarily complicated as multiple different keys may simply result in the same uninformative output. Some common event codes are deliberately not defined in input-event-codes.h. For example the 16th gamepad key. Instead, print the hexadecimal codes for all events without symbolic names. Signed-off-by: Thomas Kuehne <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 815234a commit 132ea82

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/hid/hid-debug.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3582,8 +3582,15 @@ static const char **names[EV_MAX + 1] = {
35823582

35833583
static void hid_resolv_event(__u8 type, __u16 code, struct seq_file *f)
35843584
{
3585-
seq_printf(f, "%s.%s", events[type] ? events[type] : "?",
3586-
names[type] ? (names[type][code] ? names[type][code] : "?") : "?");
3585+
if (events[type])
3586+
seq_printf(f, "%s.", events[type]);
3587+
else
3588+
seq_printf(f, "%02x.", type);
3589+
3590+
if (names[type] && names[type][code])
3591+
seq_printf(f, "%s", names[type][code]);
3592+
else
3593+
seq_printf(f, "%04x", code);
35873594
}
35883595

35893596
static void hid_dump_input_mapping(struct hid_device *hid, struct seq_file *f)

0 commit comments

Comments
 (0)