Skip to content

Conversation

@finger563
Copy link
Contributor

@finger563 finger563 commented Feb 10, 2025

Description

  • Update HID-RP submodule to have latest changes which include more unit customization
  • Update hid-rp-gamepad to more closely match xbox 1708 controller descriptor
  • Update hid-rp-gamepad to have new XboxRumbleOutputReport descriptor
  • Update hid-rp-gamepad to flesh out led descriptor some more
  • Update hid_rp_example to include new rumble report
  • Update hid_service_example to include new rumble report
  • Update hid_service_example to exercise new consumer record button in gamepad report
  • Update hid_service_example to add characteristic onWrite callbacks for Rumble and LED, parsing the data that is returned

Motivation and Context

This provides better HID examples and showcases the use of output reports for LED and rumble control. It also updates the examples to better match xbox wireless controller model 1708 for better compatibility.

Relevant commits from hid-rp:

How has this been tested?

  • Build and run hid-rp/example on QtPy ESP32s3 and ensure the output matches the 1708 descriptor
  • Build and run hid_service/example on QtPy ESP32s3 and ensure the following work with iPhone:
    • All gamepad inputs (including new consumer record button)
    • Battery input report (via game controller settings page)
    • Rumble output report (by pressing the identify controller button in the game controller settings page)

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

HID Service example:
CleanShot 2025-02-10 at 10 45 24

Zoom in on Rumble report characteristic write callback:
CleanShot 2025-02-10 at 10 51 47

HID-RP example:
CleanShot 2025-02-10 at 10 48 04

Generated report descriptor:

0x5, 0x1, 0x9, 0x5, 0xa1, 0x1, 0x85, 0x1, 0x9, 0x1, 0xa1, 0x0, 0x9, 0x30, 0x9, 0x31, 0x15, 0x0, 0x27, 0xff, 0xff, 0x0, 0x0, 0x95, 0x2, 0x75, 0x10, 0x81, 0x2, 0xc0, 0x9, 0x1, 0xa1, 0x0, 0x9, 0x32, 0x9, 0x35, 0x15, 0x0, 0x27, 0xff, 0xff, 0x0, 0x0, 0x95, 0x2, 0x75, 0x10, 0x81, 0x2, 0xc0, 0x5, 0x2, 0x9, 0xc5, 0x15, 0x0, 0x26, 0xff, 0x3, 0x95, 0x1, 0x75, 0xa, 0x81, 0x2, 0x15, 0x0, 0x25, 0x0, 0x95, 0x1, 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, 0x75, 0x8, 0x95, 0x1, 0x91, 0x2, 0xc0, 0x85, 0x4, 0x9, 0x20, 0x85, 0x4, 0x15, 0x0, 0x26, 0xff, 0x0, 0x75, 0x8, 0x95, 0x1, 0x9, 0x20, 0x81, 0x2, 0x85, 0x2, 0x5, 0x8, 0x19, 0x61, 0x29, 0x64, 0x15, 0x0, 0x25, 0x1, 0x75, 0x1, 0x95, 0x4, 0x91, 0x2, 0x95, 0x1, 0x75, 0x4, 0x91, 0x1, 0xc0

Parsed by https://eleccelerator.com/usbdescreqparser/ :

