Skip to content

Commit 26cf0b6

Browse files
sjanccarlescufi
authored andcommitted
bluetooth: tester: Add support for missing BTP L2CAP listen param
BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_ENCRYPTION is used to indicate encryption is required (but not authentication). Signed-off-by: Szymon Janc <[email protected]>
1 parent 40b4ccc commit 26cf0b6

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

tests/bluetooth/tester/src/btp/btp_l2cap.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct btp_l2cap_send_data_cmd {
5252
#define BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_AUTHEN 0x01
5353
#define BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_AUTHOR 0x02
5454
#define BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_ENC_KEY 0x03
55+
#define BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_ENCRYPTION 0x04
5556

5657
#define BTP_L2CAP_LISTEN 0x05
5758
struct btp_l2cap_listen_cmd {

tests/bluetooth/tester/src/btp_l2cap.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,22 @@ static uint8_t listen(const void *cmd, uint16_t cmd_len,
471471
server->accept = accept;
472472
server->psm = psm;
473473

474-
if (cp->response == BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_ENC_KEY) {
474+
switch (cp->response) {
475+
case BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_ENC_KEY:
475476
/* TSPX_psm_encryption_key_size_required */
476477
req_keysize = 16;
477-
} else if (cp->response == BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_AUTHOR) {
478+
break;
479+
case BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_AUTHOR:
478480
authorize_flag = true;
479-
} else if (cp->response == BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_AUTHEN) {
481+
break;
482+
case BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_AUTHEN:
480483
server->sec_level = BT_SECURITY_L3;
484+
break;
485+
case BTP_L2CAP_CONNECTION_RESPONSE_INSUFF_ENCRYPTION:
486+
server->sec_level = BT_SECURITY_L2;
487+
break;
488+
default:
489+
return BTP_STATUS_FAILED;
481490
}
482491

483492
if (bt_l2cap_server_register(server) < 0) {

0 commit comments

Comments
 (0)