disable Passkey for HID keyboard

Good Morning,

I would like disable passkey in the example "peripherals_hids_keyboard". I am able to connect with differents hosts (2 smarts and i computer) but I'm having trouble finding it in the Kconfig how to disable passkey ?

I suppressed "CONFIG_BT_HIDS_DEFAULT_PERM_RW_ENCRYPT=y" but my smartphone always ask me PIN code?

below my prj.conf:

#
# Copyright (c) 2019 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
CONFIG_NCS_SAMPLES_DEFAULTS=y

CONFIG_BT=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_MAX_CONN=3
CONFIG_BT_MAX_PAIRED=3
CONFIG_BT_L2CAP_TX_BUF_COUNT=5
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="Nordic_HIDS_keyboard"
CONFIG_BT_DEVICE_APPEARANCE=961

CONFIG_BT_BAS=y
CONFIG_BT_HIDS=y
CONFIG_BT_GATT_UUID16_POOL_SIZE=40
CONFIG_BT_GATT_CHRC_POOL_SIZE=20

CONFIG_BT_CONN_CTX=y

CONFIG_BT_DIS=y
CONFIG_BT_DIS_PNP=y
CONFIG_BT_DIS_MANUF="NordicSemiconductor"
CONFIG_BT_DIS_PNP_VID_SRC=2
CONFIG_BT_DIS_PNP_VID=0x1915
CONFIG_BT_DIS_PNP_PID=0xEEEF
CONFIG_BT_DIS_PNP_VER=0x0100

CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y

CONFIG_DK_LIBRARY=y

CONFIG_BT_HIDS_MAX_CLIENT_COUNT=3
CONFIG_BT_SMP=y
Thank you for help
Alexandre
  • Hi,

    You could modify source code by removing unnecessary lines form main.c file. Please remove the lines mentioned below

    1. in pairing_process(), remove

    char addr[BT_ADDR_LE_STR_LEN];

    and
    bt_addr_le_to_str(bt_conn_get_dst(pairing_data.conn),addr, sizeof(addr))
    printk("Passkey for %s: %06u\n", addr, pairing_data.passkey);
    printk("Press Button 1 to confirm, Button 2 to reject.\n");

    2. completely remove definitions of auth_passkey_display(), auth_passkey_confirm() and auth_cancel()

    3. in static struct bt_conn_auth_cb conn_auth_callbacks remove
    .passkey_display = auth_passkey_display,
    .passkey_confirm = auth_passkey_confirm,
    .cancel = auth_cancel,

    4. in num_comp_reply() remove
    if (accept) {
    bt_conn_auth_passkey_confirm(conn);
    printk("Numeric Match, conn %p\n", conn);
    } else {
    bt_conn_auth_cancel(conn);
    printk("Numeric Reject, conn %p\n", conn);
    }
    
    bt_conn_unref(pairing_data.conn);
    
    if (k_msgq_num_used_get(&mitm_queue)) {
    k_work_submit(&pairing_work);
    }


    Best regards,
    Dejan

Related