0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
0x09, 0x05,        // Usage (Game Pad)
0xA1, 0x01,        // Collection (Application)
0x85, 0x01,        //   Report ID (1)
0x09, 0x01,        //   Usage (Pointer)
0xA1, 0x00,        //   Collection (Physical)
0x09, 0x30,        //     Usage (X)
0x09, 0x31,        //     Usage (Y)
0x15, 0x00,        //     Logical Minimum (0)
0x27, 0xFF, 0xFF, 0x00, 0x00,  //     Logical Maximum (65534)
0x95, 0x02,        //     Report Count (2)
0x75, 0x10,        //     Report Size (16)
0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              //   End Collection
0x09, 0x01,        //   Usage (Pointer)
0xA1, 0x00,        //   Collection (Physical)
0x09, 0x32,        //     Usage (Z)
0x09, 0x35,        //     Usage (Rz)
0x15, 0x00,        //     Logical Minimum (0)
0x27, 0xFF, 0xFF, 0x00, 0x00,  //     Logical Maximum (65534)
0x95, 0x02,        //     Report Count (2)
0x75, 0x10,        //     Report Size (16)
0x81, 0x02,        //     Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              //   End Collection
0x05, 0x02,        //   Usage Page (Sim Ctrls)
0x09, 0xC5,        //   Usage (Brake)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x03,  //   Logical Maximum (1023)
0x95, 0x01,        //   Report Count (1)
0x75, 0x0A,        //   Report Size (10)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x00,        //   Logical Maximum (0)
0x95, 0x01,        //   Report Count (1)
0x75, 0x06,        //   Report Size (6)
0x81, 0x01,        //   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x02,        //   Usage Page (Sim Ctrls)
0x09, 0xC4,        //   Usage (Accelerator)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x03,  //   Logical Maximum (1023)
0x95, 0x01,        //   Report Count (1)
0x75, 0x0A,        //   Report Size (10)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x00,        //   Logical Maximum (0)
0x95, 0x01,        //   Report Count (1)
0x75, 0x06,        //   Report Size (6)
0x81, 0x01,        //   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x01,        //   Usage Page (Generic Desktop Ctrls)
0x09, 0x39,        //   Usage (Hat switch)
0x15, 0x01,        //   Logical Minimum (1)
0x25, 0x08,        //   Logical Maximum (8)
0x35, 0x00,        //   Physical Minimum (0)
0x46, 0x3B, 0x01,  //   Physical Maximum (315)
0x66, 0x14, 0x00,  //   Unit (System: English Rotation, Length: Centimeter)
0x75, 0x04,        //   Report Size (4)
0x95, 0x01,        //   Report Count (1)
0x81, 0x42,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,Null State)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x00,        //   Logical Maximum (0)
0x35, 0x00,        //   Physical Minimum (0)
0x45, 0x00,        //   Physical Maximum (0)
0x65, 0x00,        //   Unit (None)
0x55, 0x00,        //   Unit Exponent (0)
0x95, 0x01,        //   Report Count (1)
0x75, 0x04,        //   Report Size (4)
0x81, 0x01,        //   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x09,        //   Usage Page (Button)
0x19, 0x01,        //   Usage Minimum (0x01)
0x29, 0x0F,        //   Usage Maximum (0x0F)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x0F,        //   Report Count (15)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x00,        //   Logical Maximum (0)
0x95, 0x01,        //   Report Count (1)
0x75, 0x01,        //   Report Size (1)
0x81, 0x01,        //   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x0C,        //   Usage Page (Consumer)
0x0A, 0xB2, 0x00,  //   Usage (Record)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x95, 0x01,        //   Report Count (1)
0x75, 0x01,        //   Report Size (1)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x00,        //   Logical Maximum (0)
0x95, 0x01,        //   Report Count (1)
0x75, 0x07,        //   Report Size (7)
0x81, 0x01,        //   Input (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x05, 0x0F,        //   Usage Page (PID Page)
0x09, 0x21,        //   Usage (0x21)
0x85, 0x03,        //   Report ID (3)
0xA1, 0x02,        //   Collection (Logical)
0x09, 0x97,        //     Usage (0x97)
0x15, 0x00,        //     Logical Minimum (0)
0x25, 0x01,        //     Logical Maximum (1)
0x75, 0x04,        //     Report Size (4)
0x95, 0x01,        //     Report Count (1)
0x91, 0x02,        //     Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x15, 0x00,        //     Logical Minimum (0)
0x25, 0x00,        //     Logical Maximum (0)
0x75, 0x04,        //     Report Size (4)
0x95, 0x01,        //     Report Count (1)
0x91, 0x03,        //     Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x09, 0x70,        //     Usage (0x70)
0x15, 0x00,        //     Logical Minimum (0)
0x25, 0x64,        //     Logical Maximum (100)
0x75, 0x08,        //     Report Size (8)
0x95, 0x04,        //     Report Count (4)
0x91, 0x02,        //     Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x09, 0x50,        //     Usage (0x50)
0x66, 0x01, 0x10,  //     Unit (System: SI Linear, Time: Seconds)
0x55, 0x0E,        //     Unit Exponent (-2)
0x15, 0x00,        //     Logical Minimum (0)
0x26, 0xFF, 0x00,  //     Logical Maximum (255)
0x75, 0x08,        //     Report Size (8)
0x95, 0x01,        //     Report Count (1)
0x91, 0x02,        //     Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x09, 0xA7,        //     Usage (0xA7)
0x15, 0x00,        //     Logical Minimum (0)
0x26, 0xFF, 0x00,  //     Logical Maximum (255)
0x75, 0x08,        //     Report Size (8)
0x95, 0x01,        //     Report Count (1)
0x91, 0x02,        //     Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x65, 0x00,        //     Unit (None)
0x55, 0x00,        //     Unit Exponent (0)
0x09, 0x7C,        //     Usage (0x7C)
0x15, 0x00,        //     Logical Minimum (0)
0x26, 0xFF, 0x00,  //     Logical Maximum (255)
0x75, 0x08,        //     Report Size (8)
0x95, 0x01,        //     Report Count (1)
0x91, 0x02,        //     Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              //   End Collection
0x85, 0x04,        //   Report ID (4)
0x09, 0x20,        //   Usage (0x20)
0x85, 0x04,        //   Report ID (4)
0x15, 0x00,        //   Logical Minimum (0)
0x26, 0xFF, 0x00,  //   Logical Maximum (255)
0x75, 0x08,        //   Report Size (8)
0x95, 0x01,        //   Report Count (1)
0x09, 0x20,        //   Usage (0x20)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x85, 0x02,        //   Report ID (2)
0x05, 0x08,        //   Usage Page (LEDs)
0x19, 0x61,        //   Usage Minimum (0x61)
0x29, 0x64,        //   Usage Maximum (0x64)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x04,        //   Report Count (4)
0x91, 0x02,        //   Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x95, 0x01,        //   Report Count (1)
0x75, 0x04,        //   Report Size (4)
0x91, 0x01,        //   Output (Const,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              // End Collection

// 328 bytes

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

* Update HID-RP submodule to have latest changes which include more unit customization
* Update hid-rp-gamepad to more closely match xbox 1708 controller descriptor
* Update hid-rp-gamepad to have new XboxRumbleOutputReport descriptor
* Update hid-rp-gamepad to flesh out led descriptor some more
* Update hid_rp_example to include new rumble report
* Update hid_service_example to include new rumble report
* Update hid_service_example to exercise new consumer record button in gamepad report
* Update hid_service_example to add characteristic onWrite callbacks for Rumble and LED, parsing the data that is returned

This provides better HID examples and showcases the use of output reports for LED and rumble control. It also updates the examples to better match xbox wireless controller model 1708 for better compatibility.

* Build and run `hid-rp/example` on QtPy ESP32s3 and ensure the output matches the 1708 descriptor
* Build and run `hid_service/example` on QtPy ESP32s3 and ensure the following work with iPhone:
  * All gamepad inputs (including new consumer record button)
  * Battery input report (via game controller settings page)
  * Rumble output report (by pressing the `identify controller` button in the game controller settings page)
@finger563 finger563 self-assigned this Feb 10, 2025
@github-actions
Copy link

github-actions bot commented Feb 10, 2025

✅Static analysis result - no issues found! ✅

@finger563 finger563 merged commit e6ee599 into main Feb 10, 2025
70 checks passed
@finger563 finger563 deleted the feat/hid-rp-update branch February 10, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants