How to enable Just Works pairing in peripheral_hids_mouse (NCS v3.0.2)?

Hi,
I'm using the peripheral_hids_mouse example from NCS v3.0.2.
What's the correct way from SC(Secure Connections) to enable Just Works pairing?
Thanks!
Parents
  • Hi,

    "Just Works" is one of the key generation methods in BLE pairing. What key generation method is used, depend on the IO capabilities of the devices. Therefore, the best way to ensure the Just Works method, is to ensure the local device is "NoInput NoOutput".

    In main.c of the Peripheral HIDS Mouse sample, you should find, close to line 654 or so:

    static struct bt_conn_auth_cb conn_auth_callbacks = {
    	.passkey_display = auth_passkey_display,
    	.passkey_confirm = auth_passkey_confirm,
    	.cancel = auth_cancel,
    };

    This bt_conn_auth_cb structure contains callbacks for use of the input and output capabilities of your device. Some of those callbacks can be set to NULL, for signalling that the device does not have those capabilities. Hence, in order to force both NoInput and NoOutput for your device, you can configure it like this:

    static struct bt_conn_auth_cb conn_auth_callbacks = {
    	.passkey_display = NULL,
    	.passkey_entry = NULL,
    	.passkey_confirm = NULL,
    	.cancel = auth_cancel,
    };

    With that configuration, Just Works would be the only possible key generation method for paring with your device.

    Please note that with Just Works, the key will be unauthenticated, which may have implications for what functionality from Bluetooth profiles can be used or not during the connection.

    Regards,
    Terje

  • Thanks again for your quick and clear guidance!

    One more question: for debugging purposes I’d like to **disable Secure Connections completely** 
    This makes it possible to follow the packets with a plain BLE-sniffer that does not support SC.

    Could you point out the minimal Kconfig / code changes that **force Legacy pairing only** (no SC at all) in the *peripheral_hids_mouse* sample?

    Thank you very much!
    Ozzy

Reply
  • Thanks again for your quick and clear guidance!

    One more question: for debugging purposes I’d like to **disable Secure Connections completely** 
    This makes it possible to follow the packets with a plain BLE-sniffer that does not support SC.

    Could you point out the minimal Kconfig / code changes that **force Legacy pairing only** (no SC at all) in the *peripheral_hids_mouse* sample?

    Thank you very much!
    Ozzy

Children
Related