Skip to content

Commit cb0b472

Browse files
gzh-terrykartben
authored andcommitted
Bluetooth: AVRCP: fix AVRCP timeout handler.
It is recommended to record the subunit type itself instead of the subunit ID when validating the transaction. This approach is more meaningful and less prone to misinterpretation. Signed-off-by: Zihao Gao <[email protected]>
1 parent 1789707 commit cb0b472

File tree

1 file changed

+3
-3
lines changed
  • subsys/bluetooth/host/classic

1 file changed

+3
-3
lines changed

subsys/bluetooth/host/classic/avrcp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ static int avrcp_recv(struct bt_avctp *session, struct net_buf *buf)
341341
/* Status changed notifiation, do not reset timer */
342342
} else if (avrcp_hdr->opcode == BT_AVRCP_OPC_PASS_THROUGH) {
343343
/* No max response time for pass through commands */
344-
} else if (tid != avrcp->req.tid || subunit_id != avrcp->req.subunit ||
344+
} else if (tid != avrcp->req.tid || subunit_type != avrcp->req.subunit ||
345345
avrcp_hdr->opcode != avrcp->req.opcode) {
346346
LOG_WRN("unexpected AVRCP response, expected tid:0x%X, subunit:0x%X, "
347347
"opc:0x%02X",
@@ -510,7 +510,7 @@ static int avrcp_send(struct bt_avrcp *avrcp, struct net_buf *buf)
510510
uint8_t tid = BT_AVCTP_HDR_GET_TRANSACTION_LABLE(avctp_hdr);
511511
bt_avctp_cr_t cr = BT_AVCTP_HDR_GET_CR(avctp_hdr);
512512
bt_avrcp_ctype_t ctype = BT_AVRCP_HDR_GET_CTYPE(avrcp_hdr);
513-
bt_avrcp_subunit_type_t subunit_id = BT_AVRCP_HDR_GET_SUBUNIT_ID(avrcp_hdr);
513+
bt_avrcp_subunit_type_t subunit_type = BT_AVRCP_HDR_GET_SUBUNIT_TYPE(avrcp_hdr);
514514

515515
LOG_DBG("AVRCP send cr:0x%X, tid:0x%X, ctype: 0x%X, opc:0x%02X\n", cr, tid, ctype,
516516
avrcp_hdr->opcode);
@@ -521,7 +521,7 @@ static int avrcp_send(struct bt_avrcp *avrcp, struct net_buf *buf)
521521

522522
if (cr == BT_AVCTP_CMD && avrcp_hdr->opcode != BT_AVRCP_OPC_PASS_THROUGH) {
523523
avrcp->req.tid = tid;
524-
avrcp->req.subunit = subunit_id;
524+
avrcp->req.subunit = subunit_type;
525525
avrcp->req.opcode = avrcp_hdr->opcode;
526526

527527
k_work_reschedule(&avrcp->timeout_work, AVRCP_TIMEOUT);

0 commit comments

Comments
 (0)