mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
Kernel: Increase attempts count when waiting before doing i8042 IO
Apparently on VirtualBox the keyboard device refused to complete the reset sequence. With longer delays and more attempts before giving up, it seems like the problem is gone.
This commit is contained in:
@@ -268,17 +268,17 @@ ErrorOr<void> 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 < 5; attempt++) {
|
||||
for (int attempt = 0; attempt < 50; attempt++) {
|
||||
u8 status = IO::in8(I8042Port::Status);
|
||||
if (!(status & I8042StatusFlag::OutputBuffer)) {
|
||||
IO::delay(100);
|
||||
IO::delay(1000);
|
||||
continue;
|
||||
}
|
||||
if (device == HIDDevice::Type::Unknown)
|
||||
return {};
|
||||
if ((status & I8042StatusFlag::SecondPS2PortOutputBuffer) == second_port_flag)
|
||||
return {};
|
||||
IO::delay(100);
|
||||
IO::delay(1000);
|
||||
}
|
||||
return Error::from_errno(EBUSY);
|
||||
}
|
||||
@@ -286,11 +286,11 @@ ErrorOr<void> I8042Controller::prepare_for_input(HIDDevice::Type device)
|
||||
ErrorOr<void> I8042Controller::prepare_for_output()
|
||||
{
|
||||
VERIFY(m_lock.is_locked());
|
||||
for (int attempt = 0; attempt < 5; attempt++) {
|
||||
for (int attempt = 0; attempt < 50; attempt++) {
|
||||
u8 status = IO::in8(I8042Port::Status);
|
||||
if (!(status & I8042StatusFlag::InputBuffer))
|
||||
return {};
|
||||
IO::delay(100);
|
||||
IO::delay(1000);
|
||||
}
|
||||
return Error::from_errno(EBUSY);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user