summaryrefslogtreecommitdiff
path: root/Kernel/Arch/x86_64/ISABus
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-12-22 04:18:50 +0200
committerJelle Raaijmakers <jelle@gmta.nl>2023-01-06 11:09:56 +0100
commit3d87445c823e5b49ace4cb2a51b53353fc6e766d (patch)
tree23e8a74b5f53682d8fae466a3a97c4e04e7e9d94 /Kernel/Arch/x86_64/ISABus
parent0f7cc468b2221d54ea79523922a2f21790c02645 (diff)
downloadserenity-3d87445c823e5b49ace4cb2a51b53353fc6e766d.zip
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.
Diffstat (limited to 'Kernel/Arch/x86_64/ISABus')
-rw-r--r--Kernel/Arch/x86_64/ISABus/I8042Controller.cpp5
-rw-r--r--Kernel/Arch/x86_64/ISABus/I8042Controller.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/Kernel/Arch/x86_64/ISABus/I8042Controller.cpp b/Kernel/Arch/x86_64/ISABus/I8042Controller.cpp
index f4ceeea04e..3b80df2cb1 100644
--- a/Kernel/Arch/x86_64/ISABus/I8042Controller.cpp
+++ b/Kernel/Arch/x86_64/ISABus/I8042Controller.cpp
@@ -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 {
diff --git a/Kernel/Arch/x86_64/ISABus/I8042Controller.h b/Kernel/Arch/x86_64/ISABus/I8042Controller.h
index e62b5517a3..c73997150b 100644
--- a/Kernel/Arch/x86_64/ISABus/I8042Controller.h
+++ b/Kernel/Arch/x86_64/ISABus/I8042Controller.h
@@ -34,6 +34,7 @@ enum I8042Command : u8 {
GetDeviceID = 0xF2,
SetSampleRate = 0xF3,
EnablePacketStreaming = 0xF4,
+ DisablePacketStreaming = 0xF5,
SetDefaults = 0xF6,
Reset = 0xFF,
};