Skip to contentSkip to conversation

btmon: Add proper decoding to Service Data UUID

PATCH Applied Luiz Augusto von Dentz 3 participants 6 messages Apr 26, 2022 – Apr 28, 2022 Bluetooth drivers

lore
Share & tools
lore

Luiz Augusto von Dentz

author maintainer
#0 lore raw

PATCH 1/4 btmon: Add proper decoding to Service Data UUID

From: Luiz Augusto von Dentz <[email protected]>

This adds proper decoding for Service Data UUID:

        Service Data: Apple, Inc. (0xfd6f)
          Data: e6b07e19815e902100b8b2f4a55255fd18f0c6be
---
 monitor/packet.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
monitor/packet.c +9 -3
index 6ef2fba3b..471b0dd4d 100644
@@ -3301,6 +3301,14 @@ static void print_uuid128_list(const char *label, const void *data,
 	}
 }
 
+static void print_service_data(const uint8_t *data, uint8_t data_len)
+{
+	uint16_t uuid = get_le16(&data[0]);
+
+	print_field("Service Data: %s (0x%4.4x)", bt_uuid16_to_str(uuid), uuid);
+	print_hex_field("  Data", &data[2], data_len - 2);
+}
+
 static const struct bitfield_data eir_flags_table[] = {
 	{ 0, "LE Limited Discoverable Mode"		},
 	{ 1, "LE General Discoverable Mode"		},
@@ -3703,9 +3711,7 @@ static void print_eir(const uint8_t *eir, uint8_t eir_len, bool le)
 		case BT_EIR_SERVICE_DATA:
 			if (data_len < 2)
 				break;
-			sprintf(label, "Service Data (UUID 0x%4.4x)",
-							get_le16(&data[0]));
-			print_hex_field(label, &data[2], data_len - 2);
+			print_service_data(data, data_len);
 			break;
 
 		case BT_EIR_RANDOM_ADDRESS:
Signature · 1 line
2.35.1
author maintainer
#1 lore raw

PATCH 2/4 btmon: Add support for decoding Broadcast Audio Annoucements

From: Luiz Augusto von Dentz <[email protected]>

This adds support for decoding Broadcast Audio Announcements as shown on:

Basic Audio Profile / Profile Specification
Page 34 of 146

Table 3.14: Broadcast Source AD format when transmitting Broadcast Audio Announcements

< HCI Command: LE Set Extended Advertising Data (0x08|0x0037) plen 36

        Handle: 0x00
        Operation: Complete extended advertising data (0x03)
        Fragment preference: Minimize fragmentation (0x01)
        Data length: 0x20
        Service Data: Broadcast Audio Announcement (0x1852)
        Broadcast ID: 904177 (0x0dcbf1)
        Name (complete): Broadcast Audio Source
---
 monitor/packet.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
monitor/packet.c +33 -0
index 471b0dd4d..b376d5a8b 100644
@@ -3301,11 +3301,44 @@ static void print_uuid128_list(const char *label, const void *data,
 	}
 }
 
+static void print_broadcast_annoucement(const uint8_t *data, uint8_t data_len)
+{
+	uint32_t bid;
+
+	if (data_len < 3) {
+		print_hex_field("  Data", data, data_len);
+		return;
+	}
+
+	bid = get_le24(data);
+	print_field("Broadcast ID: %u (0x%06x)", bid, bid);
+}
+
+static const struct service_data_decoder {
+	uint16_t uuid;
+	void (*func)(const uint8_t *data, uint8_t data_len);
+} service_data_decoders[] = {
+	{ 0x1852, print_broadcast_annoucement }
+};
+
 static void print_service_data(const uint8_t *data, uint8_t data_len)
 {
 	uint16_t uuid = get_le16(&data[0]);
+	size_t i;
 
 	print_field("Service Data: %s (0x%4.4x)", bt_uuid16_to_str(uuid), uuid);
+
+	for (i = 0; i < ARRAY_SIZE(service_data_decoders); i++) {
+		const struct service_data_decoder *decoder;
+
+		decoder = &service_data_decoders[i];
+
+		if (decoder->uuid == uuid) {
+			decoder->func(&data[2], data_len - 2);
+			return;
+		}
+	}
+
 	print_hex_field("  Data", &data[2], data_len - 2);
 }
 
Signature · 1 line
2.35.1
author maintainer
#2 lore raw

PATCH 3/4 btmon: Add support for decoding Basic Audio Annoucements

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This adds support for decoding Basic Audio Announcements as shown on:

Basic Audio Profile / Profile Specification
Page 36 of 146

Table 3.15: Format of BASE used in Basic Audio Announcements

< HCI Command: LE Set Periodic Advertising Data (0x08|0x003f) plen 36

        Handle: 0
        Operation: Complete ext advertising data (0x03)
        Data length: 0x21
        Service Data: Basic Audio Announcement (0x1851)
          Presetation Delay: 40000
          Number of Subgroups: 1
            Subgroup #0:
            Number of BIS(s): 1
            Codec: Reserved (0x06)
            Codec Specific Configuration: 010101020403010000020428
            Metadata: 020202
              BIS #0:
              Index: 1
              Codec Specific Configuration:
---
 monitor/bt.h     |  28 +++++++++++++
 monitor/packet.c | 106 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 134 insertions(+)
monitor/bt.h +28 -0
index e9f72de36..644c97c98 100644
@@ -3517,6 +3517,34 @@ struct bt_hci_evt_le_per_sync_established {
 	uint8_t  clock_accuracy;
 } __attribute__ ((packed));
 
+struct bt_hci_le_pa_base_codec {
+	uint8_t  id;
+	uint16_t cid;
+	uint16_t vid;
+} __attribute__ ((packed));
+
+struct bt_hci_lv_data {
+	uint8_t  len;
+	uint8_t  data[];
+} __attribute__ ((packed));
+
+struct bt_hci_le_pa_base_bis {
+	uint8_t  index;
+	struct bt_hci_lv_data codec_cfg[];
+} __attribute__ ((packed));
+
+struct bt_hci_le_pa_base_subgroup {
+	uint8_t  num_bis;
+	struct bt_hci_le_pa_base_codec codec;
+	uint8_t  data[];
+} __attribute__ ((packed));
+
+struct bt_hci_le_pa_base_data {
+	uint8_t  pd[3];
+	uint8_t  num_subgroups;
+	struct bt_hci_le_pa_base_subgroup subgroups[];
+} __attribute__ ((packed));
+
 #define BT_HCI_EVT_LE_PA_REPORT			0x0f
 struct bt_hci_le_pa_report {
 	uint16_t handle;
monitor/packet.c +106 -0

118 lines not on this page · raw message

Signature · 1 line
2.35.1
author maintainer
#3 lore raw

PATCH 4/4 btmon: Fix not decoding LC3 id

In reply to Luiz Augusto von Dentz

From: Luiz Augusto von Dentz <[email protected]>

This enablind decoding LC3 codec id (0x06).

---
 monitor/packet.c | 3 +++
 1 file changed, 3 insertions(+)
monitor/packet.c +3 -0
index 9d7677bb1..d409e4e63 100644
@@ -1337,6 +1337,9 @@ static void print_codec_id(const char *label, uint8_t codec)
 	case 0x05:
 		str = "mSBC";
 		break;
+	case 0x06:
+		str = "LC3";
+		break;
 	case 0xff:
 		str = "Vendor specific";
 		break;
Signature · 1 line
2.35.1
#4 lore raw
In reply to Luiz Augusto von Dentz

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=635945

---Test result---

Test Summary:

CheckPatch                    FAIL      6.08 seconds
GitLint                       PASS      4.09 seconds
Prep - Setup ELL              PASS      49.83 seconds
Build - Prep                  PASS      0.77 seconds
Build - Configure             PASS      10.00 seconds
Build - Make                  PASS      1440.82 seconds
Make Check                    PASS      12.56 seconds
Make Check w/Valgrind         PASS      517.26 seconds
Make Distcheck                PASS      269.46 seconds
Build w/ext ELL - Configure   PASS      10.86 seconds
Build w/ext ELL - Make        PASS      1541.46 seconds
Incremental Build with patchesPASS      6355.82 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script with rule in .checkpatch.conf
Output:
[BlueZ,3/4] btmon: Add support for decoding Basic Audio Annoucements WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #123: FILE: monitor/bt.h:3524:
+} __attribute__ ((packed));

WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #128: FILE: monitor/bt.h:3529:
+} __attribute__ ((packed));

WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #133: FILE: monitor/bt.h:3534:
+} __attribute__ ((packed));

WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #139: FILE: monitor/bt.h:3540:
+} __attribute__ ((packed));

WARNING:PREFER_DEFINED_ATTRIBUTE_MACRO: Prefer __packed over __attribute__((packed)) #145: FILE: monitor/bt.h:3546:
+} __attribute__ ((packed));

/github/workspace/src/12828051.patch total: 0 errors, 5 warnings, 152 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/12828051.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

---
Regards,
Linux Bluetooth

#5 lore raw
In reply to Luiz Augusto von Dentz
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 8 lines · On Tue, 26 Apr 2022 16:03:44 -0700 you wrote:

From: Luiz Augusto von Dentz <[email protected]>

This adds proper decoding for Service Data UUID:

        Service Data: Apple, Inc. (0xfd6f)
          Data: e6b07e19815e902100b8b2f4a55255fd18f0c6be

[...]

Here is the summary with links:
- [BlueZ,1/4] btmon: Add proper decoding to Service Data UUID

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=640d6b5c662d
  - [BlueZ,2/4] btmon: Add support for decoding Broadcast Audio Annoucements
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=6da642225f5a
  - [BlueZ,3/4] btmon: Add support for decoding Basic Audio Annoucements
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=80cd36cd2a0c
  - [BlueZ,4/4] btmon: Fix not decoding LC3 id
    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f65a9c9d21f6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html