1
\$\begingroup\$

I'm using a Dialog SmartBond DA14531 as a BLE HID Keyboard device. It works on Windows but not on iOS. Although it pairs successfully, the HID key events do nothing. Does anyone have any experience implementing BLE HID keyboard functionality that works on iOS? Are there are gotchas I'm missing? The HID key messages are definitely being sent and acknowledged but then iOS ignores them.

The descriptor I'm using looks like this:


    0x05, 0x01,          // Usage Page: Generic Desktop Controls
    0x09, 0x06,          // Usage: Keyboard
    0xA1, 0x01,          // Collection: Application
    0x05, 0x07,          // Usage Page: Keyboard
    0x19, 0xE0,          // Usage Minimum: Keyboard LeftControl
    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 (2)
    0x95, 0x01,          // Report Count: 1
    0x75, 0x08,          // Report Size: 8
    0x81, 0x01,          // Input: Constant (1)
    0x95, 0x03,          // Report Count: 3
    0x75, 0x01,          // Report Size: 1
    0x05, 0x08,          // Usage Page: LEDs
    0x19, 0x01,          // Usage Minimum: Num Lock
    0x29, 0x03,          // Usage Maximum: Scroll Lock
    0x91, 0x02,          // Output: Data (2)
    0x95, 0x05,          // Report Count: 5
    0x75, 0x01,          // Report Size: 1
    0x91, 0x01,          // Output: Constant (1)
    0x95, 0x06,          // Report Count: 6
    0x75, 0x08,          // Report Size: 8
    0x15, 0x00,          // Logical Minimum: 0
    0x26, 0xFF, 0x00,    // Logical Maximum: 255
    0x05, 0x07,          // Usage Page: Keyboard/Keypad
    0x19, 0x00,          // Usage Minimum: 0
    0x2A, 0xFF, 0x00,    // Usage Maximum: 255
    0x81, 0x00,          // Input: Data (0)
    0xC0                 // End collection
};
\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

For anyone else facing this, it seems you need to include a non-zero Report ID in the descriptor. Adding this makes it work on iOS.

For example, adding 0x85, 0x01 as follows:

    ...
    0xA1, 0x01,          // Collection: Application
    0x85, 0x01,          // Report ID 1
    0x05, 0x07,          // Usage Page: Keyboard
    ...

Whole report:

// Report: Standard keyboard

0x05, 0x01,                     // Usage Page: Generic Desktop Controls
0x09, 0x06,                     // Usage: Keyboard
0xa1, 0x01,                     // Collection: Application
0x85, 0x01,                     // Report ID=1

// modifier keys
0x05, 0x07,                     // Usage Page: Keyboard
0x19, 0xe0,                     // Usage Minimum: Keyboard LeftControl
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, Array, Absolute

// reserved byte (required)
0x95, 0x01,                     // Report Count: 1
0x75, 0x08,                     // Report Size: 8
0x81, 0x01,                     // Input: Constant, Array, Absolute

// leds x 3
0x95, 0x03,                     // Report Count: 3
0x75, 0x01,                     // Report Size: 1
0x05, 0x08,                     // Usage Page: LEDs
0x19, 0x01,                     // Usage Minimum: Num Lock
0x29, 0x03,                     // Usage Maximum: Scroll Lock
0x91, 0x02,                     // Output: Data, Array, Absolute

// pad bits x 5
0x95, 0x05,                     // Report Count: 5
0x75, 0x01,                     // Report Size: 1
0x91, 0x01,                     // Output: Constant, Array, Absolute

// key states x 2
0x95, 0x02,                     // Report Count: # of key rollover
0x75, 0x08,                     // Report Size: 8
0x15, 0x00,                     // Logical Minimum: 0
0x25, 0x65,                     // Logical Maximum: 101
0x05, 0x07,                     // Usage Page: Keyboard/Keypad
0x19, 0x00,                     // Usage Minimum: 0
0x29, 0x65,                     // Usage Maximum: 101
0x81, 0x00,                     // Input: Data, Var, Absolute

0xc0,                           // End collection
\$\endgroup\$
3
  • 2
    \$\begingroup\$ what did you do to resolve the problem? ... please edit your answer to include the information \$\endgroup\$
    – jsotola
    Commented Jan 25, 2023 at 0:53
  • \$\begingroup\$ It does not work for me even with non-zero report ID. HID keybord working on Android, but not on iOS (iphone). It pairs, but does not work. What app are you using to confirm that your keyboard is working on iOS? \$\endgroup\$
    – Stu Zender
    Commented Nov 29, 2023 at 20:38
  • \$\begingroup\$ I found it worked with any app - I've added the whole HID report, hope that helps, good luck! \$\endgroup\$ Commented Nov 29, 2023 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.