Re: [PATCH BlueZ 2/4] monitor: Add decoding support for BIGInfo mgmt event

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Luiz,

> -----Original Message-----
> From: Luiz Augusto von Dentz <luiz.dentz@xxxxxxxxx>
> Sent: Friday, August 25, 2023 11:06 PM
> To: Iulia Tanasescu <iulia.tanasescu@xxxxxxx>
> Cc: linux-bluetooth@xxxxxxxxxxxxxxx; Claudia Cristina Draghicescu
> <claudia.rosu@xxxxxxx>; Mihai-Octavian Urzica <mihai-
> octavian.urzica@xxxxxxx>; Silviu Florian Barbulescu
> <silviu.barbulescu@xxxxxxx>; Vlad Pruteanu <vlad.pruteanu@xxxxxxx>;
> Andrei Istodorescu <andrei.istodorescu@xxxxxxx>
> 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@xxxxxxx>
> 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@xxxxxxxxxxxx>
> > + *  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



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux