diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2008-03-20 19:54:59 +0000 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2008-03-20 19:54:59 +0000 |
commit | 6a441bfb46337ed6b59abed56dad35d94802282c (patch) | |
tree | 44eb1d67fcbc450907472186bbc0036afe9e380c /payloads/libpayload/drivers/keyboard.c | |
parent | 5f4c8abb6537fa7377969e837dab987abefcf922 (diff) |
Cosmetics, coding style fixes (trivial).
Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Uwe Hermann <uwe@hermann-uwe.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3180 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'payloads/libpayload/drivers/keyboard.c')
-rw-r--r-- | payloads/libpayload/drivers/keyboard.c | 57 |
1 files changed, 26 insertions, 31 deletions
diff --git a/payloads/libpayload/drivers/keyboard.c b/payloads/libpayload/drivers/keyboard.c index 0dc93713b8..9a3e4b8d19 100644 --- a/payloads/libpayload/drivers/keyboard.c +++ b/payloads/libpayload/drivers/keyboard.c @@ -31,26 +31,26 @@ #include <libpayload.h> unsigned char map[2][0x57] = { - { - 0x00, 0x1B, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, - 0x37, 0x38, 0x39, 0x30, 0x2D, 0x3D, 0x08, 0x09, - 0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, - 0x6F, 0x70, 0x5B, 0x5D, 0x0A, 0x00, 0x61, 0x73, - 0x64, 0x66, 0x67, 0x68, 0x6A, 0x6B, 0x6C, 0x3B, - 0x27, 0x60, 0x00, 0x5C, 0x7A, 0x78, 0x63, 0x76, - 0x62, 0x6E, 0x6D, 0x2C, 0x2E, 0x2F, 0x00, 0x2A, - 0x00, 0x20, - }, - { - 0x00, 0x1B, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, - 0x26, 0x2A, 0x28, 0x29, 0x5F, 0x2B, 0x08, 0x00, - 0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, - 0x4F, 0x50, 0x7B, 0x7D, 0x0A, 0x00, 0x41, 0x53, - 0x44, 0x46, 0x47, 0x48, 0x4A, 0x4B, 0x4C, 0x3A, - 0x22, 0x7E, 0x00, 0x7C, 0x5A, 0x58, 0x43, 0x56, - 0x42, 0x4E, 0x4D, 0x3C, 0x3E, 0x3F, 0x00, 0x2A, - 0x00, 0x20, - } + { + 0x00, 0x1B, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, + 0x37, 0x38, 0x39, 0x30, 0x2D, 0x3D, 0x08, 0x09, + 0x71, 0x77, 0x65, 0x72, 0x74, 0x79, 0x75, 0x69, + 0x6F, 0x70, 0x5B, 0x5D, 0x0A, 0x00, 0x61, 0x73, + 0x64, 0x66, 0x67, 0x68, 0x6A, 0x6B, 0x6C, 0x3B, + 0x27, 0x60, 0x00, 0x5C, 0x7A, 0x78, 0x63, 0x76, + 0x62, 0x6E, 0x6D, 0x2C, 0x2E, 0x2F, 0x00, 0x2A, + 0x00, 0x20, + }, + { + 0x00, 0x1B, 0x21, 0x40, 0x23, 0x24, 0x25, 0x5E, + 0x26, 0x2A, 0x28, 0x29, 0x5F, 0x2B, 0x08, 0x00, + 0x51, 0x57, 0x45, 0x52, 0x54, 0x59, 0x55, 0x49, + 0x4F, 0x50, 0x7B, 0x7D, 0x0A, 0x00, 0x41, 0x53, + 0x44, 0x46, 0x47, 0x48, 0x4A, 0x4B, 0x4C, 0x3A, + 0x22, 0x7E, 0x00, 0x7C, 0x5A, 0x58, 0x43, 0x56, + 0x42, 0x4E, 0x4D, 0x3C, 0x3E, 0x3F, 0x00, 0x2A, + 0x00, 0x20, + } }; #define MOD_SHIFT 1 @@ -78,32 +78,26 @@ int keyboard_getchar(void) static int modifier; unsigned char ch; int shift; - int ret = 0; - while(!keyboard_havechar()) - ; + while (!keyboard_havechar()) ; ch = keyboard_get_scancode(); - switch(ch) { + switch (ch) { case 0x36: case 0x2a: modifier &= ~MOD_SHIFT; break; - case 0x80 | 0x36: case 0x80 | 0x2a: modifier |= MOD_SHIFT; - case 0x1d: modifier &= ~MOD_CTRL; break; - case 0x80 | 0x1d: modifier |= MOD_CTRL; break; - case 0x3a: if (modifier & MOD_CAPSLOCK) modifier &= ~MOD_CAPSLOCK; @@ -112,12 +106,13 @@ int keyboard_getchar(void) break; } - if (!(ch & 0x80) && ch < 0x57) { - shift = (modifier & MOD_SHIFT) ^ (modifier & MOD_CAPSLOCK) ? 1 : 0; + if (!(ch & 0x80) && ch < 0x57) { + shift = + (modifier & MOD_SHIFT) ^ (modifier & MOD_CAPSLOCK) ? 1 : 0; ret = map[shift][ch]; if (modifier & MOD_CTRL) - ret = (ret >= 0x3F && ret <= 0x5F) ? ret & 0x1f : 0; + ret = (ret >= 0x3F && ret <= 0x5F) ? ret & 0x1f : 0; return ret; } |