1 /* ----------------------------------------------------------------------- *
3 * Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 * Boston MA 02111-1307, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
16 * Test the key parsing library
23 #include <sys/times.h>
25 #include <consoles.h> /* Provided by libutil */
28 static void cooked_keys(void)
35 key
= get_key(stdin
, 0);
40 } else if (key
== '!')
43 if (key
>= 0x20 && key
< 0x100) {
46 printf("[%s,%04x]", key_code_to_name(key
), key
);
51 static void raw_keys(void)
63 } else if (key
== '!')
67 printf("<%02x>", key
);
75 printf("CLK_TCK = %d\n", (int)CLK_TCK
);
76 printf("Press keys, end with Ctrl-C, ! changes from cooked to raw\n");