]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/commit
MFC r281116.
authorrakuco <rakuco@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 15 Apr 2015 22:15:23 +0000 (22:15 +0000)
committerrakuco <rakuco@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Wed, 15 Apr 2015 22:15:23 +0000 (22:15 +0000)
commitc1ce5041e157ead7dde10859d9c4760cfc76a416
tree75a07465e6bc6970dcb5a811719c66f28270d1f4
parentf131feeb4d3e5533e3e2df9c1da2051b35d40121
MFC r281116.

bthidd: Consider usage ranges when dealing with array inputs.

So far, we were always using HID_USAGE() to determine the Usage ID of a
certain HID report input item. This does not work as intended if a field
is an array and the allowed usages are specified with a usage range, as
HID_USAGE() will return 0. We need to use the field value as an index in
the usage range list in this case instead.

This makes the volume keys in a Microsoft Bluetooth Mobile Keyboard
5000 be properly recognized. The relevant part of the HID report looks
like this:

  0xA1, 0x01,        // Collection (Application)
  0x85, 0x07,        //   Report ID (7)
  0x05, 0x0C,        //   Usage Page (Consumer)
  0x19, 0x00,        //   Usage Minimum (Unassigned)
  0x2A, 0xFF, 0x03,  //   Usage Maximum (0x03FF)
  0x95, 0x01,        //   Report Count (1)
  0x75, 0x10,        //   Report Size (16)
  0x15, 0x00,        //   Logical Minimum (0)
  0x27, 0xFF, 0x03, 0x00, 0x00,  //   Logical Maximum (1023)
  0x81, 0x00,        //   Input (Data,Array,Abs,No Wrap,Linear,Preferred
                     //   State,No Null Position)

When a key such as "volume down" is pressed, the following data is
transferred through Interrupt In:

  0x07 0xEA 0x00

Differential Revision: https://reviews.freebsd.org/D2229
Reviewed by: emax
Approved by: emax

git-svn-id: svn://svn.freebsd.org/base/stable/9@281568 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
usr.sbin/bluetooth/bthidd/hid.c