Bluetooth Human Interface Device (bthid.h)

Functions to implement the Bluetooth Human Interface Device (HID) Profile in the device role.

This module allows an application to behave as a HID device to control a remote HID Host, such as a PC. The HID descriptor is fixed and cannot be changed. Currently three types of HID reports are included: mouse, keyboard and enhanced keyboard controls.

The details of the descriptor are as follows:

       Mouse Descriptor

       0x05, 0x01,              USAGE_PAGE (Generic Desktop)
       0x09, 0x02,              USAGE (Mouse)
       0xa1, 0x01,              COLLECTION (Application)
       0x85, 0x02,                  REPORT ID (Mouse)
       0xa1, 0x02,                  COLLECTION (Logical)
       0x09, 0x01,                      USAGE (Pointer)
       0xa1, 0x00,                      COLLECTION (Physical)
       0x05, 0x09,                          USAGE_PAGE (Button)
       0x19, 0x01,                          USAGE_MINIMUM (Button 1)
       0x29, 0x03,                          USAGE_MAXIMUM (Button 3)
       0x15, 0x00,                          LOGICAL_MINIMUM (0)
       0x25, 0x01,                          LOGICAL_MAXIMUM (1)
       0x95, 0x03,                          REPORT_COUNT (3)
       0x75, 0x01,                          REPORT_SIZE (1)
       0x81, 0x02,                          INPUT (Data,Var,Abs)
       0x95, 0x01,                          REPORT_COUNT (1)
       0x75, 0x05,                          REPORT_SIZE (5)
       0x81, 0x03,                          INPUT (Cnst,Var,Abs)
       0x05, 0x01,                          USAGE_PAGE (Generic Desktop)
       0x09, 0x30,                          USAGE (X)
       0x09, 0x31,                          USAGE (Y)
       0x15, 0x81,                          LOGICAL_MINIMUM (-127)
       0x25, 0x7f,                          LOGICAL_MAXIMUM (127)
       0x75, 0x08,                          REPORT_SIZE (8)
       0x95, 0x02,                          REPORT_COUNT (2)
       0x81, 0x06,                          INPUT (Data,Var,Rel)
       0x05, 0x01,                          Usage Page (Generic Desktop)
       0x09, 0x38,                          Usage (Wheel)
       0x15, 0x81,                          Logical Minimum (-127)
       0x25, 0x7F,                          Logical Minimum (127)
       0x75, 0x08,                          Report Size (8)
       0x95, 0x01,                          Report Count (1)
       0x81, 0x06,                          INPUT (Data,Var,Rel)
       0x05, 0x0c,                          USAGE_PAGE (Consumer Devices)
       0x0a, 0x38, 0x02,                    USAGE (AC Pan)
       0x15, 0x81,                          LOGICAL_MINIMUM (-127)
       0x25, 0x7f,                          LOGICAL_MAXIMUM (127)
       0x75, 0x08,                          Report Size (8)
       0x95, 0x01,                          Report Count (1)
       0x81, 0x06,                          INPUT (Data,Var,Rel)
       0xc0,                            END_COLLECTION
       0xc0,                        END_COLLECTION
       0xc0,                    END_COLLECTION

       Keyboard Descriptor

       0x05, 0x01,              USAGE_PAGE (Generic Desktop)
       0x09, 0x06,              USAGE (Keyboard)
       0xa1, 0x01,              COLLECTION (Application)
       0x85, 0x01,                  REPORT ID (Keyboard)
       0x05, 0x07,                  USAGE_PAGE (Keyboard)
       0x19, 0xe0,                  USAGE_MINIMUM (Keyboard Left Control)
       0x29, 0xe7,                  USAGE_MAXIMUM (Keyboard Right GUI)
       0x15, 0x00,                  LOGICAL_MINIMUM (0)
       0x25, 0x01,                  LOGICAL_MAXIMUM (1)
       0x75, 0x01,                  Report Size (1)
       0x95, 0x08,                  Report Count (8)
       0x81, 0x02,                  Input (Data, Var, Abs)
       0x95, 0x01,                  Report Count (1)
       0x75, 0x08,                  Report Size (8)
       0x81, 0x03,                  Input (Cnst, Var, Abs)
       0x95, 0x05,                  Report Count (5)
       0x75, 0x01,                  Report Size  (1)
       0x05, 0x08,                  USAGE_PAGE (LEDs)
       0x19, 0x01,                  USAGE_MINIMUM (NumLock)
       0x29, 0x05,                  USAGE_MAXIMUM (Kana)
       0x91, 0x02,                  Output (Data, Var, Abs)
       0x95, 0x01,                  Report Count (1)
       0x75, 0x03,                  Report Size  (3)
       0x91, 0x03,                  Output (Cnst, Var, Abs)
       0x95, 0x06,                  Report Count (6)
       0x75, 0x08,                  Report Size  (8)
       0x15, 0x00,                  LOGICAL_MINIMUM (0)
       0x25, 0x65,                  LOGICAL_MAXIMUM (101)
       0x05, 0x07,                  USAGE PAGE (KEYBOARD)
       0x19, 0x00,                  USAGE_MINIMUM (Reserved (no event indicated))
       0x29, 0x65,                  USAGE_MAXIMUM (Keybaord Application)
       0x81, 0x00,                  Input (Data, Ary, Abs)
       0xc0,                    END_COLLECTION

       Enhanced Keys Descriptor

       0x05, 0x0c,              USAGE_PAGE (Consumer)
       0x09, 0x01,              USAGE (Consumer Control)
       0xa1, 0x01,              COLLECTION (Application)
       0x85, 0x03,                  REPORT ID (Enhanced Keys)
       0x09, 0xE2,                  USAGE (Mute)
       0x15, 0x00,                  LOGICAL_MINIMUM (0)
       0x25, 0x01,                  LOGICAL_MAXIMUM (1)
       0x75, 0x01,                  REPORT_SIZE (1)
       0x95, 0x01,                  REPORT_COUNT (1)
       0x81, 0x06,                  INPUT (Data,Var,Rel)
       0x09, 0xE9,                  USAGE (Volume Up)
       0x09, 0xEA,                  USAGE (Volume Down)
       0x09, 0xCD,                  USAGE (Play/Pause)
       0x09, 0xB7,                  USAGE (Stop)
       0x09, 0xB5,                  USAGE (Scan Next Track)
       0x09, 0xB6,                  USAGE (Scan Previous Track)
       0x09, 0xB4,                  USAGE (Rewind)
       0x09, 0xB3,                  USAGE (Fast Forward)
       0x15, 0x00,                  LOGICAL_MINIMUM (0)
       0x25, 0x01,                  LOGICAL_MAXIMUM (1)
       0x75, 0x01,                  REPORT_SIZE (1)
       0x95, 0x08,                  REPORT_COUNT (8)
       0x81, 0x02,                  Input (Data, Var, Abs)
       0x75, 0x01,                  REPORT_SIZE (1)
       0x95, 0x07,                  REPORT_COUNT (7)
       0x81, 0x03,                  INPUT (Cnst,Var,Abs)
       0xc0                     END_COLLECTION

Last modified: 2013-12-21

comments powered by Disqus