linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: Add mgmt event for BIGInfo report
  2023-08-21 12:03 [PATCH BlueZ 1/4] lib/mgmt: Add mgmt event for BIGInfo report Iulia Tanasescu
@ 2023-08-21 14:01 ` bluez.test.bot
  0 siblings, 0 replies; 9+ messages in thread
From: bluez.test.bot @ 2023-08-21 14:01 UTC (permalink / raw)
  To: linux-bluetooth, iulia.tanasescu

[-- Attachment #1: Type: text/plain, Size: 1716 bytes --]

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=777863

---Test result---

Test Summary:
CheckPatch                    PASS      2.25 seconds
GitLint                       PASS      1.48 seconds
BuildEll                      PASS      27.72 seconds
BluezMake                     PASS      874.91 seconds
MakeCheck                     PASS      11.89 seconds
MakeDistcheck                 PASS      158.93 seconds
CheckValgrind                 PASS      261.98 seconds
CheckSmatch                   WARNING   352.57 seconds
bluezmakeextell               PASS      105.61 seconds
IncrementalBuild              PASS      2928.70 seconds
ScanBuild                     PASS      1084.68 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1856:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3606:52: warning: array of flexible structuresmonitor/bt.h:3594:40: warning: array of flexible structuresmonitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1856:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3606:52: warning: array of flexible structuresmonitor/bt.h:3594:40: warning: array of flexible structures


---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH BlueZ 0/4] Add mgmt event for BIGInfo report
@ 2023-08-24 10:24 Iulia Tanasescu
  2023-08-24 10:24 ` [PATCH BlueZ 1/4] lib/mgmt: " Iulia Tanasescu
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Iulia Tanasescu @ 2023-08-24 10:24 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
	vlad.pruteanu, andrei.istodorescu, Iulia Tanasescu

This patch introduces MGMT events for BIGInfo advertising reports, so
that the event can be passed from kernel to userspace.

This patch also adds the sync_handle field to the bt_iso_bcast_qos
structure.

These changes are needed in order to implement the BASS Set Broadcast
Code operation - a BASS Server is required to inspect BIGInfo advertising
reports received from a Broadcast Source, to determine if the BIG is
encrypted or not. The Server is only able to associate a Broadcast Source
with a received BIGInfo report by looking at the sync_handle field. This
is why the sync_handle needs to be available in the QoS structure, so it
can e retrieved via getsockopt, once PA sync is established.

This patch depends on the kernel updates introduced by
https://patchwork.kernel.org/project/bluetooth/cover/20230824101635.25662-1-iulia.tanasescu@nxp.com/

Iulia Tanasescu (4):
  lib/mgmt: Add mgmt event for BIGInfo report
  monitor: Add decoding support for BIGInfo mgmt event
  monitor: Fix decoding issue for hci BIGInfo report
  lib: Add sync_handle to bcast QoS

 lib/bluetooth.h   |  1 +
 lib/mgmt.h        | 18 ++++++++++++++++++
 monitor/control.c | 25 +++++++++++++++++++++++++
 monitor/packet.c  | 35 ++++++++++++++++++++++++++++++++++-
 4 files changed, 78 insertions(+), 1 deletion(-)


base-commit: 60731cab5891ad2be01f5fcdbf5908aff7df4fd1
-- 
2.34.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH BlueZ 1/4] lib/mgmt: Add mgmt event for BIGInfo report
  2023-08-24 10:24 [PATCH BlueZ 0/4] Add mgmt event for BIGInfo report Iulia Tanasescu
@ 2023-08-24 10:24 ` Iulia Tanasescu
  2023-08-24 12:49   ` bluez.test.bot
  2023-08-24 10:24 ` [PATCH BlueZ 2/4] monitor: Add decoding support for BIGInfo mgmt event Iulia Tanasescu
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Iulia Tanasescu @ 2023-08-24 10:24 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
	vlad.pruteanu, andrei.istodorescu, Iulia Tanasescu

This adds the MGMT_EV_LE_BIG_INFO_ADV_REPORT event.

---
 lib/mgmt.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/mgmt.h b/lib/mgmt.h
index 8f92b7731..f075d435c 100644
--- a/lib/mgmt.h
+++ b/lib/mgmt.h
@@ -4,6 +4,7 @@
  *
  *  Copyright (C) 2010  Nokia Corporation
  *  Copyright (C) 2010  Marcel Holtmann <marcel@holtmann.org>
+ *  Copyright 2023 NXP
  *
  *
  */
@@ -1092,6 +1093,23 @@ struct mgmt_ev_mesh_pkt_cmplt {
 	uint8_t	handle;
 } __packed;
 
+#define MGMT_EV_LE_BIG_INFO_ADV_REPORT	0x0033
+struct mgmt_ev_le_big_info_adv_report {
+	uint16_t sync_handle;
+	uint8_t num_bis;
+	uint8_t nse;
+	uint16_t iso_interval;
+	uint8_t bn;
+	uint8_t pto;
+	uint8_t irc;
+	uint16_t max_pdu;
+	uint8_t sdu_interval[3];
+	uint16_t max_sdu;
+	uint8_t phy;
+	uint8_t framing;
+	uint8_t encryption;
+} __packed;
+
 static const char *mgmt_op[] = {
 	"<0x0000>",
 	"Read Version",
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH BlueZ 2/4] monitor: Add decoding support for BIGInfo mgmt event
  2023-08-24 10:24 [PATCH BlueZ 0/4] Add mgmt event for BIGInfo report Iulia Tanasescu
  2023-08-24 10:24 ` [PATCH BlueZ 1/4] lib/mgmt: " Iulia Tanasescu
@ 2023-08-24 10:24 ` Iulia Tanasescu
  2023-08-25 20:05   ` Luiz Augusto von Dentz
  2023-08-24 10:24 ` [PATCH BlueZ 3/4] monitor: Fix decoding issue for hci BIGInfo report Iulia Tanasescu
  2023-08-24 10:24 ` [PATCH BlueZ 4/4] lib: Add sync_handle to bcast QoS Iulia Tanasescu
  3 siblings, 1 reply; 9+ messages in thread
From: Iulia Tanasescu @ 2023-08-24 10:24 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
	vlad.pruteanu, andrei.istodorescu, Iulia Tanasescu

This adds btmon support for decoding BIGInfo MGMT events.

---
 monitor/control.c | 25 +++++++++++++++++++++++++
 monitor/packet.c  | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/monitor/control.c b/monitor/control.c
index 009cf1520..b843d076f 100644
--- a/monitor/control.c
+++ b/monitor/control.c
@@ -5,6 +5,7 @@
  *
  *  Copyright (C) 2011-2014  Intel Corporation
  *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
+ *  Copyright 2023 NXP
  *
  *
  */
@@ -788,6 +789,27 @@ static void mgmt_advertising_removed(uint16_t len, const void *buf)
 	packet_hexdump(buf, len);
 }
 
+static void mgmt_big_info_adv_report(uint16_t len, const void *buf)
+{
+	const struct mgmt_ev_le_big_info_adv_report *ev = buf;
+	uint16_t sync_handle;
+
+	if (len < sizeof(*ev)) {
+		printf("* Malformed BIGInfo advertising report control\n");
+		return;
+	}
+
+	sync_handle = le16_to_cpu(ev->sync_handle);
+
+	printf("@ BIGInfo Advertising Report: sync_handle 0x%4.4x num_bis %u "
+		"encryption %u\n", sync_handle, ev->num_bis, ev->encryption);
+
+	buf += sizeof(*ev);
+	len -= sizeof(*ev);
+
+	packet_hexdump(buf, len);
+}
+
 void control_message(uint16_t opcode, const void *data, uint16_t size)
 {
 	if (!decode_control)
@@ -893,6 +915,9 @@ void control_message(uint16_t opcode, const void *data, uint16_t size)
 	case MGMT_EV_ADVERTISING_REMOVED:
 		mgmt_advertising_removed(size, data);
 		break;
+	case MGMT_EV_LE_BIG_INFO_ADV_REPORT:
+		mgmt_big_info_adv_report(size, data);
+		break;
 	default:
 		printf("* Unknown control (code %d len %d)\n", opcode, size);
 		packet_hexdump(data, size);
diff --git a/monitor/packet.c b/monitor/packet.c
index 8eae8c9ea..96fc2662e 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -15396,6 +15396,37 @@ static void mgmt_mesh_device_found_evt(const void *data, uint16_t size)
 	print_hex_field("EIR Data", eir_data, size);
 }
 
