- 0x05, 0x01, // Usage Page (Generic Desktop)
- 0x09, 0x02, // Usage (Mouse)
- 0xA1, 0x01, // Collection (Application)
- 0x05, 0x09, // Usage Page (Button)
- 0x19, 0x01, // Usage Minimum (Button #1)
- 0x29, 0x03, // Usage Maximum (Button #3)
- 0x15, 0x00, // Logical Minimum (0)
- 0x25, 0x01, // Logical Maximum (1)
- 0x95, 0x03, // Report Count (3)
- 0x75, 0x01, // Report Size (1)
- 0x81, 0x02, // Input (Data, Variable, Absolute)
- 0x95, 0x01, // Report Count (1)
- 0x75, 0x05, // Report Size (5)
- 0x81, 0x03, // Input (Constant)
- 0x05, 0x01, // Usage Page (Generic Desktop)
- 0x09, 0x30, // Usage (X)
- 0x09, 0x31, // Usage (Y)
- 0x15, 0x00, // Logical Minimum (0)
- 0x26, 0xFF, 0x7F, // Logical Maximum (32767)
- 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
+ 0x05, 0x01, // Usage Page (Generic Desktop)
+ 0x09, 0x02, // Usage (Mouse)
+ 0xa1, 0x01, // Collection (Application)
+ 0x09, 0x02, // Usage (Mouse)
+ 0xa1, 0x02, // Collection (Logical)
+ 0x09, 0x01, // Usage (Pointer)
+
+ // Buttons (5 bits)
+ 0xa1, 0x00, // Collection (Physical) - Buttons
+ 0x05, 0x09, // Usage Page (Button)
+ 0x19, 0x01, // Usage Minimum (Button 1)
+ 0x29, 0x05, // Usage Maximum (Button 5)
+ 0x15, 0x00, // Logical Minimum (0)
+ 0x25, 0x01, // Logical Maximum (1)
+ 0x75, 0x01, // Report Size (1)
+ 0x95, 0x05, // Report Count (5)
+ 0x81, 0x02, // Input (Data,Var,Abs)
+
+ // Padding (3 bits)
+ 0x75, 0x03, // Report Size (3)
+ 0x95, 0x01, // Report Count (1)
+ 0x81, 0x03, // Input (Cnst,Var,Abs)
+
+ // Pointer (16 bits)
+ 0x05, 0x01, // Usage PAGE (Generic Desktop)
+ 0x09, 0x30, // Usage (X)
+ 0x09, 0x31, // Usage (Y)
+ 0x15, 0x81, // Logical Minimum (-127)
+ 0x25, 0x7f, // Logical Maximum (127)
+ 0x75, 0x08, // Report Size (8)
+ 0x95, 0x02, // Report Count (2)
+ 0x81, 0x06, // Input (Data,Var,Rel)
+
+ // Vertical Wheel
+ // - Multiplier (2 bits)
+ 0xa1, 0x02, // Collection (Logical)
+ 0x09, 0x48, // Usage (Resolution Multiplier)
+ 0x15, 0x00, // Logical Minimum (0)
+ 0x25, 0x01, // Logical Maximum (1)
+ 0x35, 0x01, // Physical Minimum (1)
+ 0x45, 0x04, // Physical Maximum (4)
+ 0x75, 0x02, // Report Size (2)
+ 0x95, 0x01, // Report Count (1)
+ 0xa4, // Push
+ 0xb1, 0x02, // Feature (Data,Var,Abs)
+ // - Device (8 bits)
+ 0x09, 0x38, // Usage (Wheel)
+ 0x15, 0x81, // Logical Minimum (-127)
+ 0x25, 0x7f, // Logical Maximum (127)
+ 0x35, 0x00, // Physical Minimum (0) - reset physical
+ 0x45, 0x00, // Physical Maximum (0)
+ 0x75, 0x08, // Report Size (8)
+ 0x81, 0x06, // Input (Data,Var,Rel)
+ 0xc0, // End Collection - Vertical Wheel
+
+ // Horizontal Wheel
+ // - Multiplier (2 bits)
+ 0xa1, 0x02, // Collection (Logical)
+ 0x09, 0x48, // Usage (Resolution Multiplier)
+ 0xb4, // Pop
+ 0xb1, 0x02, // Feature (Data,Var,Abs)
+ // - Padding (4 bits)
+ 0x35, 0x00, // Physical Minimum (0) - reset physical
+ 0x45, 0x00, // Physical Maximum (0)
+ 0x75, 0x04, // Report Size (4)
+ 0xb1, 0x03, // Feature (Cnst,Var,Abs)
+ // - Device (8 bits)
+ 0x05, 0x0c, // Usage Page (Consumer Devices)
+ 0x0a, 0x38, 0x02, // Usage (AC Pan)
+ 0x15, 0x81, // Logical Minimum (-127)
+ 0x25, 0x7f, // Logical Maximum (127)
+ 0x75, 0x08, // Report Size (8)
+ 0x81, 0x06, // Input (Data,Var,Rel)
+ 0xc0, // End Collection - Horizontal Wheel
+
+ 0xc0, // End Collection - Buttons
+ 0xc0, // End Collection - Mouse Logical
+ 0xc0 // End Collection - Mouse Application
+};
+
+// Joystick Protocol, HID 1.11 spec, Apendix D, page 64-65
+static uint8_t joystick_report_desc[] = {
+ 0x05, 0x01, // Usage Page (Generic Desktop)
+ 0x09, 0x04, // Usage (Joystick)
+ 0xA1, 0x01, // Collection (Application)
+ 0x15, 0x00, // Logical Minimum (0)
+ 0x25, 0x01, // Logical Maximum (1)
+ 0x75, 0x01, // Report Size (1)
+ 0x95, 0x20, // Report Count (32)
+ 0x05, 0x09, // Usage Page (Button)
+ 0x19, 0x01, // Usage Minimum (Button #1)
+ 0x29, 0x20, // Usage Maximum (Button #32)
+ 0x81, 0x02, // Input (variable,absolute)
+ 0x15, 0x00, // Logical Minimum (0)
+ 0x25, 0x07, // Logical Maximum (7)
+ 0x35, 0x00, // Physical Minimum (0)
+ 0x46, 0x3B, 0x01, // Physical Maximum (315)
+ 0x75, 0x04, // Report Size (4)
+ 0x95, 0x01, // Report Count (1)
+ 0x65, 0x14, // Unit (20)
+ 0x05, 0x01, // Usage Page (Generic Desktop)
+ 0x09, 0x39, // Usage (Hat switch)
+ 0x81, 0x42, // Input (variable,absolute,null_state)
+ 0x05, 0x01, // Usage Page (Generic Desktop)
+ 0x09, 0x01, // Usage (Pointer)
+ 0xA1, 0x00, // Collection ()
+ 0x15, 0x00, // Logical Minimum (0)
+ 0x26, 0xFF, 0x03, // Logical Maximum (1023)
+ 0x75, 0x0A, // Report Size (10)
+ 0x95, 0x04, // Report Count (4)
+ 0x09, 0x30, // Usage (X)
+ 0x09, 0x31, // Usage (Y)
+ 0x09, 0x32, // Usage (Z)
+ 0x09, 0x35, // Usage (Rz)
+ 0x81, 0x02, // Input (variable,absolute)
+ 0xC0, // End Collection
+ 0x15, 0x00, // Logical Minimum (0)
+ 0x26, 0xFF, 0x03, // Logical Maximum (1023)
+ 0x75, 0x0A, // Report Size (10)
+ 0x95, 0x02, // Report Count (2)
+ 0x09, 0x36, // Usage (Slider)
+ 0x09, 0x36, // Usage (Slider)
+ 0x81, 0x02, // Input (variable,absolute)
+ 0xC0 // End Collection