Kernel: Detect PS2 keyboards on some chromebooks properly
Some chromebooks don't support PS2 controller reset and ignore it. Other OSes in case of failed reset check by keyboard ID. Do the same
This commit is contained in:
parent
160609d80a
commit
3e1146d4b8
Notes:
sideshowbarker
2024-07-17 07:09:53 +09:00
Author: https://github.com/phcoder Commit: https://github.com/SerenityOS/serenity/commit/3e1146d4b8 Pull-request: https://github.com/SerenityOS/serenity/pull/20150 Reviewed-by: https://github.com/gmta Reviewed-by: https://github.com/supercomputer7
1 changed files with 23 additions and 1 deletions
|
@ -47,7 +47,29 @@ UNMAP_AFTER_INIT ErrorOr<NonnullOwnPtr<PS2KeyboardDevice>> PS2KeyboardDevice::tr
|
|||
|
||||
UNMAP_AFTER_INIT ErrorOr<void> PS2KeyboardDevice::initialize()
|
||||
{
|
||||
return attached_controller().reset_device(attached_port_index());
|
||||
ErrorOr<void> err = attached_controller().reset_device(attached_port_index());
|
||||
|
||||
if (err.is_error()) {
|
||||
TRY(attached_controller().send_command(attached_port_index(), SerialIOController::DeviceCommand::GetDeviceID));
|
||||
ErrorOr<u8> res = attached_controller().read_from_device(attached_port_index());
|
||||
if (res.is_error()) {
|
||||
return err;
|
||||
}
|
||||
switch (res.value()) {
|
||||
// Regular and NCD Sun keyboards.
|
||||
case 0xab:
|
||||
case 0xac:
|
||||
// Trust keyboard, raw and translated
|
||||
case 0x2b:
|
||||
case 0x5d:
|
||||
// NMB SGI keyboard, raw and translated
|
||||
case 0x60:
|
||||
case 0x47:
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
// FIXME: UNMAP_AFTER_INIT might not be correct, because in practice PS/2 devices
|
||||
|
|
Loading…
Add table
Reference in a new issue