Hi Alex,

Yes, I have hidapi, but it does not include a HID report parser.

It's easy to use hidapi for a device like the funcube because you know the format of the data that it sends. Making a HID interface work with controllers you've never seen before is more difficult.

The HID report is an arbitrary structure which fits in maximum 64 bytes. Your button presses and joystick values, etc., are at entirely arbitrary locations in there. Where the switch bits that I am looking for are is up to the implementor. To pick the bits out in a /generic /fashion rather than a device-specific one, you have to parse the HID descriptors. These are data structures the developer wrote into ROM (meaning that the device doesn't understand them, it just sends them to the driver). They tell the driver in a generic way what the data is and where it is. Below is an example. The tutorial at http://eleccelerator.com/tutorial-about-usb-hid-report-descriptors/ tells you how to parse it. There is also some difficult-to-wade-through documentation at the USB organization site.

There doesn't seem to be a good portable parser for these. If I have to, I'll write one and dual-license it.

    Thanks

    Bruce

0x05, 0x01,        // Usage Page (Generic Desktop Ctrls)
0x09, 0x04,        // Usage (Joystick)
0xA1, 0x01,        // Collection (Physical)
0xA1, 0x02,        //   Collection (Application)
0x85, 0x01,        //     Report ID (1)
0x75, 0x08,        //     Report Size (8)
0x95, 0x01,        //     Report Count (1)
0x15, 0x00,        //     Logical Minimum (0)
0x26, 0xFF, 0x00,  //     Logical Maximum (255)
0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x75, 0x01,        //     Report Size (1)
0x95, 0x13,        //     Report Count (19)
0x15, 0x00,        //     Logical Minimum (0)
0x25, 0x01,        //     Logical Maximum (1)
0x35, 0x00,        //     Physical Minimum (0)
0x45, 0x01,        //     Physical Maximum (1)
0x05, 0x09,        //     Usage Page (Button)
0x19, 0x01,        //     Usage Minimum (0x01)
0x29, 0x13,        //     Usage Maximum (0x13)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x75, 0x01,        //     Report Size (1)
0x95, 0x0D,        //     Report Count (13)
0x06, 0x00, 0xFF,  //     Usage Page (Vendor Defined 0xFF00)
0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x15, 0x00,        //     Logical Minimum (0)
0x26, 0xFF, 0x00,  //     Logical Maximum (255)
0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)
0x09, 0x01,        //     Usage (Pointer)
0xA1, 0x00,        //     Collection (Undefined)
0x75, 0x08,        //       Report Size (8)
0x95, 0x04,        //       Report Count (4)
0x35, 0x00,        //       Physical Minimum (0)
0x46, 0xFF, 0x00,  //       Physical Maximum (255)
0x09, 0x30,        //       Usage (X)
0x09, 0x31,        //       Usage (Y)
0x09, 0x32,        //       Usage (Z)
0x09, 0x35,        //       Usage (Rz)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0,              //     End Collection
0x05, 0x01,        //     Usage Page (Generic Desktop Ctrls)
0x75, 0x08,        //     Report Size (8)
0x95, 0x27,        //     Report Count (39)
0x09, 0x01,        //     Usage (Pointer)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x75, 0x08,        //     Report Size (8)
0x95, 0x30,        //     Report Count (48)
0x09, 0x01,        //     Usage (Pointer)
0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0x75, 0x08,        //     Report Size (8)
0x95, 0x30,        //     Report Count (48)
0x09, 0x01,        //     Usage (Pointer)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              //   End Collection
0xA1, 0x02,        //   Collection (Application)
0x85, 0x02,        //     Report ID (2)
0x75, 0x08,        //     Report Size (8)
0x95, 0x30,        //     Report Count (48)
0x09, 0x01,        //     Usage (Pointer)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              //   End Collection
0xA1, 0x02,        //   Collection (Application)
0x85, 0xEE,        //     Report ID (238)
0x75, 0x08,        //     Report Size (8)
0x95, 0x30,        //     Report Count (48)
0x09, 0x01,        //     Usage (Pointer)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              //   End Collection
0xA1, 0x02,        //   Collection (Application)
0x85, 0xEF,        //     Report ID (239)
0x75, 0x08,        //     Report Size (8)
0x95, 0x30,        //     Report Count (48)
0x09, 0x01,        //     Usage (Pointer)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0,              //   End Collection
0xC0,              // End Collection

// 148 bytes

On 03/22/2014 02:28 AM, Alexandru Csete wrote:
Hi Bruce, I'm not sure this is what you are looking for but for the Funcube Dongle driver we used the hidapi package to handle all HID specific transactions

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Freetel-codec2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freetel-codec2

Reply via email to