1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 02:17:34 +00:00

Kernel: Increase delay and attempts count when checking i8042 existence

This commit is contained in:
Liav A 2022-02-11 18:57:08 +02:00 committed by Andreas Kling
parent 506c13d143
commit 0881a7be8d

View file

@ -36,14 +36,14 @@ UNMAP_AFTER_INIT bool I8042Controller::check_existence(Badge<HIDManagement>)
{ {
SpinlockLocker lock(m_lock); SpinlockLocker lock(m_lock);
// Note: Perform controller self-test before touching the controller // Note: Perform controller self-test before touching the controller
// Try to probe the controller for 5 times and give up if nothing // Try to probe the controller for 10 times and give up if nothing
// responded. // responded.
for (int attempt = 0; attempt < 5; attempt++) { for (int attempt = 0; attempt < 10; attempt++) {
do_write(I8042Port::Command, I8042Command::TestPS2Controller); do_write(I8042Port::Command, I8042Command::TestPS2Controller);
if (do_read(I8042Port::Buffer) == I8042Response::ControllerTestPassed) if (do_read(I8042Port::Buffer) == I8042Response::ControllerTestPassed)
return true; return true;
// Note: Wait 50 microseconds in case the controller couldn't respond // Note: Wait 500 microseconds in case the controller couldn't respond
IO::delay(50); IO::delay(500);
} }
dbgln("I8042: Trying to probe for existence of controller failed"); dbgln("I8042: Trying to probe for existence of controller failed");
return false; return false;