Page 1 of 1

hid report descriptor help

Posted: Wed Oct 14, 2009 3:00 am
by thelorax
Hello,
I'm trying to create a hid report descriptor for a joystick with an X and Y axis and around 4 buttons. I've searched the web and I haven't been able to find any concise reading on how to build up a report descriptor. I've tried HID Tool under windows, but it seems really buggy and crashes frequently. Is there any alternative?
If anybody has a good tutorial/hidtool replacement/joystick + button report descriptor I'd really appreciate it.

thanks.

Re: hid report descriptor help

Posted: Wed Oct 14, 2009 4:52 am
by ulao
Here is a generic 8 button x,y hid. I never have a single bit of trouble with it.

Code: Select all

const char generic_usbHidReportDescriptor[] PROGMEM = {
    0x05, 0x01,                    // USAGE_PAGE (Generic Desktop)
    0x09, 0x05,                    // USAGE (Game Pad)
    0xa1, 0x01,                    // COLLECTION (Application)
    0x09, 0x01,                    //   USAGE (Pointer)
    0xa1, 0x00,                    //   COLLECTION (Physical)
    0x09, 0x30,                    //     USAGE (X)
    0x09, 0x31,                    //     USAGE (Y)
    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
    0x26, 0xff, 0x00,              //     LOGICAL_MAXIMUM (255)
    0x75, 0x08,                    //   REPORT_SIZE (8)
    0x95, 0x02,                    //   REPORT_COUNT (2)
    0x81, 0x02,                    //   INPUT (Data,Var,Abs)
    0xc0,                          // END_COLLECTION
    0x05, 0x09,                    // USAGE_PAGE (Button)
    0x19, 0x01,                    //   USAGE_MINIMUM (Button 1)
    0x29, 0x08,                    //   USAGE_MAXIMUM (Button 8)
    0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
    0x25, 0x01,                    //   LOGICAL_MAXIMUM (1)
    0x75, 0x01,                    // REPORT_SIZE (1)
    0x95, 0x08,                    // REPORT_COUNT (8)
    0x81, 0x02,                    // INPUT (Data,Var,Abs)
    0xc0
};


Are you sure its the descriptor that is the trouble?