From d177273d8a164e788ef7646cc9d667224f80ff56 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Thu, 21 Dec 2006 17:07:08 -0200 Subject: Improved keycode printing From: Mauro Carvalho Chehab Now, it will print keycode name, if known. Signed-off-by: Mauro Carvalho Chehab --- v4l2-apps/util/keytable.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'v4l2-apps/util/keytable.c') diff --git a/v4l2-apps/util/keytable.c b/v4l2-apps/util/keytable.c index 93aa8973c..3b922f12b 100644 --- a/v4l2-apps/util/keytable.c +++ b/v4l2-apps/util/keytable.c @@ -25,6 +25,15 @@ void prtcode (int *codes) { + struct parse_key *p; + + for (p=keynames;p->name!=NULL;p++) { + if (p->value == (unsigned)codes[1]) { + printf("scancode %d = %s (0x%02x)\n", codes[0], p->name, codes[1]); + return; + } + } + if (isprint (codes[1])) printf("scancode %d = '%c' (0x%02x)\n", codes[0], codes[1], codes[1]); else -- cgit v1.2.3