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 <lyle.zhu@nxp.com>
This commit is contained in:
Lyle Zhu 2025-03-04 15:02:49 +08:00 committed by Benjamin Cabé
commit 2cae2622ae

View file

@ -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;
}