HID on usb audio

If you have a simple question and just want an answer.
Post Reply
luxemburg
New User
Posts: 3
Joined: Mon Jul 25, 2016 2:02 pm

HID on usb audio

Post by luxemburg »

I want to achieve a hid function on an usb audio platform while the usb audio can be working.
There are 5 buttons and 2leds on the board.
Now the device can send message to the host,and the host can recieve it.And i have already added the interrupt out endpoint on endpoint 2.
How should i change the hidReportDescriptor[] now?


luxemburg
New User
Posts: 3
Joined: Mon Jul 25, 2016 2:02 pm

Post by luxemburg »

0x05, 0x0c, /* Usage Page (Consumer Device) */
0x09, 0x01, /* Usage (Consumer Control) */
0xa1, 0x01, /* Collection (Application) */
0x19, 0x01,
0x29, 0x06,
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, 0x01, /* Input (Cnst, Ary, Abs) */
0x75, 0x01, /* report size 1 */
0x95, 0x02, /* report count 2 */
0x19, 0x48, /* usage min red */
0x29, 0x49, /* usage max green */
0x91, 0x02, /* output data ary abs */
0x75, 0x06, /* report size 6 */
0x95, 0x01, /* report count 1 */
0x91, 0x03, /* output const ary abs */
0xc0
luxemburg
New User
Posts: 3
Joined: Mon Jul 25, 2016 2:02 pm

Post by luxemburg »

hidReportDescriptor[]
there is nothing wrong in device to host ,but the host to device still can`t receive the data
User avatar
johned
XCore Addict
Posts: 185
Joined: Tue Mar 26, 2013 12:10 pm
Contact:

Post by johned »

Hi
Have you checked out the HID applications note :
https://www.xmos.com/support/appnotes?s ... 20examples

Best regards,
John
User avatar
Ross
XCore Expert
Posts: 966
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Here is an example modification for output report:

Code: Select all

#ifdef HID_CONTROLS
unsigned char hidReportDescriptor[] =
{
    0x05, 0x0c,     /* Usage Page (Consumer Device) */
    0x09, 0x01,     /* Usage (Consumer Control) */
    0xa1, 0x01,     /* Collection (Application) */
    0x15, 0x00,     /* Logical Minimum (0) */
    0x25, 0x01,     /* Logical Maximum (1) */
    0x85, 0x01,     /* Report ID (1) */
    0x09, 0xb0,     /* Usage (Play) */
    0x09, 0xb5,     /* Usage (Scan Next Track) */
    0x09, 0xb6,     /* Usage (Scan Previous Track) */
    0x09, 0xe9,     /* Usage (Volume Up) */
    0x09, 0xea,     /* Usage (Volume Down) */
    0x09, 0xe2,     /* Usage (Mute) */
    0x75, 0x01,     /* Report Size (1) */
    0x95, 0x06,     /* Report Count (6) */
    0x81, 0x02,     /* INPUT (Data, Var, Abs) */
    0x95, 0x02,     /* Report Count (2) - Pad out to a byte */
    0x81, 0x01,     /* INPUT (Cnst, Ary, Abs) */
    0x15, 0x00,     /* Logical Minimum (0) */
    0x26, 0xFF,     /* Logical Maximum (0xFF) */
    0x00,
    0x85, 0x02,     /* Report ID (2) */
    0x0A, 0x03,     /* Usage (Light Illumination Level) */
    0x01,
    0x75, 0x08,     /* Report Size (8) */
    0x95, 0x01,     /* Report Count (1) */
    0x91, 0x02,     /* OUTPUT (Data,Var,Abs) */
    0xc0            /* End collection */
};
#endif
User avatar
Ross
XCore Expert
Posts: 966
Joined: Thu Dec 10, 2009 9:20 pm
Location: Bristol, UK

Post by Ross »

Double check you have the EP type setup correctly for the hid endpoint in the table
Post Reply