[idd] input: add mouse and keyboard IPC messages

Replace raw HID report forwarding with typed absolute mouse, relative
mouse, and keyboard messages.

Expose absolute and relative modes as separate Mouse collections because
Windows MouHID requires one X/Y motion mode per mouse device.
This commit is contained in:
Geoffrey McRae
2026-08-08 19:39:17 +10:00
parent 241ab3fad2
commit 04fd31219c
7 changed files with 288 additions and 29 deletions

View File

@@ -22,11 +22,11 @@
static const uint8_t REPORT_DESCRIPTOR[] =
{
// Absolute tablet, report ID 1.
// Absolute mouse, report ID 1.
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x02, // Usage (Mouse)
0xA1, 0x01, // Collection (Application)
0x85, HID_REPORT_ID_TABLET,
0x85, HID_REPORT_ID_MOUSE_ABSOLUTE,
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Physical)
0x05, 0x09, // Usage Page (Button)
@@ -48,6 +48,12 @@ static const uint8_t REPORT_DESCRIPTOR[] =
0x75, 0x10, // Report Size (16)
0x95, 0x02, // Report Count (2)
0x81, 0x02, // Input (Data, Variable, Absolute)
0x09, 0x38, // Usage (Wheel)
0x15, 0x81, // Logical Minimum (-127)
0x25, 0x7F, // Logical Maximum (127)
0x75, 0x08, // Report Size (8)
0x95, 0x01, // Report Count (1)
0x81, 0x06, // Input (Data, Variable, Relative)
0xC0, // End Collection
0xC0, // End Collection
@@ -55,7 +61,7 @@ static const uint8_t REPORT_DESCRIPTOR[] =
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x02, // Usage (Mouse)
0xA1, 0x01, // Collection (Application)
0x85, HID_REPORT_ID_MOUSE,
0x85, HID_REPORT_ID_MOUSE_RELATIVE,
0x09, 0x01, // Usage (Pointer)
0xA1, 0x00, // Collection (Physical)
0x05, 0x09, // Usage Page (Button)
@@ -136,11 +142,11 @@ size_t HIDGetInputReportSize(uint8_t reportId)
{
switch (reportId)
{
case HID_REPORT_ID_TABLET:
return sizeof(HIDTabletReport);
case HID_REPORT_ID_MOUSE_ABSOLUTE:
return sizeof(HIDMouseAbsoluteReport);
case HID_REPORT_ID_MOUSE:
return sizeof(HIDMouseReport);
case HID_REPORT_ID_MOUSE_RELATIVE:
return sizeof(HIDMouseRelativeReport);
case HID_REPORT_ID_KEYBOARD:
return sizeof(HIDKeyboardReport);