I have modified the gamepad example to have 2 output bits:
Code: Select all
GAMEPAD_REPORT_DESCRIPTOR = bytes((
0x05, 0x01, # Usage Page (Generic Desktop Ctrls)
0x09, 0x05, # Usage (Game Pad)
0xA1, 0x01, # Collection (Application)
0x85, 0x04, # Report ID (4)
#
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,No Wrap,Linear,Preferred State,No Null Position)
#
0x05, 0x01, # Usage Page (Generic Desktop Ctrls)
0x15, 0x81, # Logical Minimum (-127)
0x25, 0x7F, # Logical Maximum (127)
0x09, 0x30, # Usage (X)
0x09, 0x31, # Usage (Y)
0x09, 0x32, # Usage (Z)
0x09, 0x35, # Usage (Rz)
0x75, 0x08, # Report Size (8)
0x95, 0x04, # Report Count (4)
0x81, 0x02, # Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
#
0x05, 0x09, # Usage Page (Button)
0x19, 0x01, # Usage Minimum (0x01)
0x29, 0x02, # Usage Maximum (0x02)
0x15, 0x00, # Logical Minimum (0)
0x25, 0x01, # Logical Maximum (1)
0x35, 0x00, # Physical Minimum (0)
0x45, 0x01, # Physical Maximum (1)
0x75, 0x01, # Report Size (1)
0x95, 0x02, # Report Count (2)
0x91, 0x0a, # Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0, # End Collection
))
I have added some .get_last_received_report() calls into hid_gamepad.py, trying to clear the incoming reports every time I try to _send.
I have the problem now that I get this now (but only on a Windows host, connecting to a Linux host is ok, though I have not been able to verify actually sending the data out in Linux).
Code: Select all
Traceback (most recent call last):
File "code.py", line 36, in <module>
File "hid_gamepad.py", line 71, in press_buttons
File "hid_gamepad.py", line 146, in _send
OSError: USB busy
Does anyone have any success with sending data *to* a CircuitPython gamepad device? This is CircuitPython 7.3.2 on an RP2040 (an actual Raspberry Pi Pico...)