Jump to content

How to use USB HID Feature report?


Recommended Posts

I'm building a HID device (Joystick) that uses Rx, Ry, Rz and in some point I need to do a calibration on the device side. I need to send data from PC(Host) to the device and back for this calibration purpose using custom PC client software and I'm willing to use FEATURE report, which I think is suitable for this purpose. 

My INPUT report handling the Rx, Ry, Rz axes works with no problem. I'm sending 3 16-bit (total of 6 bytes) values into the device and it works perfectly.

But I'm having trouble with the FEATURE report, I searched like half the internet already but couldn't manage to get the FEATURE reports to work. I'm using HIDAPITESTER command line tool for the testing purposes. I need to send data from-to host when I need to. As to my information, FEATURE reports are right for this purpose, they are controlled from the host side and are bidirectional. The data contained will be always the same - 64-bytes of data (I actually need only 38 bytes).

I really think that the only problem is with my report descriptor, could you advise on what I'm doing wrong?

0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
0x09, 0x04, // Usage (Joystick)
0xA1, 0x01, // Collection (Application)
0x09, 0x33, // Usage (Rx)
0x09, 0x34, // Usage (Ry)
0x09, 0x35, // Usage (Rz)
0x15, 0x00, // Logical Minimum (0)
0x26, 0x00, 0x10, // Logical Maximum (4096)
0x75, 0x10, // Report Size (16)
0x95, 0x03, // Report Count (3)
0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0x00, // Usage (Undefined)
0x15, 0x00, // Logical Minimum (0)
0x26, 0x00, 0x10, // Logical Maximum (4096)
0x75, 0x10, // Report Size (16)
0x95, 0x20, // Report Count (32)
0xB1, 0x02, // Feature (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile)
0xC0, // End Collection

I have tried another report descriptors, but they always resulted in not being able to enumerate. 

The USB stack I'm using is M-Stack.

I'm using endpoints 0x81 for IN and 0x01 for OUT packets.

The device is PIC18F2458 but I don't think this has any thing to do with this issue really.

Thank you for any valuable help, I'm really desperate for past two days already.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...