Linux bluetooth development
 help / color / mirror / Atom feed
From: Roland Schober <rolandschober1968@gmail.com>
To: linux-bluetooth@vger.kernel.org
Cc: Roland Schober <rolandschober1968@gmail.com>
Subject: [PATCH BlueZ v2 1/6] monitor: Fix handle decoding of status_handle_rsp
Date: Thu, 19 Nov 2026 08:13:27 +0100	[thread overview]
Message-ID: <20261119071332.32424-2-rolandschober1968@gmail.com> (raw)
In-Reply-To: <20261119071332.32424-1-rolandschober1968@gmail.com>

status_handle_rsp() decodes the return parameters of commands which
return a Status followed by a Connection_Handle, but it only reads the
first octet of the two octets of the handle, so any handle above 255 is
printed wrong.

With LE Periodic Advertising Set Info Transfer returning handle 3585:

> HCI Event: Command Complete (0x0e) plen 6
      LE Periodic Advertising Set Info Transfer (0x08|0x005b) ncmd 1
        Status: Unknown Connection Identifier (0x02)
        Connection handle: 1

Read the handle as a 16-bit value:

        Connection handle: 3585

Fixes: b73d4bb9e3c9 ("monitor: Decode LE Periodic Advertising Sync Transfer command")
Assisted-by: Claude:claude-fable-5-2
---
 monitor/packet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/packet.c b/monitor/packet.c
index eddf8706a..4ff24092e 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -4976,7 +4976,7 @@ static void status_handle_rsp(uint16_t index, const void *data, uint8_t size)
 	uint8_t status = *((const uint8_t *) data);
 
 	print_status(status);
-	print_field("Connection handle: %d", get_u8(data + 1));
+	print_field("Connection handle: %d", get_le16(data + 1));
 }
 
 static void status_bdaddr_rsp(uint16_t index, const void *data, uint8_t size)
-- 
2.47.3


  reply	other threads:[~2026-11-19  7:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19  7:13 [PATCH BlueZ v2 0/6] monitor: Decode Periodic Advertising with Responses Roland Schober
2026-11-19  7:13 ` Roland Schober [this message]
2026-11-19  7:13 ` [PATCH BlueZ v2 2/6] monitor: Fix data length of LE PA Report decoding Roland Schober
2026-11-19  7:13 ` [PATCH BlueZ v2 3/6] monitor: Fix PHY decoding of LE Ext Create Connection Roland Schober
2026-11-19  7:13 ` [PATCH BlueZ v2 4/6] monitor: Split LE PA Report decoding into helpers Roland Schober
2026-11-19  7:13 ` [PATCH BlueZ v2 5/6] monitor: Add PAwR HCI commands decoding Roland Schober
2026-11-19  7:13 ` [PATCH BlueZ v2 6/6] monitor: Add PAwR HCI events decoding Roland Schober

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261119071332.32424-2-rolandschober1968@gmail.com \
    --to=rolandschober1968@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox