1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:37:35 +00:00

Kernel: Keep reading from i8042 until the buffer is empty

Otherwise we might not drain the mouse buffer until the next IRQ.
This commit is contained in:
Andreas Kling 2020-11-14 17:18:58 +01:00
parent a5982f8605
commit 467f6c74a4

View file

@ -149,13 +149,15 @@ void I8042Controller::irq_process_input_buffer(Device)
{ {
ASSERT(Processor::current().in_irq()); ASSERT(Processor::current().in_irq());
u8 status = IO::in8(I8042_STATUS); for (;;) {
if (!(status & I8042_BUFFER_FULL)) u8 status = IO::in8(I8042_STATUS);
return; if (!(status & I8042_BUFFER_FULL))
Device data_for_device = ((status & I8042_WHICH_BUFFER) == I8042_MOUSE_BUFFER) ? Device::Mouse : Device::Keyboard; return;
u8 byte = IO::in8(I8042_BUFFER); Device data_for_device = ((status & I8042_WHICH_BUFFER) == I8042_MOUSE_BUFFER) ? Device::Mouse : Device::Keyboard;
if (auto* device = m_devices[data_for_device == Device::Keyboard ? 0 : 1].device) u8 byte = IO::in8(I8042_BUFFER);
device->irq_handle_byte_read(byte); if (auto* device = m_devices[data_for_device == Device::Keyboard ? 0 : 1].device)
device->irq_handle_byte_read(byte);
}
} }
void I8042Controller::do_drain() void I8042Controller::do_drain()