problem: USB HID report descriptor length - driving me nuts!
Posted: Thu Feb 25, 2010 10:21 pm
Hi,
I'm working on a usb game controller, based on the PS2USB v2 example project: http://vusb.wikidot.com/project:ps2usb. My coding and AVR skills are limited so I don't exactly know what I'm doing...
Anyway, first step is to modify the code to deal with only one controller - simple, just remove the 2nd pad setup and output functions, and remove half the USB HID report descriptor. Now this works, but only if I set USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH to 99 or more in usbconfig.h, despite the descriptor being only 63 long:
If I set the descriptor length to 98 or less, then the usb device does not appear in /dev/input (it appears as /dev/input/js0 when set to any value 99-126 - haven't tried larger than 126).
Am I missing something obvious? Can anyone help?! Thanks!
I'm working on a usb game controller, based on the PS2USB v2 example project: http://vusb.wikidot.com/project:ps2usb. My coding and AVR skills are limited so I don't exactly know what I'm doing...
Anyway, first step is to modify the code to deal with only one controller - simple, just remove the 2nd pad setup and output functions, and remove half the USB HID report descriptor. Now this works, but only if I set USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH to 99 or more in usbconfig.h, despite the descriptor being only 63 long:
Code: Select all
PROGMEM char usbHidReportDescriptor[USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH] = { /* USB report descriptor */
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (Joystick)
0xa1, 0x01, // COLLECTION (Application)
0x09, 0x01, // USAGE (Pointer)
0xa1, 0x00, // COLLECTION (Physical)
0x85, 0x01, // REPORT_ID (1)
0x09, 0x30, // USAGE (X)
0x09, 0x31, // USAGE (Y)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x0f, // LOGICAL_MAXIMUM (15)
0x75, 0x04, // REPORT_SIZE (4)
0x95, 0x02, // REPORT_COUNT (2)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x32, // USAGE (Z)
0x09, 0x33, // USAGE (Rx)
0x09, 0x34, // USAGE (Ry)
0x09, 0x35, // USAGE (Rz)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x04, // REPORT_COUNT (4)
0x81, 0x02, // INPUT (Data,Var,Abs)
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)
0xc0, // END_COLLECTION
0xc0, // END_COLLECTION
};
If I set the descriptor length to 98 or less, then the usb device does not appear in /dev/input (it appears as /dev/input/js0 when set to any value 99-126 - haven't tried larger than 126).
Am I missing something obvious? Can anyone help?! Thanks!