+static void mgmt_big_info_adv_report(const void *data, uint16_t size)
+{
+	uint16_t sync_handle = get_le16(data);
+	uint8_t num_bis = get_u8(data + 2);
+	uint8_t nse = get_u8(data + 3);
+	uint16_t iso_interval = get_le16(data + 4);
+	uint8_t bn = get_u8(data + 6);
+	uint8_t pto = get_u8(data + 7);
+	uint8_t irc = get_u8(data + 8);
+	uint16_t max_pdu = get_le16(data + 9);
+	const uint8_t *sdu_interval = data + 11;
+	uint16_t max_sdu = get_le16(data + 14);
+	uint8_t phy = get_u8(data + 16);
+	uint8_t framing = get_u8(data + 17);
+	uint8_t encryption = get_u8(data + 18);
+
+	print_field("Sync Handle: 0x%4.4x", sync_handle);
+	print_field("Number BIS: %u", num_bis);
+	print_field("NSE: %u", nse);
+	print_slot_125("ISO Interval", iso_interval);
+	print_field("BN: %u", bn);
+	print_field("PTO: %u", pto);
+	print_field("IRC: %u", irc);
+	print_field("Maximum PDU: %u", max_pdu);
+	print_usec_interval("SDU Interval", sdu_interval);
+	print_field("Maximum SDU: %u", max_sdu);
+	print_le_phy("PHY", phy);
+	print_framing(framing);
+	print_field("Encryption: 0x%02x", encryption);
+}
+
 static void mgmt_mesh_packet_cmplt_evt(const void *data, uint16_t size)
 {
 	uint8_t handle = get_u8(data);
@@ -15500,6 +15531,8 @@ static const struct mgmt_data mgmt_event_table[] = {
 			mgmt_mesh_device_found_evt, 22, false },
 	{ 0x0032, "Mesh Packet Complete",
 			mgmt_mesh_packet_cmplt_evt, 1, true },
+	{ 0x0033, "BIGInfo advertising report",
+			mgmt_big_info_adv_report, 19, false },
 	{ }
 };
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH BlueZ 3/4] monitor: Fix decoding issue for hci BIGInfo report
  2023-08-24 10:24 [PATCH BlueZ 0/4] Add mgmt event for BIGInfo report Iulia Tanasescu
  2023-08-24 10:24 ` [PATCH BlueZ 1/4] lib/mgmt: " Iulia Tanasescu
  2023-08-24 10:24 ` [PATCH BlueZ 2/4] monitor: Add decoding support for BIGInfo mgmt event Iulia Tanasescu
@ 2023-08-24 10:24 ` Iulia Tanasescu
  2023-08-24 10:24 ` [PATCH BlueZ 4/4] lib: Add sync_handle to bcast QoS Iulia Tanasescu
  3 siblings, 0 replies; 9+ messages in thread
From: Iulia Tanasescu @ 2023-08-24 10:24 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
	vlad.pruteanu, andrei.istodorescu, Iulia Tanasescu

This fixes the fact that when decoding a BIGInfo hci report, the bn
fild is printed two times.

---
 monitor/packet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/packet.c b/monitor/packet.c
index 96fc2662e..69600e93d 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
@@ -11783,7 +11783,7 @@ static void le_big_info_evt(struct timeval *tv, uint16_t index,
 	print_field("NSE: %u", evt->nse);
 	print_slot_125("ISO Interval", evt->iso_interval);
 	print_field("BN: %u", evt->bn);
-	print_field("PTO: %u", evt->bn);
+	print_field("PTO: %u", evt->pto);
 	print_field("IRC: %u", evt->irc);
 	print_field("Maximum PDU: %u", evt->max_pdu);
 	print_usec_interval("SDU Interval", evt->sdu_interval);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH BlueZ 4/4] lib: Add sync_handle to bcast QoS
  2023-08-24 10:24 [PATCH BlueZ 0/4] Add mgmt event for BIGInfo report Iulia Tanasescu
                   ` (2 preceding siblings ...)
  2023-08-24 10:24 ` [PATCH BlueZ 3/4] monitor: Fix decoding issue for hci BIGInfo report Iulia Tanasescu
@ 2023-08-24 10:24 ` Iulia Tanasescu
  3 siblings, 0 replies; 9+ messages in thread
From: Iulia Tanasescu @ 2023-08-24 10:24 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: claudia.rosu, mihai-octavian.urzica, silviu.barbulescu,
	vlad.pruteanu, andrei.istodorescu, Iulia Tanasescu

This adds the sync_handle field to the bt_iso_qos struct.

---
 lib/bluetooth.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/bluetooth.h b/lib/bluetooth.h
index 1286aa763..f007240f4 100644
--- a/lib/bluetooth.h
+++ b/lib/bluetooth.h
@@ -187,6 +187,7 @@ struct bt_iso_bcast_qos {
 	uint8_t  sync_cte_type;
 	uint8_t  mse;
 	uint16_t timeout;
+	uint16_t sync_handle;
 };
 
 /* (HCI_MAX_PER_AD_LENGTH - EIR_SERVICE_DATA_LENGTH) */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: Add mgmt event for BIGInfo report
  2023-08-24 10:24 ` [PATCH BlueZ 1/4] lib/mgmt: " Iulia Tanasescu
@ 2023-08-24 12:49   ` bluez.test.bot
  0 siblings, 0 replies; 9+ messages in thread
From: bluez.test.bot @ 2023-08-24 12:49 UTC (permalink / raw)
  To: linux-bluetooth, iulia.tanasescu

[-- Attachment #1: Type: text/plain, Size: 1717 bytes --]

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=778937

---Test result---

Test Summary:
CheckPatch                    PASS      2.02 seconds
GitLint                       PASS      1.36 seconds
BuildEll                      PASS      33.49 seconds
BluezMake                     PASS      1179.64 seconds
MakeCheck                     PASS      13.23 seconds
MakeDistcheck                 PASS      194.96 seconds
CheckValgrind                 PASS      317.38 seconds
CheckSmatch                   WARNING   441.39 seconds
bluezmakeextell               PASS      132.17 seconds
IncrementalBuild              PASS      4149.24 seconds
ScanBuild                     PASS      1407.55 seconds

Details
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
monitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1856:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3606:52: warning: array of flexible structuresmonitor/bt.h:3594:40: warning: array of flexible structuresmonitor/packet.c: note: in included file:monitor/display.h:82:26: warning: Variable length array is used.monitor/packet.c:1856:26: warning: Variable length array is used.monitor/packet.c: note: in included file:monitor/bt.h:3606:52: warning: array of flexible structuresmonitor/bt.h:3594:40: warning: array of flexible structures


---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH BlueZ 2/4] monitor: Add decoding support for BIGInfo mgmt event
  2023-08-24 10:24 ` [PATCH BlueZ 2/4] monitor: Add decoding support for BIGInfo mgmt event Iulia Tanasescu
@ 2023-08-25 20:05   ` Luiz Augusto von Dentz
  2023-08-30 15:13     ` Iulia Tanasescu
  0 siblings, 1 reply; 9+ messages in thread
From: Luiz Augusto von Dentz @ 2023-08-25 20:05 UTC (permalink / raw)
  To: Iulia Tanasescu
  Cc: linux-bluetooth, claudia.rosu, mihai-octavian.urzica,
	silviu.barbulescu, vlad.pruteanu, andrei.istodorescu

Hi Iulia,

On Fri, Aug 25, 2023 at 12:41 AM Iulia Tanasescu
<iulia.tanasescu@nxp.com> wrote:
>
> This adds btmon support for decoding BIGInfo MGMT events.
>
> ---
>  monitor/control.c | 25 +++++++++++++++++++++++++
>  monitor/packet.c  | 33 +++++++++++++++++++++++++++++++++
>  2 files changed, 58 insertions(+)
>
> diff --git a/monitor/control.c b/monitor/control.c
> index 009cf1520..b843d076f 100644
> --- a/monitor/control.c
> +++ b/monitor/control.c
> @@ -5,6 +5,7 @@
>   *
>   *  Copyright (C) 2011-2014  Intel Corporation
>   *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
> + *  Copyright 2023 NXP
>   *
>   *
>   */
> @@ -788,6 +789,27 @@ static void mgmt_advertising_removed(uint16_t len, const void *buf)
>         packet_hexdump(buf, len);
>  }
>
> +static void mgmt_big_info_adv_report(uint16_t len, const void *buf)
> +{
> +       const struct mgmt_ev_le_big_info_adv_report *ev = buf;
> +       uint16_t sync_handle;
> +
> +       if (len < sizeof(*ev)) {
> +               printf("* Malformed BIGInfo advertising report control\n");
> +               return;
> +       }
> +
> +       sync_handle = le16_to_cpu(ev->sync_handle);
> +
> +       printf("@ BIGInfo Advertising Report: sync_handle 0x%4.4x num_bis %u "
> +               "encryption %u\n", sync_handle, ev->num_bis, ev->encryption);
> +
> +       buf += sizeof(*ev);
> +       len -= sizeof(*ev);
> +
> +       packet_hexdump(buf, len);
> +}
> +
>  void control_message(uint16_t opcode, const void *data, uint16_t size)
>  {
>         if (!decode_control)
> @@ -893,6 +915,9 @@ void control_message(uint16_t opcode, const void *data, uint16_t size)
>         case MGMT_EV_ADVERTISING_REMOVED:
>                 mgmt_advertising_removed(size, data);
>                 break;
> +       case MGMT_EV_LE_BIG_INFO_ADV_REPORT:
> +               mgmt_big_info_adv_report(size, data);
> +               break;
>         default:
>                 printf("* Unknown control (code %d len %d)\n", opcode, size);
>                 packet_hexdump(data, size);
> diff --git a/monitor/packet.c b/monitor/packet.c
> index 8eae8c9ea..96fc2662e 100644
> --- a/monitor/packet.c
> +++ b/monitor/packet.c
> @@ -15396,6 +15396,37 @@ static void mgmt_mesh_device_found_evt(const void *data, uint16_t size)
>         print_hex_field("EIR Data", eir_data, size);
>  }
>
> +static void mgmt_big_info_adv_report(const void *data, uint16_t size)
> +{
> +       uint16_t sync_handle = get_le16(data);
> +       uint8_t num_bis = get_u8(data + 2);
> +       uint8_t nse = get_u8(data + 3);
> +       uint16_t iso_interval = get_le16(data + 4);
> +       uint8_t bn = get_u8(data + 6);
> +       uint8_t pto = get_u8(data + 7);
> +       uint8_t irc = get_u8(data + 8);
> +       uint16_t max_pdu = get_le16(data + 9);
> +       const uint8_t *sdu_interval = data + 11;
> +       uint16_t max_sdu = get_le16(data + 14);
> +       uint8_t phy = get_u8(data + 16);
> +       uint8_t framing = get_u8(data + 17);
> +       uint8_t encryption = get_u8(data + 18);
> +
> +       print_field("Sync Handle: 0x%4.4x", sync_handle);
> +       print_field("Number BIS: %u", num_bis);
> +       print_field("NSE: %u", nse);
> +       print_slot_125("ISO Interval", iso_interval);
> +       print_field("BN: %u", bn);
> +       print_field("PTO: %u", pto);
> +       print_field("IRC: %u", irc);
> +       print_field("Maximum PDU: %u", max_pdu);
> +       print_usec_interval("SDU Interval", sdu_interval);
> +       print_field("Maximum SDU: %u", max_sdu);
> +       print_le_phy("PHY", phy);
> +       print_framing(framing);
> +       print_field("Encryption: 0x%02x", encryption);
> +}
> +
>  static void mgmt_mesh_packet_cmplt_evt(const void *data, uint16_t size)
>  {
>         uint8_t handle = get_u8(data);
> @@ -15500,6 +15531,8 @@ static const struct mgmt_data mgmt_event_table[] = {
>                         mgmt_mesh_device_found_evt, 22, false },
>         { 0x0032, "Mesh Packet Complete",
>                         mgmt_mesh_packet_cmplt_evt, 1, true },
> +       { 0x0033, "BIGInfo advertising report",
> +                       mgmt_big_info_adv_report, 19, false },

This should got to the ISO socket not via mgmt interface, that said we
may need to do some changes to how we discover the broadcast, it seems
we will need to do short lived PA sync to enumerate the BASE, so I
think we are better of having the driver register with BAA UUID,
initially this can probably be done in userspace so once it detects
the device is advertising with BCAA it will attempt to fetch the BASE
automatically and merge it into the bt_ad.

Later on we may decide to move this into the kernel as part of general
discovery procedure and then merge the discovered BASE into Device
Found event, etc, but I think it is too early to evaluate if that is a
good idea or not before exploring if the short lived PA sync would
work reliably, or if we really need a dedicated API for discovering
Broadcasters.

>         { }
>  };
>
> --
> 2.34.1
>


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH BlueZ 2/4] monitor: Add decoding support for BIGInfo mgmt event
  2023-08-25 20:05   ` Luiz Augusto von Dentz
@ 2023-08-30 15:13     ` Iulia Tanasescu
  0 siblings, 0 replies; 9+ messages in thread
