From eca8208a345858ef2e132623af08b885a43c7ad4 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 18 Feb 2022 23:57:26 +0000 Subject: [PATCH] Kernel: Increase i8042 IO attempt counts, again This is very similar to the change that was done in 32053e8, except it turned out that the new limit of 50 iterations was not enough when testing on bare metal - most IO operations would succeed in the first or second iteration, but two of them took 140 and 150 iterations respectively. Increase the limit from 50 to 250 to account for this, and have some additional headroom. --- Kernel/Devices/HID/I8042Controller.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Kernel/Devices/HID/I8042Controller.cpp b/Kernel/Devices/HID/I8042Controller.cpp index a970d0312dc..daf354b0713 100644 --- a/Kernel/Devices/HID/I8042Controller.cpp +++ b/Kernel/Devices/HID/I8042Controller.cpp @@ -268,7 +268,7 @@ ErrorOr I8042Controller::prepare_for_input(HIDDevice::Type device) { VERIFY(m_lock.is_locked()); u8 const second_port_flag = device == HIDDevice::Type::Keyboard ? 0 : I8042StatusFlag::SecondPS2PortOutputBuffer; - for (int attempt = 0; attempt < 50; attempt++) { + for (int attempt = 0; attempt < 250; attempt++) { u8 status = IO::in8(I8042Port::Status); if (!(status & I8042StatusFlag::OutputBuffer)) { IO::delay(1000); @@ -286,7 +286,7 @@ ErrorOr I8042Controller::prepare_for_input(HIDDevice::Type device) ErrorOr I8042Controller::prepare_for_output() { VERIFY(m_lock.is_locked()); - for (int attempt = 0; attempt < 50; attempt++) { + for (int attempt = 0; attempt < 250; attempt++) { u8 status = IO::in8(I8042Port::Status); if (!(status & I8042StatusFlag::InputBuffer)) return {};