AOA Forums

AOA Forums (
-   Hardware Hacking (
-   -   Building HID descriptors (

Aedan 29th October, 2008 05:22 PM

Building HID descriptors
Wasn't sure where I should put this one... ;)

Has anyone ever tried building descriptors for HID devices? In this case, I'm looking to build a descriptor for a gamepad type device, and I'm going nowhere fast.

Gizmo 29th October, 2008 06:58 PM

Haven't done that. I rather thought it was a relatively simple process, from what little I've read.

Aedan 30th October, 2008 09:23 AM

I've been trying to get my head around it - for some reason the concepts seem simple, but putting them into practice hasn't been. I know that Windows is a bit picky about the descriptors, but even modifying existing examples haven't got me very far!

Aedan 30th October, 2008 09:26 AM

For example, if I use this the following example (I forget where I found it sadly), then all is sweet.


//Six button gamepad (length 47)
  {0x05,0x01,  // Usage Page (Generic Desktop)       
        0x09,0x05,        // Usage (Gamepad)                                       
    0xa1,0x01,  // 2 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, // LOGICAL_MAXIMUM (255)
        0x00, 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, 0x06, // USAGE_MAXIMUM (Button 6)
        0x15, 0x00, // LOGICAL_MINIMUM (0)
        0x25, 0x01, // LOGICAL_MAXIMUM (1)
        0x75, 0x01, // REPORT_SIZE (1)
        0x95, 0x06, // REPORT_COUNT (6)
        0x81, 0x02, // INPUT (Data,Var,Abs)
        0x95, 0x02, // REPORT_COUNT (2)
        0x81, 0x03, // INPUT (Constant,Var,Abs)
        0xc0 }    // END_COLLECTION

If I attempt to tweek it (for example, 7 buttons rather than 6) then things break. For example, adjusting the usage page for buttons like this:


        0x19, 0x01, // USAGE_MINIMUM (Button 1)
        0x29, 0x07, // USAGE_MAXIMUM (Button 7)
        0x15, 0x00, // LOGICAL_MINIMUM (0)
        0x25, 0x01, // LOGICAL_MAXIMUM (1)
        0x75, 0x01, // REPORT_SIZE (1)
        0x95, 0x07, // REPORT_COUNT (7)

results in a device that windows claims it can't enumerate properly.

Am I just a bit thick, or am I missing something fundamental?

All times are GMT +1. The time now is 04:47 PM.

Copyright ©2001 - 2010, AOA Forums

Search Engine Friendly URLs by vBSEO 3.3.0