From 951eac6bfa9e5ed03a758dd24cbb3467f9cdc6a6 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 19 Dec 2023 00:20:46 +0200 Subject: [PATCH] Kernel: Implement hacky non-block read for ps2 keyboard --- kernel/include/kernel/Input/PS2Keyboard.h | 1 + kernel/kernel/Input/PS2Keyboard.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/kernel/include/kernel/Input/PS2Keyboard.h b/kernel/include/kernel/Input/PS2Keyboard.h index e31ea71635..84907754e4 100644 --- a/kernel/include/kernel/Input/PS2Keyboard.h +++ b/kernel/include/kernel/Input/PS2Keyboard.h @@ -64,6 +64,7 @@ namespace Kernel::Input protected: virtual BAN::ErrorOr read_impl(off_t, BAN::ByteSpan) override; + virtual bool has_data_impl() const override; private: const dev_t m_rdev; diff --git a/kernel/kernel/Input/PS2Keyboard.cpp b/kernel/kernel/Input/PS2Keyboard.cpp index c2efe5bf93..a9ea33408b 100644 --- a/kernel/kernel/Input/PS2Keyboard.cpp +++ b/kernel/kernel/Input/PS2Keyboard.cpp @@ -234,4 +234,10 @@ namespace Kernel::Input } } + bool PS2Keyboard::has_data_impl() const + { + CriticalScope _; + return !m_event_queue.empty(); + } + } \ No newline at end of file