From 02051ed60ff15c1646a343209a2c7683253e426c Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 21 Jul 2024 17:33:38 +0300 Subject: [PATCH] Kernel: Move keyboard kernel panic to the general input device This will allow command to work without requiring it per keyboard driver --- kernel/kernel/Input/InputDevice.cpp | 14 ++++++++++++++ kernel/kernel/Input/PS2/Keyboard.cpp | 2 -- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/kernel/kernel/Input/InputDevice.cpp b/kernel/kernel/Input/InputDevice.cpp index 9a85b5aa..273a1c44 100644 --- a/kernel/kernel/Input/InputDevice.cpp +++ b/kernel/kernel/Input/InputDevice.cpp @@ -107,6 +107,20 @@ namespace Kernel } } + if (m_type == Type::Keyboard) + { + auto& key_event = event.as(); + if (key_event.modifier & LibInput::KeyEvent::Modifier::Pressed) + { + switch (key_event.keycode) + { + case LibInput::keycode_function(12): + Kernel::panic("Keyboard kernel panic :)"); + break; + } + } + } + if (m_event_count == m_max_event_count) { m_event_tail = (m_event_tail + 1) % m_max_event_count; diff --git a/kernel/kernel/Input/PS2/Keyboard.cpp b/kernel/kernel/Input/PS2/Keyboard.cpp index 2e73e5cc..13ea5fd4 100644 --- a/kernel/kernel/Input/PS2/Keyboard.cpp +++ b/kernel/kernel/Input/PS2/Keyboard.cpp @@ -126,8 +126,6 @@ namespace Kernel::Input return; auto dummy_event = LibInput::KeyboardLayout::get().key_event_from_raw(RawKeyEvent { .modifier = 0, .keycode = keycode.value() }); - if (dummy_event.key == Key::F1) - panic("OOF"); uint16_t modifier_mask = 0; uint16_t toggle_mask = 0;