From ba55e9d7c0ba68ce2b6c19ed416a88eb5eaedbb1 Mon Sep 17 00:00:00 2001 From: Lyle Zhu Date: Fri, 7 Mar 2025 12:34:31 +0800 Subject: [PATCH] Bluetooth: tester: Ignore error -EBUSY of `bt_conn_set_security` The error code `-EBUSY` of `bt_conn_set_security` means the pairing/encryption procedure is ongoing. Ignore the error code. Signed-off-by: Lyle Zhu --- tests/bluetooth/tester/src/btp_gap.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/bluetooth/tester/src/btp_gap.c b/tests/bluetooth/tester/src/btp_gap.c index 26da168bcc3..430118b2e9f 100644 --- a/tests/bluetooth/tester/src/btp_gap.c +++ b/tests/bluetooth/tester/src/btp_gap.c @@ -1567,7 +1567,11 @@ static uint8_t pair(const void *cmd, uint16_t cmd_len, } err = bt_conn_set_security(conn, BT_SECURITY_L2); - if (err < 0) { + /* + * If the error code is `-EBUSY`, it means the pairing/enryption is ongoing. + * Just ignore the error. + */ + if ((err < 0) && (err != -EBUSY)) { LOG_ERR("Failed to set security: %d", err); bt_conn_unref(conn); return BTP_STATUS_FAILED;