Kernel: Restore setting i8042 scan code set to scan code set 2 sequence

This seems to work perfectly OK on my ICH7 test machine and also it
works on QEMU, so it is probably OK to restore this.
This will ensure we always get scan code set 1 input, because we enable
scan code set 2 and PS/2 translation on the first (keyboard) port.
This commit is contained in:
Liav A 2022-12-22 04:18:50 +02:00 committed by Jelle Raaijmakers
parent 0f7cc468b2
commit 3d87445c82
2 changed files with 6 additions and 0 deletions

View file

@ -176,6 +176,11 @@ UNMAP_AFTER_INIT ErrorOr<void> I8042Controller::detect_devices()
configuration |= I8042ConfigurationFlag::FirstPS2PortClock;
m_keyboard_device = nullptr;
SpinlockLocker lock(m_lock);
// NOTE: Before setting the actual scan code set, stop packet streaming entirely.
TRY(send_command(HIDDevice::Type::Keyboard, I8042Command::DisablePacketStreaming));
TRY(do_wait_then_write(I8042Port::Buffer, I8042Command::SetScanCodeSet));
TRY(do_wait_then_write(I8042Port::Buffer, 0x2));
TRY(do_wait_then_write(I8042Port::Command, I8042Command::WriteConfiguration));
TRY(do_wait_then_write(I8042Port::Buffer, configuration));
} else {

View file

@ -34,6 +34,7 @@ enum I8042Command : u8 {
GetDeviceID = 0xF2,
SetSampleRate = 0xF3,
EnablePacketStreaming = 0xF4,
DisablePacketStreaming = 0xF5,
SetDefaults = 0xF6,
Reset = 0xFF,
};