From 2cae2622ae6b66e9590246014f750743348c00c2 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Tue, 4 Mar 2025 15:02:49 +0800 Subject: [PATCH] Bluetooth: tester: Support pincode request for BR Set the pin code request callback `auth_pincode_entry`. If `highsec` is false, call `bt_conn_auth_pincode_entry` with pin code "0000". If `highsec` is true, call `bt_conn_auth_pincode_entry` with pin code "0000000000000000". Signed-off-by: Lyle Zhu --- tests/bluetooth/tester/src/btp_gap.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/bluetooth/tester/src/btp_gap.c b/tests/bluetooth/tester/src/btp_gap.c index ecc51112c97..027b0498354 100644 --- a/tests/bluetooth/tester/src/btp_gap.c +++ b/tests/bluetooth/tester/src/btp_gap.c @@ -1349,6 +1349,24 @@ static struct bt_conn_auth_info_cb auth_info_cb = { .pairing_complete = auth_pairing_complete, }; +#if defined(CONFIG_BT_CLASSIC) +static void auth_pincode_entry(struct bt_conn *conn, bool highsec) +{ + const char *pin = "0000"; + const char *pin16 = "0000000000000000"; + + if (!bt_conn_is_type(conn, BT_CONN_TYPE_BR)) { + return; + } + + if (highsec) { + bt_conn_auth_pincode_entry(conn, pin16); + } else { + bt_conn_auth_pincode_entry(conn, pin); + } +} +#endif /* CONFIG_BT_CLASSIC */ + static uint8_t set_io_cap(const void *cmd, uint16_t cmd_len, void *rsp, uint16_t *rsp_len) { @@ -1390,6 +1408,10 @@ static uint8_t set_io_cap(const void *cmd, uint16_t cmd_len, cb.pairing_accept = auth_pairing_accept; +#if defined(CONFIG_BT_CLASSIC) + cb.pincode_entry = auth_pincode_entry; +#endif /* CONFIG_BT_CLASSIC */ + if (bt_conn_auth_cb_register(&cb)) { return BTP_STATUS_FAILED; }