serenity/Kernel/Devices/HID/Definitions.h
Liav A c8f27d7cb8 Kernel+Userland: Implement support for PS2 scan code set 2
This scan code set is more advanced than the basic scan code set 1, and
is required to be supported for some bare metal hardware that might not
properly enable the PS2 first port translation in the i8042 controller.

LibWeb can now also generate bindings for keyboard events like the Pause
key, as well as other function keys (such as Right Alt, etc).

The logic for handling scan code sets is implemented by the PS2 keyboard
driver and is abstracted from the main HID KeyboardDevice code which
only handles "standard" KeyEvent(s).
2024-01-04 10:38:03 -07:00

33 lines
505 B
C++

/*
* Copyright (c) 2023, Liav A. <liavalb@hotmail.co.il>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Types.h>
#include <Kernel/API/KeyCode.h>
namespace Kernel {
enum class ScanCodeSet {
Set1 = 1,
Set2 = 2,
Set3 = 3,
};
struct KeyCodeEntry {
KeyCode key_code;
u8 map_entry_index;
};
struct RawKeyEvent {
KeyCodeEntry code_entry;
u64 scancode { 0 };
bool is_press_down { false };
bool is_press() const { return is_press_down; }
};
}