Kernel: Add support for HID Report ID and parsing all collections

Only the first top-level collection is used for the device, but that
seems to generally be what keyboard and mouse use for input.
This commit is contained in:
2024-07-15 15:51:07 +03:00
parent 60b396fee5
commit 42c3fa24f0
2 changed files with 88 additions and 50 deletions

View File

@@ -17,6 +17,7 @@ namespace Kernel
uint16_t usage_id;
Type type;
uint8_t report_id;
uint32_t report_count;
uint32_t report_size;
@@ -77,15 +78,17 @@ namespace Kernel
BAN::ErrorOr<void> initialize();
void forward_collection_inputs(const USBHID::Collection&, BAN::ConstByteSpan& data, size_t bit_offset);
void forward_collection_inputs(const USBHID::Collection&, BAN::Optional<uint8_t> report_id, BAN::ConstByteSpan& data, size_t bit_offset);
private:
USBDevice& m_device;
USBDevice::InterfaceDescriptor m_interface;
const uint8_t m_interface_index;
bool m_uses_report_id { false };
uint8_t m_endpoint_id { 0 };
USBHID::Collection m_collection;
BAN::Vector<USBHID::Collection> m_collections;
BAN::RefPtr<USBHIDDevice> m_hid_device;
friend class BAN::UniqPtr<USBHIDDriver>;