summaryrefslogtreecommitdiff
path: root/Kernel/Devices/KeyboardDevice.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-07 11:43:58 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-07 11:43:58 +0200
commitbc951ca565d137b2d1bd158e5473bd42cf568d10 (patch)
treed726fbd8f661b52a7c3d549a5f08f98e0443ca0c /Kernel/Devices/KeyboardDevice.cpp
parent98eeb8f22df509b2a711de0e4a01660b6646f229 (diff)
downloadserenity-bc951ca565d137b2d1bd158e5473bd42cf568d10.zip
Kernel: Run clang-format on everything.
Diffstat (limited to 'Kernel/Devices/KeyboardDevice.cpp')
-rw-r--r--Kernel/Devices/KeyboardDevice.cpp175
1 files changed, 139 insertions, 36 deletions
diff --git a/Kernel/Devices/KeyboardDevice.cpp b/Kernel/Devices/KeyboardDevice.cpp
index 7a8464e598..03fa1b25ec 100644
--- a/Kernel/Devices/KeyboardDevice.cpp
+++ b/Kernel/Devices/KeyboardDevice.cpp
@@ -1,24 +1,23 @@
-#include <AK/Types.h>
-#include "i386.h"
#include "IO.h"
#include "PIC.h"
+#include "i386.h"
+#include <AK/Assertions.h>
+#include <AK/Types.h>
#include <Kernel/Devices/KeyboardDevice.h>
#include <Kernel/TTY/VirtualConsole.h>
-#include <AK/Assertions.h>
//#define KEYBOARD_DEBUG
-#define IRQ_KEYBOARD 1
-#define I8042_BUFFER 0x60
-#define I8042_STATUS 0x64
-#define I8042_ACK 0xFA
-#define I8042_BUFFER_FULL 0x01
-#define I8042_WHICH_BUFFER 0x20
-#define I8042_MOUSE_BUFFER 0x20
-#define I8042_KEYBOARD_BUFFER 0x00
+#define IRQ_KEYBOARD 1
+#define I8042_BUFFER 0x60
+#define I8042_STATUS 0x64
+#define I8042_ACK 0xFA
+#define I8042_BUFFER_FULL 0x01
+#define I8042_WHICH_BUFFER 0x20
+#define I8042_MOUSE_BUFFER 0x20
+#define I8042_KEYBOARD_BUFFER 0x00
-static char map[0x80] =
-{
+static char map[0x80] = {
0, '\033', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', 0x08, '\t',
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', 0,
'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 0, '\\',
@@ -26,8 +25,7 @@ static char map[0x80] =
0, 0, 0, ' '
};
-static char shift_map[0x80] =
-{
+static char shift_map[0x80] = {
0, '\033', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+', 0x08, '\t',
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', '\n', 0,
'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~', 0, '|',
@@ -35,24 +33,76 @@ static char shift_map[0x80] =
0, 0, 0, ' '
};
-static KeyCode unshifted_key_map[0x80] =
-{
- Key_Invalid, Key_Escape,
- Key_1, Key_2, Key_3, Key_4, Key_5, Key_6, Key_7, Key_8, Key_9, Key_0, Key_Minus, Key_Equal, Key_Backspace,
+static KeyCode unshifted_key_map[0x80] = {
+ Key_Invalid,
+ Key_Escape,
+ Key_1,
+ Key_2,
+ Key_3,
+ Key_4,
+ Key_5,
+ Key_6,
+ Key_7,
+ Key_8,
+ Key_9,
+ Key_0,
+ Key_Minus,
+ Key_Equal,
+ Key_Backspace,
Key_Tab, //15
- Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_LeftBracket, Key_RightBracket,
- Key_Return, // 28
+ Key_Q,
+ Key_W,
+ Key_E,
+ Key_R,
+ Key_T,
+ Key_Y,
+ Key_U,
+ Key_I,
+ Key_O,
+ Key_P,
+ Key_LeftBracket,
+ Key_RightBracket,
+ Key_Return, // 28
Key_Control, // 29
- Key_A, Key_S, Key_D, Key_F, Key_G, Key_H, Key_J, Key_K, Key_L, Key_Semicolon, Key_Apostrophe, Key_Backtick,
+ Key_A,
+ Key_S,
+ Key_D,
+ Key_F,
+ Key_G,
+ Key_H,
+ Key_J,
+ Key_K,
+ Key_L,
+ Key_Semicolon,
+ Key_Apostrophe,
+ Key_Backtick,
Key_LeftShift, // 42
Key_Backslash,
- Key_Z, Key_X, Key_C, Key_V, Key_B, Key_N, Key_M, Key_Comma, Key_Period, Key_Slash,
+ Key_Z,
+ Key_X,
+ Key_C,
+ Key_V,
+ Key_B,
+ Key_N,
+ Key_M,
+ Key_Comma,
+ Key_Period,
+ Key_Slash,
Key_RightShift, // 54
Key_Invalid,
- Key_Alt, // 56
- Key_Space, // 57
+ Key_Alt, // 56
+ Key_Space, // 57
Key_Invalid, // 58
- Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10,
+ Key_F1,
+ Key_F2,
+ Key_F3,
+ Key_F4,
+ Key_F5,
+ Key_F6,
+ Key_F7,
+ Key_F8,
+ Key_F9,
+ Key_F10,
Key_Invalid,
Key_Invalid, // 70
Key_Home,
@@ -78,24 +128,76 @@ static KeyCode unshifted_key_map[0x80] =
Key_Logo,
};
-static KeyCode shifted_key_map[0x100] =
-{
- Key_Invalid, Key_Escape,
- Key_ExclamationPoint, Key_AtSign, Key_Hashtag, Key_Dollar, Key_Percent, Key_Circumflex, Key_Ampersand, Key_Asterisk, Key_LeftParen, Key_RightParen, Key_Underscore, Key_Plus, Key_Backspace,
+static KeyCode shifted_key_map[0x100] = {
+ Key_Invalid,
+ Key_Escape,
+ Key_ExclamationPoint,
+ Key_AtSign,
+ Key_Hashtag,
+ Key_Dollar,
+ Key_Percent,
+ Key_Circumflex,
+ Key_Ampersand,
+ Key_Asterisk,
+ Key_LeftParen,
+ Key_RightParen,
+ Key_Underscore,
+ Key_Plus,
+ Key_Backspace,
Key_Tab,
- Key_Q, Key_W, Key_E, Key_R, Key_T, Key_Y, Key_U, Key_I, Key_O, Key_P, Key_LeftBrace, Key_RightBrace,
+ Key_Q,
+ Key_W,
+ Key_E,
+ Key_R,
+ Key_T,
+ Key_Y,
+ Key_U,
+ Key_I,
+ Key_O,
+ Key_P,
+ Key_LeftBrace,
+ Key_RightBrace,
Key_Return,
Key_Control,
- Key_A, Key_S, Key_D, Key_F, Key_G, Key_H, Key_J, Key_K, Key_L, Key_Colon, Key_DoubleQuote, Key_Tilde,
+ Key_A,
+ Key_S,
+ Key_D,
+ Key_F,
+ Key_G,
+ Key_H,
+ Key_J,
+ Key_K,
+ Key_L,
+ Key_Colon,
+ Key_DoubleQuote,
+ Key_Tilde,
Key_LeftShift, // 42
Key_Pipe,
- Key_Z, Key_X, Key_C, Key_V, Key_B, Key_N, Key_M, Key_LessThan, Key_GreaterThan, Key_QuestionMark,
+ Key_Z,
+ Key_X,
+ Key_C,
+ Key_V,
+ Key_B,
+ Key_N,
+ Key_M,
+ Key_LessThan,
+ Key_GreaterThan,
+ Key_QuestionMark,
Key_RightShift, // 54
Key_Invalid,
Key_Alt,
- Key_Space, // 57
+ Key_Space, // 57
Key_Invalid, // 58
- Key_F1, Key_F2, Key_F3, Key_F4, Key_F5, Key_F6, Key_F7, Key_F8, Key_F9, Key_F10,
+ Key_F1,
+ Key_F2,
+ Key_F3,
+ Key_F4,
+ Key_F5,
+ Key_F6,
+ Key_F7,
+ Key_F8,
+ Key_F9,
+ Key_F10,
Key_Invalid,
Key_Invalid, // 70
Key_Home,
@@ -163,7 +265,8 @@ void KeyboardDevice::handle_irq()
break;
}
switch (ch) {
- case I8042_ACK: break;
+ case I8042_ACK:
+ break;
default:
if (m_modifiers & Mod_Alt) {
switch (map[ch]) {