import usb_hid # This is only one example of a gamepad descriptor, and may not suit your needs. 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) #0x16, 0x01, 0x80, # Logical Minimum (0) #0x26, 0xff, 0x7f, # Logical Maximum (32767) 0x15, 0x00, # Logical Minimum (0) 0x27, 0xff, 0xff, 0x00, 0x00, # Logical Maximum (65535) 0x35, 0x00, # Physical Minimum (0) 0x47, 0xff, 0xff, 0x00, 0x00, # Physical Maximum (65535) 0x09, 0x30, # Usage (X) 0x09, 0x31, # Usage (Y) 0x09, 0x32, # Usage (Z) 0x09, 0x35, # Usage (Rz) 0x75, 0x10, # Report Size (16) 0x95, 0x04, # Report Count (4) 0x81, 0x02, # Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) 0xC0, # End Collection )) gamepad = usb_hid.Device( report_descriptor=GAMEPAD_REPORT_DESCRIPTOR, usage_page=0x01, # Generic Desktop Control usage=0x05, # Gamepad report_ids=(4,), # Descriptor uses report ID 4. in_report_lengths=(10,), # This gamepad sends 10 bytes in its report. out_report_lengths=(0,), # It does not receive any reports. ) usb_hid.enable( (gamepad,) )