mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +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:
parent
0881a7be8d
commit
32053e8f25
Notes:
sideshowbarker
2024-07-17 18:59:15 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/32053e8f25 Pull-request: https://github.com/SerenityOS/serenity/pull/12439 Issue: https://github.com/SerenityOS/serenity/issues/12432
1 changed files with 5 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue