Any Hid descriptor gurus here?

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey!

 

I'm trying to wrap my head over Hid descriptor's in this particular case i have implemented Hid over Gatt profile which is correctly interpreted as "Input device" by my android devices so that part should be fine.

 

theres something i have pulled together from multiple sources and USB-HID documentation, sadly Android seems to read it completely differently than what i expect, most of the strokes i send will alter the volume of my devices.

 

i do send two byte reports ie. 0x02, 0x01 for Play/Pause, which works as expected, rest of the commands not so much as they might do what is expected or not, but at the same time alter the volume aswell.

0x05, 0x0C,        // Usage Page (Consumer)
0x09, 0x01,        // Usage (Consumer Control)
0xA1, 0x01,        // Collection (Application)
0x85, 0x02,        //   Report ID (2)
0x15, 0x00,        //   Logical Minimum (0)
0x25, 0x01,        //   Logical Maximum (1)
0x75, 0x01,        //   Report Size (1)
0x95, 0x01,        //   Report Count (1)
0x09, 0xCD,        //   Usage (Play/Pause)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xE2,        //   Usage (Mute)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xB5,        //   Usage (Scan Next Track)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xB6,        //   Usage (Scan Previous Track)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xEA,        //   Usage (Volume Decrement)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xE9,        //   Usage (Volume Increment)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xB3,        //   Usage (Fast Forward)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0x09, 0xB4,        //   Usage (Rewind)
0x81, 0x02,        //   Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position)
0xC0

Maybe someone here can tell what i'm doing wrong. 

 

 

EDIT::

this map is working one, but missing rewind and fast forward which i need (shamelessly copied from silabs examples for my BLE112 module)

// CONSUMER PAGE

    /****/ 0x05, 0x0c, /* USAGE_PAGE (Consumer) */
    /****/ 0x09, 0x01, /* USAGE (Consumer Control) */
    /****/ 0xa1, 0x01, /* COLLECTION (Application) */
    /******/ 0x85, 0x02, /* Report ID 2 */
    /******/ 0x05, 0x0c, /* USAGE_PAGE (Consumer) */
    /* 8 media player related keys */
    /******/ 0x15, 0x00, /* Logical Min 0 */
    /******/ 0x25, 0x01, /* Logical Max 1 */
    /******/ 0x09, 0xe9, /* Usage (8-bit), Volume Increment */
    /******/ 0x09, 0xea, /* Usage (8-bit), Volume Decrement */
    /******/ 0x09, 0xe2, /* Usage (8-bit), Mute */
    /******/ 0x09, 0xcd, /* Usage (8-bit), Play/Pause */
    /******/ 0x19, 0xb5, /* Usage Min (Scan Next Track, Scan Previous Track, Stop, Eject) */
    /******/ 0x29, 0xb8, /* Usage Max */
    /******/ 0x75, 0x01, /* Report Size */
    /******/ 0x95, 0x08, /* Report Count */
    /******/ 0x81, 0x02, /* Input type 2 */
    /******/ 0xc0,      /* End Collection */

 

Last Edited: Sat. Oct 5, 2019 - 01:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Since the example descriptor is working, I would just tweak it to add FF & REW. Those are 0xB3 & 0xB4 which are consecutive to 0xB5-0xB8 (Next/Prev/Stop/Eject), you can add them to that range.

 

This:

    /******/ 0x19, 0xb5, /* Usage Min (Scan Next Track, Scan Previous Track, Stop, Eject) */
    /******/ 0x29, 0xb8, /* Usage Max */

Becomes:

    /******/ 0x19, 0xb3, /* Usage Min (Fast Forward, Rewind, Scan Next Track, Scan Previous Track, Stop, Eject) */
    /******/ 0x29, 0xb8, /* Usage Max */

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmmn, did not even think about that earlier thx!

Need to test it later and see if it indeed works.

What do you think since if I understand correctly, I have one bit values representing the "commands" as per the descriptor, should i also modify the 0x09, 0xB8 to 0x09, 0xB6 so that there is 8 commands defined only?(I don't need the eject and stop anyway)

 

Edit: I made the changes of the range from b5-b8 to b3-b6 which atleast Did not break the descriptor, everything still works and next/previous commands moved to 0x40/0x80 as I expected. Can't still figure out how the rewind/fast forward should be addressed, do I need to continuously send those or leave the value to the gatt charasterics and clear it once done.

Last Edited: Mon. Oct 7, 2019 - 02:11 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Some hours later, I must say i can't get the rewind and fastword to work, I think I figured the descriptor thing somewhat now and successfully tested all the other playback related commands per Google's hid documentation, which all works just fine. Maybe it's just Android not taking the rewind/fastforward commands, or the media players just won't act based on those.(I suspect the later one)