Author Topic: HID descriptor / report for multiple page device  (Read 11605 times)

mincher

  • Member
  • ***
  • Posts: 2
HID descriptor / report for multiple page device
« on: October 06, 2012, 12:35:39 am »
Hope this isn't too simple of a question, but I'm trying to create a HID device that needs to emit keys from the keyboard (0x10) page, consumer device (0x0c) page, as well as battery ok/low indications from the LED (0x08) page.  There are probably 5-10 keys from each of the 0x10 and 0x0c pages that I need.

What does this descriptor look like?   And do I need to send separate reports for each page?  Or can a report contain data from multiple pages?

This is actually a bluetooth HID device (call it a remote control).  This is my first real encounter with USB and BT.

Thanks,
D i c k




Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: HID descriptor / report for multiple page device
« Reply #1 on: October 06, 2012, 12:30:11 pm »
The HID Usage Pages document has a remote control example, section A.9.

http://www.usb.org/developers/hidpage/

A single report can have multiple Usage Pages.

mincher

  • Member
  • ***
  • Posts: 2
Re: HID descriptor / report for multiple page device
« Reply #2 on: October 08, 2012, 05:17:23 pm »
Hi Jan,

Thanks for the reply.  Is this close?

I'm thinking that when the "Sleep Mode" key is down, the first bit is set (else cleared).  The mute key is down, the second bit is set and so forth.   Left arrow key down and 3rd bit is set.  The 18th bit would be set if there is a low battery indication; clear if no low battery indication.


COLLECTION (Application)   A1 01
  USAGE_PAGE (Consumer Devices)   05 0C
  LOGICAL_MINIMUM (0)   15 00
  LOGICAL_MAXIMUM (1)   25 01
  USAGE (Sleep Mode)   09 34
  USAGE (Mute)   09 E2
  USAGE_PAGE (Keyboard)   05 07
  USAGE (Keyboard LeftArrow)   09 50
  USAGE_PAGE (Consumer Devices)   05 0C
  USAGE (Rewind)   09 B4
  USAGE (Consumer Devices:Volume Up)   0B E9 00 0C 00
  USAGE_PAGE (Keyboard)   05 07
  USAGE (Keyboard Alternate Erase)   09 99
  USAGE (Keypad ENTER)   09 58
  USAGE_PAGE (Consumer Devices)   05 0C
  USAGE (Consumer Devices:Pause)   0B B1 00 0C 00
  USAGE (Media Select TV)   09 89
  USAGE_PAGE (Keyboard)   05 07
  USAGE (Keyboard:Keyboard UpArrow)   0B 52 00 07 00
  USAGE (Keyboard RightArrow)   09 4F
  USAGE_PAGE (Consumer Devices)   05 0C
  USAGE (Consumer Devices:Fast Forward)   0B B3 00 0C 00
  USAGE (Volume Down)   09 EA
  USAGE_PAGE (Keyboard)   05 07
  USAGE (Keyboard:Keyboard Home)   0B 4A 00 07 00
  USAGE (Keyboard DownArrow)   09 51
  USAGE_PAGE (Consumer Devices)   05 0C
  USAGE (Consumer Devices:Menu)   0B 40 00 0C 00
  USAGE (Search Mark Forward)   09 C6
  USAGE_PAGE (LEDs)   05 08
  USAGE (LEDs:Battery Low)   0B 1D 00 08 00
  REPORT_COUNT (18)   95 12
  REPORT_SIZE (1)   75 01
  INPUT (Data,Var,Abs)   81 02
END_COLLECTION   C0


Thanks very much,
D i c k

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: HID descriptor / report for multiple page device
« Reply #3 on: October 08, 2012, 10:15:29 pm »
When you declare a new Usage Page, you may need to redeclare Logical Minimum and Logical Maximum, not sure offhand. No harm in doing so at any rate.

Add pad bits at the end to make the report a multiple of 8 bits.

Maybe someone else will see other things. Otherwise, try it out and see what happens.