From: Iulia Tanasescu @ 2023-08-30 15:13 UTC (permalink / raw)
  To: luiz.dentz
  Cc: andrei.istodorescu, claudia.rosu, iulia.tanasescu,
	linux-bluetooth, mihai-octavian.urzica, silviu.barbulescu,
	vlad.pruteanu

Hi Luiz,

> -----Original Message-----
> From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
> Sent: Friday, August 25, 2023 11:06 PM
> To: Iulia Tanasescu <iulia.tanasescu@nxp.com>
> Cc: linux-bluetooth@vger.kernel.org; Claudia Cristina Draghicescu
> <claudia.rosu@nxp.com>; Mihai-Octavian Urzica <mihai-
> octavian.urzica@nxp.com>; Silviu Florian Barbulescu
> <silviu.barbulescu@nxp.com>; Vlad Pruteanu <vlad.pruteanu@nxp.com>;
> Andrei Istodorescu <andrei.istodorescu@nxp.com>
> Subject: Re: [PATCH BlueZ 2/4] monitor: Add decoding support for
> BIGInfo mgmt event
> 
> Hi Iulia,
> 
> On Fri, Aug 25, 2023 at 12:41 AM Iulia Tanasescu <iulia.tanasescu@nxp.com>
> wrote:
> >
> > This adds btmon support for decoding BIGInfo MGMT events.
> >
> > ---
> >  monitor/control.c | 25 +++++++++++++++++++++++++  monitor/packet.c
> |
> > 33 +++++++++++++++++++++++++++++++++
> >  2 files changed, 58 insertions(+)
> >
> > diff --git a/monitor/control.c b/monitor/control.c index
> > 009cf1520..b843d076f 100644
> > --- a/monitor/control.c
> > +++ b/monitor/control.c
> > @@ -5,6 +5,7 @@
> >   *
> >   *  Copyright (C) 2011-2014  Intel Corporation
> >   *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
> > + *  Copyright 2023 NXP
> >   *
> >   *
> >   */
> > @@ -788,6 +789,27 @@ static void mgmt_advertising_removed(uint16_t
> len, const void *buf)
> >         packet_hexdump(buf, len);
> >  }
> >
> > +static void mgmt_big_info_adv_report(uint16_t len, const void *buf) {
> > +       const struct mgmt_ev_le_big_info_adv_report *ev = buf;
> > +       uint16_t sync_handle;
> > +
> > +       if (len < sizeof(*ev)) {
> > +               printf("* Malformed BIGInfo advertising report control\n");
> > +               return;
> > +       }
> > +
> > +       sync_handle = le16_to_cpu(ev->sync_handle);
> > +
> > +       printf("@ BIGInfo Advertising Report: sync_handle 0x%4.4x
> num_bis %u "
> > +               "encryption %u\n", sync_handle, ev->num_bis,
> > + ev->encryption);
> > +
> > +       buf += sizeof(*ev);
> > +       len -= sizeof(*ev);
> > +
> > +       packet_hexdump(buf, len);
> > +}
> > +
> >  void control_message(uint16_t opcode, const void *data, uint16_t
> > size)  {
> >         if (!decode_control)
> > @@ -893,6 +915,9 @@ void control_message(uint16_t opcode, const void
> *data, uint16_t size)
> >         case MGMT_EV_ADVERTISING_REMOVED:
> >                 mgmt_advertising_removed(size, data);
> >                 break;
> > +       case MGMT_EV_LE_BIG_INFO_ADV_REPORT:
> > +               mgmt_big_info_adv_report(size, data);
> > +               break;
> >         default:
> >                 printf("* Unknown control (code %d len %d)\n", opcode, size);
> >                 packet_hexdump(data, size); diff --git
> > a/monitor/packet.c b/monitor/packet.c index 8eae8c9ea..96fc2662e
> > 100644
> > --- a/monitor/packet.c
> > +++ b/monitor/packet.c
> > @@ -15396,6 +15396,37 @@ static void
> mgmt_mesh_device_found_evt(const void *data, uint16_t size)
> >         print_hex_field("EIR Data", eir_data, size);  }
> >
> > +static void mgmt_big_info_adv_report(const void *data, uint16_t size)
> > +{
> > +       uint16_t sync_handle = get_le16(data);
> > +       uint8_t num_bis = get_u8(data + 2);
> > +       uint8_t nse = get_u8(data + 3);
> > +       uint16_t iso_interval = get_le16(data + 4);
> > +       uint8_t bn = get_u8(data + 6);
> > +       uint8_t pto = get_u8(data + 7);
> > +       uint8_t irc = get_u8(data + 8);
> > +       uint16_t max_pdu = get_le16(data + 9);
> > +       const uint8_t *sdu_interval = data + 11;
> > +       uint16_t max_sdu = get_le16(data + 14);
> > +       uint8_t phy = get_u8(data + 16);
> > +       uint8_t framing = get_u8(data + 17);
> > +       uint8_t encryption = get_u8(data + 18);
> > +
> > +       print_field("Sync Handle: 0x%4.4x", sync_handle);
> > +       print_field("Number BIS: %u", num_bis);
> > +       print_field("NSE: %u", nse);
> > +       print_slot_125("ISO Interval", iso_interval);
> > +       print_field("BN: %u", bn);
> > +       print_field("PTO: %u", pto);
> > +       print_field("IRC: %u", irc);
> > +       print_field("Maximum PDU: %u", max_pdu);
> > +       print_usec_interval("SDU Interval", sdu_interval);
> > +       print_field("Maximum SDU: %u", max_sdu);
> > +       print_le_phy("PHY", phy);
> > +       print_framing(framing);
> > +       print_field("Encryption: 0x%02x", encryption); }
> > +
> >  static void mgmt_mesh_packet_cmplt_evt(const void *data, uint16_t
> > size)  {
> >         uint8_t handle = get_u8(data); @@ -15500,6 +15531,8 @@ static
> > const struct mgmt_data mgmt_event_table[] = {
> >                         mgmt_mesh_device_found_evt, 22, false },
> >         { 0x0032, "Mesh Packet Complete",
> >                         mgmt_mesh_packet_cmplt_evt, 1, true },
> > +       { 0x0033, "BIGInfo advertising report",
> > +                       mgmt_big_info_adv_report, 19, false },
> 
> This should got to the ISO socket not via mgmt interface, that said we may
> need to do some changes to how we discover the broadcast, it seems we will
> need to do short lived PA sync to enumerate the BASE, so I think we are
> better of having the driver register with BAA UUID, initially this can probably
> be done in userspace so once it detects the device is advertising with BCAA it
> will attempt to fetch the BASE automatically and merge it into the bt_ad.
> 
> Later on we may decide to move this into the kernel as part of general
> discovery procedure and then merge the discovered BASE into Device Found
> event, etc, but I think it is too early to evaluate if that is a good idea or not
> before exploring if the short lived PA sync would work reliably, or if we really
> need a dedicated API for discovering Broadcasters.
> 

I submitted a new kernel patch, which enables a broadcast sink to discover
if the PA it has synced with is associated with an encrypted BIG, by looking
at the socket QoS.

> >         { }
> >  };
> >
> > --
> > 2.34.1
> >
> 
> 
> --
> Luiz Augusto von Dentz

Regards,
Iulia

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-08-30 18:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-24 10:24 [PATCH BlueZ 0/4] Add mgmt event for BIGInfo report Iulia Tanasescu
2023-08-24 10:24 ` [PATCH BlueZ 1/4] lib/mgmt: " Iulia Tanasescu
2023-08-24 12:49   ` bluez.test.bot
2023-08-24 10:24 ` [PATCH BlueZ 2/4] monitor: Add decoding support for BIGInfo mgmt event Iulia Tanasescu
2023-08-25 20:05   ` Luiz Augusto von Dentz
2023-08-30 15:13     ` Iulia Tanasescu
2023-08-24 10:24 ` [PATCH BlueZ 3/4] monitor: Fix decoding issue for hci BIGInfo report Iulia Tanasescu
2023-08-24 10:24 ` [PATCH BlueZ 4/4] lib: Add sync_handle to bcast QoS Iulia Tanasescu
  -- strict thread matches above, loose matches on Subject: below --
2023-08-21 12:03 [PATCH BlueZ 1/4] lib/mgmt: Add mgmt event for BIGInfo report Iulia Tanasescu
2023-08-21 14:01 ` bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).