This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Minimal requirements for HID

Hi,

I've been trying to add the option for BLE HID to the Espruino JS interpreter on nRF52 - it's something that ideally would be switchable at runtime.

After having had something mostly working with SDK11, the removal of device_manager meant quite a lot changed and to avoid it getting even more messy than it currently is it's been worth starting again from scratch.

After just adding BLE HID, without a device/peer manager, Android refuses to find the device to pair.

What is the bare minimum that is needed to get a HID device working? For example, is the peer manager absolutely required? What about whitelisting? What about the battery service?

The hids_keyboard example is relatively complicated, and I'm wondering if that's all really needed.

thanks!

Parents
  • I think your guess is correct. You can try to only pair, and see if that changes anything. See this. Just reply with sd_ble_gap_sec_params_reply() when you get the BLE_GAP_EVT_SEC_PARAMS_REQUEST event.

  • That's awesome, thanks! It does seem it just wanted pairing. The code I added was:

          case BLE_GAP_EVT_SEC_PARAMS_REQUEST:{
        ble_gap_sec_params_t sec_param;
        memset(&sec_param, 0, sizeof(ble_gap_sec_params_t));
        sec_param.bond         = 0; // nope
        sec_param.mitm         = 0; // nope
        sec_param.io_caps      = BLE_GAP_IO_CAPS_NONE;
        sec_param.oob          = 1; // Out Of Band data not available.
        sec_param.min_key_size = 7;
        sec_param.max_key_size = 16;
        err_code = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_SUCCESS, &sec_param, NULL);
        // or BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP to disable pairing
        APP_ERROR_CHECK(err_code);
      } break; // BLE_GAP_EVT_SEC_PARAMS_REQUEST
    
Reply
  • That's awesome, thanks! It does seem it just wanted pairing. The code I added was:

          case BLE_GAP_EVT_SEC_PARAMS_REQUEST:{
        ble_gap_sec_params_t sec_param;
        memset(&sec_param, 0, sizeof(ble_gap_sec_params_t));
        sec_param.bond         = 0; // nope
        sec_param.mitm         = 0; // nope
        sec_param.io_caps      = BLE_GAP_IO_CAPS_NONE;
        sec_param.oob          = 1; // Out Of Band data not available.
        sec_param.min_key_size = 7;
        sec_param.max_key_size = 16;
        err_code = sd_ble_gap_sec_params_reply(m_conn_handle, BLE_GAP_SEC_STATUS_SUCCESS, &sec_param, NULL);
        // or BLE_GAP_SEC_STATUS_PAIRING_NOT_SUPP to disable pairing
        APP_ERROR_CHECK(err_code);
      } break; // BLE_GAP_EVT_SEC_PARAMS_REQUEST
    
Children
No Data
Related