Files
banan-os/kernel/include/kernel/USB/HID/Keyboard.h
T
Bananymous 51badd75f0 Kernel: Move HID led handling from keyboard to usb device
Apparently some keyboards can have led control on another interface from
the one where input is received. Now led mask is global to the usb
devices instead of per keyboard instance.
2026-08-22 11:57:19 +03:00

46 lines
1.1 KiB
C++

#pragma once
#include <kernel/USB/HID/HIDDriver.h>
namespace Kernel
{
class USBKeyboard final : public USBHIDDevice
{
BAN_NON_COPYABLE(USBKeyboard);
BAN_NON_MOVABLE(USBKeyboard);
public:
void start_report() override;
void stop_report() override;
void handle_array(uint16_t usage_page, uint16_t usage) override;
void handle_variable(uint16_t usage_page, uint16_t usage, int64_t state) override;
void handle_variable_absolute(uint16_t usage_page, uint16_t usage, int64_t state, int64_t min, int64_t max) override;
void update() override;
private:
USBKeyboard(USBHIDDriver& driver);
~USBKeyboard() = default;
private:
USBHIDDriver& m_driver;
SpinLock m_keyboard_lock;
InterruptState m_lock_state;
BAN::Array<bool, 0x100> m_keyboard_state { false };
BAN::Array<bool, 0x100> m_keyboard_state_temp { false };
uint16_t m_toggle_mask { 0 };
uint16_t m_led_mask { 0 };
BAN::Optional<uint8_t> m_repeat_scancode;
uint8_t m_repeat_modifier { 0 };
uint64_t m_next_repeat_event_ms { 0 };
friend class BAN::RefPtr<USBKeyboard>;
};
}