Skip to content

How to set USB HID name to a composite HID device #9319

Open
@aroidzap

Description

@aroidzap

CircuitPython version

Adafruit CircuitPython 9.0.5 on 2024-05-22; Waveshare RP2040-Zero with rp2040

Code/REPL

gamepad_a = usb_hid.Device(
    report_descriptor=GAMEPAD_REPORT_DESCRIPTOR_A,
    usage_page=0x01,           # Generic Desktop Control
    usage=0x05,                # Gamepad
    report_ids=(4,),           # Descriptor uses report ID 4.
    # in_report_lengths=(6,),    # This gamepad sends 6 bytes in its report.
    in_report_lengths=(3,),    # This gamepad sends 6 bytes in its report.
    out_report_lengths=(0,),   # It does not receive any reports.
)
gamepad_b = usb_hid.Device(
    report_descriptor=GAMEPAD_REPORT_DESCRIPTOR_B,
    usage_page=0x01,           # Generic Desktop Control
    usage=0x05,                # Gamepad
    report_ids=(5,),           # Descriptor uses report ID 5.
    # in_report_lengths=(6,),    # This gamepad sends 6 bytes in its report.
    in_report_lengths=(3,),    # This gamepad sends 6 bytes in its report.
    out_report_lengths=(0,),   # It does not receive any reports.
)

usb_hid.set_interface_name("Joystick")
usb_hid.enable((
    # usb_hid.Device.KEYBOARD,
    # usb_hid.Device.MOUSE,
    # usb_hid.Device.CONSUMER_CONTROL,
    gamepad_a,
    gamepad_b,
))

# usb_hid.set_interface_name("Joystick 1")
# usb_hid.enable((gamepad_a,))
# usb_hid.set_interface_name("Joystick 2")
# usb_hid.enable((gamepad_b,))

Behavior

I'm trying to set a name for each USB HID composite device, but I'm not sure how or if it is even supported. Also when only trying to set name for USB HID composite device as whole, I'm getting USB HID name RP2040-Zero instead (in Windows Game Controllers settings). I also tried to remove registry keys as described in #9130.

Description

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions