Skip to content

Feather RP2040, v10.0.3, not showing proper device enum for gamepad HID #10780

@TSSProg

Description

@TSSProg

CircuitPython version and board name

Adafruit CircuitPython 10.0.3 on 2025-10-17; Adafruit Feather RP2040 with rp2040

Code/REPL

Contents of boot.py:

import usb_hid

GAMEPAD_REPORT_DESCRIPTOR = bytes((
    0x05, 0x01,  # Usage Page (Generic Desktop)
    0x09, 0x05,  # Usage (Gamepad)
    0xA1, 0x01,  # Collection (Application)
    0xA1, 0x00,  #   Collection (Physical)
    0x05, 0x09,  #     Usage Page (Button)
    0x19, 0x01,  #     Usage Minimum (Button 1)
    0x29, 0x10,  #     Usage Maximum (Button 16)
    0x15, 0x00,  #     Logical Minimum (0)
    0x25, 0x01,  #     Logical Maximum (1)
    0x75, 0x01,  #     Report Size (1)
    0x95, 0x10,  #     Report Count (16)
    0x81, 0x02,  #     Input (Data,Var,Abs)
    0x05, 0x01,  #     Usage Page (Generic Desktop)
    0x09, 0x30,  #     Usage (X)
    0x09, 0x31,  #     Usage (Y)
    0x09, 0x32,  #     Usage (Z)
    0x09, 0x35,  #     Usage (Rz)
    0x15, 0x81,  #     Logical Minimum (-127)
    0x25, 0x7F,  #     Logical Maximum (127)
    0x75, 0x08,  #     Report Size (8)
    0x95, 0x04,  #     Report Count (4)
    0x81, 0x02,  #     Input (Data,Var,Abs)
    0xC0,        #   End Collection
    0xC0         # End Collection
))

usb_hid.enable(
    (),  # No default devices
    custom_devices=[
        usb_hid.Device(
            report_descriptor=GAMEPAD_REPORT_DESCRIPTOR,
            usage_page=0x01,
            usage=0x05,
            in_report_length=6,
            out_report_length=0,
        )
    ]
)

Contents of code.py:

import usb_hid

for device in usb_hid.devices:
    print(device.usage_page, device.usage)

Behavior

Output:

1 6
1 2
12 1

None of these matches 0x01, 0x05, which is what the gamepad sample code needs to see.

For example ...

# Find the custom gamepad device
gamepad = None
for device in usb_hid.devices:
    if device.usage_page == 0x01 and device.usage == 0x05:
        gamepad = device
        break

if gamepad is None:
    raise RuntimeError("Gamepad HID device not found")

while True:
    # Example: All buttons released, all axes centered
    report = bytearray([0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
    gamepad.send_report(report)
    time.sleep(0.1)

By tinkering with this on a Pico, I learned I'd need a Feather instead, even if it had a 2040 chip.

Description

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions