diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2021-10-24 19:59:56 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-24 21:59:08 +0200 |
commit | 8b3232121be0909ac885bc4e86ebbebdd0b9f6db (patch) | |
tree | 11960469bba53c9a8bbf2fc28b3c3da697bb676d /Kernel/Devices/HID/I8042Controller.cpp | |
parent | 26c84967faade6a66305606526b8ee37f50365f7 (diff) | |
download | serenity-8b3232121be0909ac885bc4e86ebbebdd0b9f6db.zip |
Kernel: Do not detect mouse or keyboard when handling IRQ for I8042
Instead of detecting which flag was set in the status register, we can
use the instrument type passed to us. This works because the mouse and
keyboard use different IRQs.
Diffstat (limited to 'Kernel/Devices/HID/I8042Controller.cpp')
-rw-r--r-- | Kernel/Devices/HID/I8042Controller.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Kernel/Devices/HID/I8042Controller.cpp b/Kernel/Devices/HID/I8042Controller.cpp index 423b0dc71a..c19c58b38a 100644 --- a/Kernel/Devices/HID/I8042Controller.cpp +++ b/Kernel/Devices/HID/I8042Controller.cpp @@ -131,21 +131,20 @@ UNMAP_AFTER_INIT void I8042Controller::detect_devices() m_mouse_device->enable_interrupts(); } -bool I8042Controller::irq_process_input_buffer(HIDDevice::Type) +bool I8042Controller::irq_process_input_buffer(HIDDevice::Type instrument_type) { VERIFY(Processor::current_in_irq()); u8 status = IO::in8(I8042Port::Status); if (!(status & I8042StatusFlag::OutputBuffer)) return false; - HIDDevice::Type data_for_device = ((status & I8042StatusFlag::SecondPS2PortOutputBuffer) == 0) ? HIDDevice::Type::Keyboard : HIDDevice::Type::Mouse; u8 byte = IO::in8(I8042Port::Buffer); - if (data_for_device == HIDDevice::Type::Mouse) { + if (instrument_type == HIDDevice::Type::Mouse) { VERIFY(m_mouse_device); static_cast<PS2MouseDevice&>(*m_mouse_device).irq_handle_byte_read(byte); return true; } - if (data_for_device == HIDDevice::Type::Keyboard) { + if (instrument_type == HIDDevice::Type::Keyboard) { VERIFY(m_keyboard_device); static_cast<PS2KeyboardDevice&>(*m_keyboard_device).irq_handle_byte_read(byte); return true; |