HID Gamepad Report Descriptor issue
Posted: Tue Dec 13, 2016 10:09 pm
I am working on a usbHidReportDescriptor and am having an issue with adding buttons to the report.
When I use this descriptor that I did not make (only stick axis, no buttons):
My device gets recognized just fine and works how I hope, minus the buttons. I created a custom report to add buttons, and this is what I have:
This is the only code change I'm making, even though the code is set to handle button inputs in the gamepad_report struct and method calling it. Does anyone see anything I'm doing wrong in the second iteration? I'm getting no compiler errors. Thank you very much for any help!
When I use this descriptor that I did not make (only stick axis, no buttons):
Code: Select all
PROGMEM const char usbHidReportDescriptor[36] = {
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x05, // USAGE (Game Pad)
0xa1, 0x01, // COLLECTION (Application)
0xa1, 0x00, // COLLECTION (Physical)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x09, 0x32, // USAGE (Z) rx
0x09, 0x35, // USAGE (Rx) ry
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x46, 0xff, 0x00, // PHYSICAL_MAXIMUM (255)
0x15, 0x00, // LOGICAL_MINIMUM (-127)
0x26, 0xff, 0x00, // 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
};
My device gets recognized just fine and works how I hope, minus the buttons. I created a custom report to add buttons, and this is what I have:
Code: Select all
PROGMEM const char usbHidReportDescriptor[46] = {
0x05, 0x01, //USAGE_PAGE (Generic Desktop)
0x09, 0x05, //USAGE (Game Pad)
0xa1, 0x01, //
0xa1, 0x00, // COLLECTION (Physical)
0x05, 0x09, //USAGE_PAGE (Button)
0x19, 0x01, //USAGE_MINIMUM (Button1)
0x29, 0x10, //USAGE_MAXIMUM (Button 16)
0x15, 0x00, //LOGICAL_MINIMUM (0)
0x25, 0x01, //LOGICAL_MAXIMUM(1)
0x95, 0x10, //REPORT_COUNT (16)
0x75, 0x01, //REPORT_SIZE (1)
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, 0x33, //USAGE (Rx)
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
This is the only code change I'm making, even though the code is set to handle button inputs in the gamepad_report struct and method calling it. Does anyone see anything I'm doing wrong in the second iteration? I'm getting no compiler errors. Thank you very much for any help!