* [PATCH BlueZ 0/1] client: add public-broadcast advertise helper @ 2026-03-17 14:26 raghava447 2026-03-17 14:26 ` [PATCH BlueZ 1/1] client: Add public-broadcast profile advertise command raghava447 2026-04-24 14:18 ` [PATCH BlueZ v2 0/2] client: Add public broadcast advertising support raghu447 0 siblings, 2 replies; 25+ messages in thread From: raghava447 @ 2026-03-17 14:26 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghava447 This patch adds a bluetoothctl advertise helper for BLE Audio public broadcast profile advertising. This series adds a semantic helper: public-broadcast sq public-broadcast hq This matches with current commands: service 0x1856 0x02 0x00 service 0x1856 0x04 0x00 raghava447 (1): client: Add public-broadcast profile advertise command client/advertising.c | 70 ++++++++++++++++++++++++++++++++++++++++++++ client/advertising.h | 2 ++ client/main.c | 19 ++++++++++++ 3 files changed, 91 insertions(+) -- 2.53.0 ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH BlueZ 1/1] client: Add public-broadcast profile advertise command 2026-03-17 14:26 [PATCH BlueZ 0/1] client: add public-broadcast advertise helper raghava447 @ 2026-03-17 14:26 ` raghava447 2026-03-17 16:21 ` client: add public-broadcast advertise helper bluez.test.bot 2026-03-17 18:00 ` [PATCH BlueZ 1/1] client: Add public-broadcast profile advertise command Luiz Augusto von Dentz 2026-04-24 14:18 ` [PATCH BlueZ v2 0/2] client: Add public broadcast advertising support raghu447 1 sibling, 2 replies; 25+ messages in thread From: raghava447 @ 2026-03-17 14:26 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghava447 Add an advertise submenu command for BLE Audio public broadcast profile advertising in bluetoothctl. The new "public-broadcast" command reuses the existing staged AD ServiceData field for UUID 0x1856. It supports: - public-broadcast sq - public-broadcast hq - public-broadcast The sq and hq values map to the existing raw service-data payloads: - sq -> 0x02 0x00 - hq -> 0x04 0x00 When called without arguments, the command reports the currently staged public-broadcast state if the staged AD service UUID is 0x1856. Else it reports that public broadcast is not set. --- client/advertising.c | 70 ++++++++++++++++++++++++++++++++++++++++++++ client/advertising.h | 2 ++ client/main.c | 19 ++++++++++++ 3 files changed, 91 insertions(+) diff --git a/client/advertising.c b/client/advertising.c index f9df1b855..30b89a404 100644 --- a/client/advertising.c +++ b/client/advertising.c @@ -20,6 +20,8 @@ #include <string.h> #include <errno.h> +#include "bluetooth/bluetooth.h" +#include "bluetooth/uuid.h" #include "gdbus/gdbus.h" #include "src/shared/util.h" #include "src/shared/shell.h" @@ -27,6 +29,7 @@ #define AD_PATH "/org/bluez/advertising" #define AD_IFACE "org.bluez.LEAdvertisement1" +#define AD_PUBLIC_BROADCAST_UUID "0x1856" struct ad_data { uint8_t data[245]; @@ -1005,6 +1008,73 @@ static void ad_clear_data(int type) memset(&ad.data[type], 0, sizeof(ad.data[type])); } +static bool ad_is_public_broadcast_uuid(const char *uuid) +{ + return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID); +} + +static const char *ad_public_broadcast_state(void) +{ + if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid)) + return NULL; + + if (ad.service[AD_TYPE_AD].data.len != 2) + return NULL; + + if (ad.service[AD_TYPE_AD].data.data[0] == 0x02 && + ad.service[AD_TYPE_AD].data.data[1] == 0x00) + return "sq"; + + if (ad.service[AD_TYPE_AD].data.data[0] == 0x04 && + ad.service[AD_TYPE_AD].data.data[1] == 0x00) + return "hq"; + + return NULL; +} + +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, char *argv[]) +{ + struct ad_data data = { + .data = { 0x00, 0x00 }, + .len = 2, + }; + const char *state; + + if (argc < 2) { + state = ad_public_broadcast_state(); + if (state) + bt_shell_printf("Public Broadcast: %s\n", state); + else + bt_shell_printf("Public Broadcast not set\n"); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + } + + if (!strlen(argv[1])) { + bt_shell_printf("Public broadcast value cannot be empty\n"); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + if (!strcasecmp(argv[1], "sq")) + data.data[0] = 0x02; + else if (!strcasecmp(argv[1], "hq")) + data.data[0] = 0x04; + else { + bt_shell_printf("Invalid argument: accepted values are sq or hq\n"); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + ad_clear_service(AD_TYPE_AD); + + ad.service[AD_TYPE_AD].uuid = g_strdup(AD_PUBLIC_BROADCAST_UUID); + ad.service[AD_TYPE_AD].data = data; + + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, + prop_names.service[AD_TYPE_AD]); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); +} + void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]) { char *endptr = NULL; diff --git a/client/advertising.h b/client/advertising.h index 9d124c7af..8c3fd041b 100644 --- a/client/advertising.h +++ b/client/advertising.h @@ -34,6 +34,8 @@ void ad_advertise_local_appearance(DBusConnection *conn, long int *value); void ad_advertise_duration(DBusConnection *conn, long int *value); void ad_advertise_timeout(DBusConnection *conn, long int *value); void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]); +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, + char *argv[]); void ad_disable_data(DBusConnection *conn, int type); void ad_advertise_discoverable(DBusConnection *conn, dbus_bool_t *value); void ad_advertise_discoverable_timeout(DBusConnection *conn, long int *value); diff --git a/client/main.c b/client/main.c index cb016a579..0e050b373 100644 --- a/client/main.c +++ b/client/main.c @@ -2892,6 +2892,17 @@ static char *ad_generator(const char *text, int state) return argument_generator(text, state, ad_arguments); } +static const char *public_broadcast_arguments[] = { + "sq", + "hq", + NULL +}; + +static char *public_broadcast_generator(const char *text, int state) +{ + return argument_generator(text, state, public_broadcast_arguments); +} + static void cmd_advertise_uuids(int argc, char *argv[]) { ad_advertise_uuids(dbus_conn, AD_TYPE_AD, argc, argv); @@ -2917,6 +2928,11 @@ static void cmd_advertise_data(int argc, char *argv[]) ad_advertise_data(dbus_conn, AD_TYPE_AD, argc, argv); } +static void cmd_advertise_public_broadcast(int argc, char *argv[]) +{ + ad_advertise_public_broadcast(dbus_conn, argc, argv); +} + static void cmd_advertise_sr_uuids(int argc, char *argv[]) { ad_advertise_uuids(dbus_conn, AD_TYPE_SRD, argc, argv); @@ -3600,6 +3616,9 @@ static const struct bt_shell_menu advertise_menu = { "Set/Get advertise manufacturer data" }, { "data", "[type] [data=xx xx ...]", cmd_advertise_data, "Set/Get advertise data" }, + { "public-broadcast", "[sq/hq]", cmd_advertise_public_broadcast, + "Set/Get BLE Audio Public Broadcast Announcement", + public_broadcast_generator }, { "sr-uuids", "[uuid1 uuid2 ...]", cmd_advertise_sr_uuids, "Set/Get scan response uuids" }, { "sr-solicit", "[uuid1 uuid2 ...]", cmd_advertise_sr_solicit, -- 2.53.0 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* RE: client: add public-broadcast advertise helper 2026-03-17 14:26 ` [PATCH BlueZ 1/1] client: Add public-broadcast profile advertise command raghava447 @ 2026-03-17 16:21 ` bluez.test.bot 2026-03-17 18:00 ` [PATCH BlueZ 1/1] client: Add public-broadcast profile advertise command Luiz Augusto von Dentz 1 sibling, 0 replies; 25+ messages in thread From: bluez.test.bot @ 2026-03-17 16:21 UTC (permalink / raw) To: linux-bluetooth, raghavendra.rao [-- Attachment #1: Type: text/plain, Size: 1311 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=1068070 ---Test result--- Test Summary: CheckPatch PENDING 0.53 seconds GitLint PENDING 0.56 seconds BuildEll PASS 21.05 seconds BluezMake PASS 643.60 seconds MakeCheck PASS 19.19 seconds MakeDistcheck PASS 248.59 seconds CheckValgrind PASS 300.93 seconds CheckSmatch PASS 366.26 seconds bluezmakeextell PASS 191.21 seconds IncrementalBuild PENDING 0.48 seconds ScanBuild PASS 1029.10 seconds Details ############################## Test: CheckPatch - PENDING Desc: Run checkpatch.pl script Output: ############################## Test: GitLint - PENDING Desc: Run gitlint Output: ############################## Test: IncrementalBuild - PENDING Desc: Incremental build with the patches in the series Output: https://github.com/bluez/bluez/pull/1967/checks --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH BlueZ 1/1] client: Add public-broadcast profile advertise command 2026-03-17 14:26 ` [PATCH BlueZ 1/1] client: Add public-broadcast profile advertise command raghava447 2026-03-17 16:21 ` client: add public-broadcast advertise helper bluez.test.bot @ 2026-03-17 18:00 ` Luiz Augusto von Dentz 2026-03-20 8:34 ` raghava447 1 sibling, 1 reply; 25+ messages in thread From: Luiz Augusto von Dentz @ 2026-03-17 18:00 UTC (permalink / raw) To: raghava447; +Cc: linux-bluetooth Hi, On Tue, Mar 17, 2026 at 10:42 AM raghava447 <raghavendra.rao@collabora.com> wrote: > > Add an advertise submenu command for BLE Audio public broadcast profile > advertising in bluetoothctl. > > The new "public-broadcast" command reuses the existing staged AD > ServiceData field for UUID 0x1856. > It supports: > - public-broadcast sq > - public-broadcast hq > - public-broadcast Perhaps we could detect when broadcast is in use and then set the name as the public broadcast name if one is set. > The sq and hq values map to the existing raw service-data payloads: > - sq -> 0x02 0x00 > - hq -> 0x04 0x00 > > When called without arguments, the command reports the currently staged > public-broadcast state if the staged AD service UUID is 0x1856. > Else it reports that public broadcast is not set. > --- > client/advertising.c | 70 ++++++++++++++++++++++++++++++++++++++++++++ > client/advertising.h | 2 ++ > client/main.c | 19 ++++++++++++ > 3 files changed, 91 insertions(+) > > diff --git a/client/advertising.c b/client/advertising.c > index f9df1b855..30b89a404 100644 > --- a/client/advertising.c > +++ b/client/advertising.c > @@ -20,6 +20,8 @@ > #include <string.h> > #include <errno.h> > > +#include "bluetooth/bluetooth.h" > +#include "bluetooth/uuid.h" > #include "gdbus/gdbus.h" > #include "src/shared/util.h" > #include "src/shared/shell.h" > @@ -27,6 +29,7 @@ > > #define AD_PATH "/org/bluez/advertising" > #define AD_IFACE "org.bluez.LEAdvertisement1" > +#define AD_PUBLIC_BROADCAST_UUID "0x1856" > > struct ad_data { > uint8_t data[245]; > @@ -1005,6 +1008,73 @@ static void ad_clear_data(int type) > memset(&ad.data[type], 0, sizeof(ad.data[type])); > } > > +static bool ad_is_public_broadcast_uuid(const char *uuid) > +{ > + return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID); > +} > + > +static const char *ad_public_broadcast_state(void) > +{ > + if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid)) > + return NULL; > + > + if (ad.service[AD_TYPE_AD].data.len != 2) > + return NULL; > + > + if (ad.service[AD_TYPE_AD].data.data[0] == 0x02 && > + ad.service[AD_TYPE_AD].data.data[1] == 0x00) > + return "sq"; > + > + if (ad.service[AD_TYPE_AD].data.data[0] == 0x04 && > + ad.service[AD_TYPE_AD].data.data[1] == 0x00) > + return "hq"; > + > + return NULL; > +} > + > +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, char *argv[]) > +{ > + struct ad_data data = { > + .data = { 0x00, 0x00 }, > + .len = 2, > + }; > + const char *state; > + > + if (argc < 2) { > + state = ad_public_broadcast_state(); > + if (state) > + bt_shell_printf("Public Broadcast: %s\n", state); > + else > + bt_shell_printf("Public Broadcast not set\n"); > + > + return bt_shell_noninteractive_quit(EXIT_SUCCESS); > + } > + > + if (!strlen(argv[1])) { > + bt_shell_printf("Public broadcast value cannot be empty\n"); > + return bt_shell_noninteractive_quit(EXIT_FAILURE); > + } > + > + if (!strcasecmp(argv[1], "sq")) > + data.data[0] = 0x02; > + else if (!strcasecmp(argv[1], "hq")) > + data.data[0] = 0x04; > + else { > + bt_shell_printf("Invalid argument: accepted values are sq or hq\n"); > + return bt_shell_noninteractive_quit(EXIT_FAILURE); > + } > + > + ad_clear_service(AD_TYPE_AD); > + > + ad.service[AD_TYPE_AD].uuid = g_strdup(AD_PUBLIC_BROADCAST_UUID); > + ad.service[AD_TYPE_AD].data = data; > + > + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, > + prop_names.service[AD_TYPE_AD]); > + > + return bt_shell_noninteractive_quit(EXIT_SUCCESS); > +} > + > void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]) > { > char *endptr = NULL; > diff --git a/client/advertising.h b/client/advertising.h > index 9d124c7af..8c3fd041b 100644 > --- a/client/advertising.h > +++ b/client/advertising.h > @@ -34,6 +34,8 @@ void ad_advertise_local_appearance(DBusConnection *conn, long int *value); > void ad_advertise_duration(DBusConnection *conn, long int *value); > void ad_advertise_timeout(DBusConnection *conn, long int *value); > void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]); > +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, > + char *argv[]); > void ad_disable_data(DBusConnection *conn, int type); > void ad_advertise_discoverable(DBusConnection *conn, dbus_bool_t *value); > void ad_advertise_discoverable_timeout(DBusConnection *conn, long int *value); > diff --git a/client/main.c b/client/main.c > index cb016a579..0e050b373 100644 > --- a/client/main.c > +++ b/client/main.c > @@ -2892,6 +2892,17 @@ static char *ad_generator(const char *text, int state) > return argument_generator(text, state, ad_arguments); > } > > +static const char *public_broadcast_arguments[] = { > + "sq", > + "hq", > + NULL > +}; > + > +static char *public_broadcast_generator(const char *text, int state) > +{ > + return argument_generator(text, state, public_broadcast_arguments); > +} > + > static void cmd_advertise_uuids(int argc, char *argv[]) > { > ad_advertise_uuids(dbus_conn, AD_TYPE_AD, argc, argv); > @@ -2917,6 +2928,11 @@ static void cmd_advertise_data(int argc, char *argv[]) > ad_advertise_data(dbus_conn, AD_TYPE_AD, argc, argv); > } > > +static void cmd_advertise_public_broadcast(int argc, char *argv[]) > +{ > + ad_advertise_public_broadcast(dbus_conn, argc, argv); > +} > + > static void cmd_advertise_sr_uuids(int argc, char *argv[]) > { > ad_advertise_uuids(dbus_conn, AD_TYPE_SRD, argc, argv); > @@ -3600,6 +3616,9 @@ static const struct bt_shell_menu advertise_menu = { > "Set/Get advertise manufacturer data" }, > { "data", "[type] [data=xx xx ...]", cmd_advertise_data, > "Set/Get advertise data" }, > + { "public-broadcast", "[sq/hq]", cmd_advertise_public_broadcast, > + "Set/Get BLE Audio Public Broadcast Announcement", > + public_broadcast_generator }, > { "sr-uuids", "[uuid1 uuid2 ...]", cmd_advertise_sr_uuids, > "Set/Get scan response uuids" }, > { "sr-solicit", "[uuid1 uuid2 ...]", cmd_advertise_sr_solicit, > -- > 2.53.0 > > -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH BlueZ 1/1] client: Add public-broadcast profile advertise command 2026-03-17 18:00 ` [PATCH BlueZ 1/1] client: Add public-broadcast profile advertise command Luiz Augusto von Dentz @ 2026-03-20 8:34 ` raghava447 0 siblings, 0 replies; 25+ messages in thread From: raghava447 @ 2026-03-20 8:34 UTC (permalink / raw) To: linux-bluetooth; +Cc: Raghavendra Rao From: Raghavendra Rao <raghavendra.rao@collabora.com> Thanks for the suggestion. My intention with this patch was to keep it limited to the semantic helper for the Public Broadcast Announcement service. I can work on a follow-up patch to integrate the broadcast name handling so that when public broadcast is in use, a configured name can also be staged as the Public Broadcast Name AD field. ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH BlueZ v2 0/2] client: Add public broadcast advertising support 2026-03-17 14:26 [PATCH BlueZ 0/1] client: add public-broadcast advertise helper raghava447 2026-03-17 14:26 ` [PATCH BlueZ 1/1] client: Add public-broadcast profile advertise command raghava447 @ 2026-04-24 14:18 ` raghu447 2026-04-24 14:18 ` [PATCH v2 1/2] client: add public-broadcast advertising command raghu447 2026-04-24 14:18 ` [PATCH v2 2/2] client: make advertise.name use public broadcast name raghu447 1 sibling, 2 replies; 25+ messages in thread From: raghu447 @ 2026-04-24 14:18 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghavendra From: raghavendra <raghavendra.rao@collabora.com> This series adds support for staging Public Broadcast Announcement advertising data used during LE Audio public broadcast qualification. Patch 1 adds a public-broadcast command to the advertise submenu. The command stages Public Broadcast Announcement ServiceData using UUID 0x1856 and supports SQ and HQ presets. Patch 2 makes advertise.name broadcast-aware. When Public Broadcast Announcement ServiceData is staged, advertise.name sets and gets the Public Broadcast Name using AD type 0x30. Outside public broadcast mode, the existing LocalName behavior is preserved. raghavendra (2): client: add public-broadcast advertising command client: make advertise.name use public broadcast name client/advertising.c | 145 +++++++++++++++++++++++++++++++++++++++++++ client/advertising.h | 2 + client/main.c | 19 ++++++ 3 files changed, 166 insertions(+) -- 2.53.0 ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v2 1/2] client: add public-broadcast advertising command 2026-04-24 14:18 ` [PATCH BlueZ v2 0/2] client: Add public broadcast advertising support raghu447 @ 2026-04-24 14:18 ` raghu447 2026-04-24 14:41 ` Luiz Augusto von Dentz ` (2 more replies) 2026-04-24 14:18 ` [PATCH v2 2/2] client: make advertise.name use public broadcast name raghu447 1 sibling, 3 replies; 25+ messages in thread From: raghu447 @ 2026-04-24 14:18 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghavendra From: raghavendra <raghavendra.rao@collabora.com> --- client/advertising.c | 71 ++++++++++++++++++++++++++++++++++++++++++++ client/advertising.h | 2 ++ client/main.c | 19 ++++++++++++ 3 files changed, 92 insertions(+) diff --git a/client/advertising.c b/client/advertising.c index f9df1b855..fc51f8193 100644 --- a/client/advertising.c +++ b/client/advertising.c @@ -20,6 +20,9 @@ #include <string.h> #include <errno.h> +#include "bluetooth/bluetooth.h" +#include "bluetooth/uuid.h" + #include "gdbus/gdbus.h" #include "src/shared/util.h" #include "src/shared/shell.h" @@ -27,6 +30,7 @@ #define AD_PATH "/org/bluez/advertising" #define AD_IFACE "org.bluez.LEAdvertisement1" +#define AD_PUBLIC_BROADCAST_UUID "0x1856" struct ad_data { uint8_t data[245]; @@ -1005,6 +1009,73 @@ static void ad_clear_data(int type) memset(&ad.data[type], 0, sizeof(ad.data[type])); } +static bool ad_is_public_broadcast_uuid(const char *uuid) +{ + return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID); +} + +static const char *ad_public_broadcast_state(void) +{ + if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid)) + return NULL; + + if (ad.service[AD_TYPE_AD].data.len != 2) + return NULL; + + if (ad.service[AD_TYPE_AD].data.data[0] == 0x02 && + ad.service[AD_TYPE_AD].data.data[1] == 0x00) + return "sq"; + + if (ad.service[AD_TYPE_AD].data.data[0] == 0x04 && + ad.service[AD_TYPE_AD].data.data[1] == 0x00) + return "hq"; + + return NULL; +} + +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, char *argv[]) +{ + struct ad_data data = { + .data = { 0x00, 0x00 }, + .len = 2, + }; + const char *state; + + if (argc < 2) { + state = ad_public_broadcast_state(); + if (state) + bt_shell_printf("Public Broadcast: %s\n", state); + else + bt_shell_printf("Public Broadcast not set\n"); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + } + + if (!strlen(argv[1])) { + bt_shell_printf("Public broadcast value cannot be empty\n"); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + if (!strcasecmp(argv[1], "sq")) + data.data[0] = 0x02; + else if (!strcasecmp(argv[1], "hq")) + data.data[0] = 0x04; + else { + bt_shell_printf("Invalid argument: accepted values are sq or hq\n"); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + ad_clear_service(AD_TYPE_AD); + + ad.service[AD_TYPE_AD].uuid = g_strdup(AD_PUBLIC_BROADCAST_UUID); + ad.service[AD_TYPE_AD].data = data; + + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, + prop_names.service[AD_TYPE_AD]); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); +} + void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]) { char *endptr = NULL; diff --git a/client/advertising.h b/client/advertising.h index 9d124c7af..98f1bc524 100644 --- a/client/advertising.h +++ b/client/advertising.h @@ -34,6 +34,8 @@ void ad_advertise_local_appearance(DBusConnection *conn, long int *value); void ad_advertise_duration(DBusConnection *conn, long int *value); void ad_advertise_timeout(DBusConnection *conn, long int *value); void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]); +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, + char *argv[]); void ad_disable_data(DBusConnection *conn, int type); void ad_advertise_discoverable(DBusConnection *conn, dbus_bool_t *value); void ad_advertise_discoverable_timeout(DBusConnection *conn, long int *value); diff --git a/client/main.c b/client/main.c index 57fa13888..5fd21c80d 100644 --- a/client/main.c +++ b/client/main.c @@ -2920,6 +2920,17 @@ static char *scan_generator(const char *text, int state) return argument_generator(text, state, scan_arguments); } +static const char *public_broadcast_arguments[] = { + "sq", + "hq", + NULL +}; + +static char *public_broadcast_generator(const char *text, int state) +{ + return argument_generator(text, state, public_broadcast_arguments); +} + static void cmd_advertise(int argc, char *argv[]) { dbus_bool_t enable; @@ -2970,6 +2981,11 @@ static void cmd_advertise_data(int argc, char *argv[]) ad_advertise_data(dbus_conn, AD_TYPE_AD, argc, argv); } +static void cmd_advertise_public_broadcast(int argc, char *argv[]) +{ + ad_advertise_public_broadcast(dbus_conn, argc, argv); +} + static void cmd_advertise_sr_uuids(int argc, char *argv[]) { ad_advertise_uuids(dbus_conn, AD_TYPE_SRD, argc, argv); @@ -3653,6 +3669,9 @@ static const struct bt_shell_menu advertise_menu = { "Set/Get advertise manufacturer data" }, { "data", "[type] [data=xx xx ...]", cmd_advertise_data, "Set/Get advertise data" }, + { "public-broadcast", "[sq/hq]", cmd_advertise_public_broadcast, + "Set/Get BLE Audio Public Broadcast Announcement", + public_broadcast_generator }, { "sr-uuids", "[uuid1 uuid2 ...]", cmd_advertise_sr_uuids, "Set/Get scan response uuids" }, { "sr-solicit", "[uuid1 uuid2 ...]", cmd_advertise_sr_solicit, -- 2.53.0 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH v2 1/2] client: add public-broadcast advertising command 2026-04-24 14:18 ` [PATCH v2 1/2] client: add public-broadcast advertising command raghu447 @ 2026-04-24 14:41 ` Luiz Augusto von Dentz 2026-04-24 14:44 ` Luiz Augusto von Dentz 2026-04-24 16:23 ` client: Add public broadcast advertising support bluez.test.bot 2 siblings, 0 replies; 25+ messages in thread From: Luiz Augusto von Dentz @ 2026-04-24 14:41 UTC (permalink / raw) To: raghu447; +Cc: linux-bluetooth Hi Raghu, On Fri, Apr 24, 2026 at 10:19 AM raghu447 <raghavendra.rao@collabora.com> wrote: > > From: raghavendra <raghavendra.rao@collabora.com> > > --- > client/advertising.c | 71 ++++++++++++++++++++++++++++++++++++++++++++ > client/advertising.h | 2 ++ > client/main.c | 19 ++++++++++++ > 3 files changed, 92 insertions(+) > > diff --git a/client/advertising.c b/client/advertising.c > index f9df1b855..fc51f8193 100644 > --- a/client/advertising.c > +++ b/client/advertising.c > @@ -20,6 +20,9 @@ > #include <string.h> > #include <errno.h> > > +#include "bluetooth/bluetooth.h" > +#include "bluetooth/uuid.h" > + > #include "gdbus/gdbus.h" > #include "src/shared/util.h" > #include "src/shared/shell.h" > @@ -27,6 +30,7 @@ > > #define AD_PATH "/org/bluez/advertising" > #define AD_IFACE "org.bluez.LEAdvertisement1" > +#define AD_PUBLIC_BROADCAST_UUID "0x1856" > > struct ad_data { > uint8_t data[245]; > @@ -1005,6 +1009,73 @@ static void ad_clear_data(int type) > memset(&ad.data[type], 0, sizeof(ad.data[type])); > } > > +static bool ad_is_public_broadcast_uuid(const char *uuid) > +{ > + return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID); > +} > + > +static const char *ad_public_broadcast_state(void) > +{ > + if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid)) > + return NULL; > + > + if (ad.service[AD_TYPE_AD].data.len != 2) > + return NULL; > + > + if (ad.service[AD_TYPE_AD].data.data[0] == 0x02 && > + ad.service[AD_TYPE_AD].data.data[1] == 0x00) > + return "sq"; > + > + if (ad.service[AD_TYPE_AD].data.data[0] == 0x04 && > + ad.service[AD_TYPE_AD].data.data[1] == 0x00) > + return "hq"; > + > + return NULL; > +} > + > +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, char *argv[]) > +{ > + struct ad_data data = { > + .data = { 0x00, 0x00 }, > + .len = 2, > + }; > + const char *state; > + > + if (argc < 2) { > + state = ad_public_broadcast_state(); > + if (state) > + bt_shell_printf("Public Broadcast: %s\n", state); > + else > + bt_shell_printf("Public Broadcast not set\n"); > + > + return bt_shell_noninteractive_quit(EXIT_SUCCESS); > + } > + > + if (!strlen(argv[1])) { > + bt_shell_printf("Public broadcast value cannot be empty\n"); > + return bt_shell_noninteractive_quit(EXIT_FAILURE); > + } > + > + if (!strcasecmp(argv[1], "sq")) > + data.data[0] = 0x02; > + else if (!strcasecmp(argv[1], "hq")) > + data.data[0] = 0x04; Are these bits? If they are, let's use BIT(1) and BIT(2). > + else { > + bt_shell_printf("Invalid argument: accepted values are sq or hq\n"); > + return bt_shell_noninteractive_quit(EXIT_FAILURE); > + } > + > + ad_clear_service(AD_TYPE_AD); > + > + ad.service[AD_TYPE_AD].uuid = g_strdup(AD_PUBLIC_BROADCAST_UUID); > + ad.service[AD_TYPE_AD].data = data; > + > + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, > + prop_names.service[AD_TYPE_AD]); > + > + return bt_shell_noninteractive_quit(EXIT_SUCCESS); > +} > + > void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]) > { > char *endptr = NULL; > diff --git a/client/advertising.h b/client/advertising.h > index 9d124c7af..98f1bc524 100644 > --- a/client/advertising.h > +++ b/client/advertising.h > @@ -34,6 +34,8 @@ void ad_advertise_local_appearance(DBusConnection *conn, long int *value); > void ad_advertise_duration(DBusConnection *conn, long int *value); > void ad_advertise_timeout(DBusConnection *conn, long int *value); > void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]); > +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, > + char *argv[]); > void ad_disable_data(DBusConnection *conn, int type); > void ad_advertise_discoverable(DBusConnection *conn, dbus_bool_t *value); > void ad_advertise_discoverable_timeout(DBusConnection *conn, long int *value); > diff --git a/client/main.c b/client/main.c > index 57fa13888..5fd21c80d 100644 > --- a/client/main.c > +++ b/client/main.c > @@ -2920,6 +2920,17 @@ static char *scan_generator(const char *text, int state) > return argument_generator(text, state, scan_arguments); > } > > +static const char *public_broadcast_arguments[] = { > + "sq", > + "hq", > + NULL > +}; I wonder if we should have better names for these, Android seems to have a setting for compatibility, not sure exactly what it means in terms of adv settings though. > + > +static char *public_broadcast_generator(const char *text, int state) > +{ > + return argument_generator(text, state, public_broadcast_arguments); > +} > + > static void cmd_advertise(int argc, char *argv[]) > { > dbus_bool_t enable; > @@ -2970,6 +2981,11 @@ static void cmd_advertise_data(int argc, char *argv[]) > ad_advertise_data(dbus_conn, AD_TYPE_AD, argc, argv); > } > > +static void cmd_advertise_public_broadcast(int argc, char *argv[]) > +{ > + ad_advertise_public_broadcast(dbus_conn, argc, argv); > +} > + > static void cmd_advertise_sr_uuids(int argc, char *argv[]) > { > ad_advertise_uuids(dbus_conn, AD_TYPE_SRD, argc, argv); > @@ -3653,6 +3669,9 @@ static const struct bt_shell_menu advertise_menu = { > "Set/Get advertise manufacturer data" }, > { "data", "[type] [data=xx xx ...]", cmd_advertise_data, > "Set/Get advertise data" }, > + { "public-broadcast", "[sq/hq]", cmd_advertise_public_broadcast, > + "Set/Get BLE Audio Public Broadcast Announcement", > + public_broadcast_generator }, > { "sr-uuids", "[uuid1 uuid2 ...]", cmd_advertise_sr_uuids, > "Set/Get scan response uuids" }, > { "sr-solicit", "[uuid1 uuid2 ...]", cmd_advertise_sr_solicit, > -- > 2.53.0 > > -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 1/2] client: add public-broadcast advertising command 2026-04-24 14:18 ` [PATCH v2 1/2] client: add public-broadcast advertising command raghu447 2026-04-24 14:41 ` Luiz Augusto von Dentz @ 2026-04-24 14:44 ` Luiz Augusto von Dentz [not found] ` <19dd4843cc9.16a62f4c253537.8494966934612526917@collabora.com> 2026-04-24 16:23 ` client: Add public broadcast advertising support bluez.test.bot 2 siblings, 1 reply; 25+ messages in thread From: Luiz Augusto von Dentz @ 2026-04-24 14:44 UTC (permalink / raw) To: raghu447; +Cc: linux-bluetooth Hi, On Fri, Apr 24, 2026 at 10:19 AM raghu447 <raghavendra.rao@collabora.com> wrote: > > From: raghavendra <raghavendra.rao@collabora.com> > > --- > client/advertising.c | 71 ++++++++++++++++++++++++++++++++++++++++++++ > client/advertising.h | 2 ++ > client/main.c | 19 ++++++++++++ > 3 files changed, 92 insertions(+) > > diff --git a/client/advertising.c b/client/advertising.c > index f9df1b855..fc51f8193 100644 > --- a/client/advertising.c > +++ b/client/advertising.c > @@ -20,6 +20,9 @@ > #include <string.h> > #include <errno.h> > > +#include "bluetooth/bluetooth.h" > +#include "bluetooth/uuid.h" > + > #include "gdbus/gdbus.h" > #include "src/shared/util.h" > #include "src/shared/shell.h" > @@ -27,6 +30,7 @@ > > #define AD_PATH "/org/bluez/advertising" > #define AD_IFACE "org.bluez.LEAdvertisement1" > +#define AD_PUBLIC_BROADCAST_UUID "0x1856" Forgot to mention, we don't seem to have a decoder for 0x1856, would you like to create one so we can actually see what is being programmed on btmon? That will probably require extending the monitor/packet.c:service_data_decoders > struct ad_data { > uint8_t data[245]; > @@ -1005,6 +1009,73 @@ static void ad_clear_data(int type) > memset(&ad.data[type], 0, sizeof(ad.data[type])); > } > > +static bool ad_is_public_broadcast_uuid(const char *uuid) > +{ > + return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID); > +} > + > +static const char *ad_public_broadcast_state(void) > +{ > + if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid)) > + return NULL; > + > + if (ad.service[AD_TYPE_AD].data.len != 2) > + return NULL; > + > + if (ad.service[AD_TYPE_AD].data.data[0] == 0x02 && > + ad.service[AD_TYPE_AD].data.data[1] == 0x00) > + return "sq"; > + > + if (ad.service[AD_TYPE_AD].data.data[0] == 0x04 && > + ad.service[AD_TYPE_AD].data.data[1] == 0x00) > + return "hq"; > + > + return NULL; > +} > + > +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, char *argv[]) > +{ > + struct ad_data data = { > + .data = { 0x00, 0x00 }, > + .len = 2, > + }; > + const char *state; > + > + if (argc < 2) { > + state = ad_public_broadcast_state(); > + if (state) > + bt_shell_printf("Public Broadcast: %s\n", state); > + else > + bt_shell_printf("Public Broadcast not set\n"); > + > + return bt_shell_noninteractive_quit(EXIT_SUCCESS); > + } > + > + if (!strlen(argv[1])) { > + bt_shell_printf("Public broadcast value cannot be empty\n"); > + return bt_shell_noninteractive_quit(EXIT_FAILURE); > + } > + > + if (!strcasecmp(argv[1], "sq")) > + data.data[0] = 0x02; > + else if (!strcasecmp(argv[1], "hq")) > + data.data[0] = 0x04; > + else { > + bt_shell_printf("Invalid argument: accepted values are sq or hq\n"); > + return bt_shell_noninteractive_quit(EXIT_FAILURE); > + } > + > + ad_clear_service(AD_TYPE_AD); > + > + ad.service[AD_TYPE_AD].uuid = g_strdup(AD_PUBLIC_BROADCAST_UUID); > + ad.service[AD_TYPE_AD].data = data; > + > + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, > + prop_names.service[AD_TYPE_AD]); > + > + return bt_shell_noninteractive_quit(EXIT_SUCCESS); > +} > + > void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]) > { > char *endptr = NULL; > diff --git a/client/advertising.h b/client/advertising.h > index 9d124c7af..98f1bc524 100644 > --- a/client/advertising.h > +++ b/client/advertising.h > @@ -34,6 +34,8 @@ void ad_advertise_local_appearance(DBusConnection *conn, long int *value); > void ad_advertise_duration(DBusConnection *conn, long int *value); > void ad_advertise_timeout(DBusConnection *conn, long int *value); > void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]); > +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, > + char *argv[]); > void ad_disable_data(DBusConnection *conn, int type); > void ad_advertise_discoverable(DBusConnection *conn, dbus_bool_t *value); > void ad_advertise_discoverable_timeout(DBusConnection *conn, long int *value); > diff --git a/client/main.c b/client/main.c > index 57fa13888..5fd21c80d 100644 > --- a/client/main.c > +++ b/client/main.c > @@ -2920,6 +2920,17 @@ static char *scan_generator(const char *text, int state) > return argument_generator(text, state, scan_arguments); > } > > +static const char *public_broadcast_arguments[] = { > + "sq", > + "hq", > + NULL > +}; > + > +static char *public_broadcast_generator(const char *text, int state) > +{ > + return argument_generator(text, state, public_broadcast_arguments); > +} > + > static void cmd_advertise(int argc, char *argv[]) > { > dbus_bool_t enable; > @@ -2970,6 +2981,11 @@ static void cmd_advertise_data(int argc, char *argv[]) > ad_advertise_data(dbus_conn, AD_TYPE_AD, argc, argv); > } > > +static void cmd_advertise_public_broadcast(int argc, char *argv[]) > +{ > + ad_advertise_public_broadcast(dbus_conn, argc, argv); > +} > + > static void cmd_advertise_sr_uuids(int argc, char *argv[]) > { > ad_advertise_uuids(dbus_conn, AD_TYPE_SRD, argc, argv); > @@ -3653,6 +3669,9 @@ static const struct bt_shell_menu advertise_menu = { > "Set/Get advertise manufacturer data" }, > { "data", "[type] [data=xx xx ...]", cmd_advertise_data, > "Set/Get advertise data" }, > + { "public-broadcast", "[sq/hq]", cmd_advertise_public_broadcast, > + "Set/Get BLE Audio Public Broadcast Announcement", > + public_broadcast_generator }, > { "sr-uuids", "[uuid1 uuid2 ...]", cmd_advertise_sr_uuids, > "Set/Get scan response uuids" }, > { "sr-solicit", "[uuid1 uuid2 ...]", cmd_advertise_sr_solicit, > -- > 2.53.0 > > -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <19dd4843cc9.16a62f4c253537.8494966934612526917@collabora.com>]
* Re: [PATCH v2 1/2] client: add public-broadcast advertising command [not found] ` <19dd4843cc9.16a62f4c253537.8494966934612526917@collabora.com> @ 2026-04-28 14:42 ` Luiz Augusto von Dentz 0 siblings, 0 replies; 25+ messages in thread From: Luiz Augusto von Dentz @ 2026-04-28 14:42 UTC (permalink / raw) To: Raghavendra Rao; +Cc: linux-bluetooth Hi Raghavendra, On Tue, Apr 28, 2026 at 10:35 AM Raghavendra Rao <raghavendra.rao@collabora.com> wrote: > > Hello Luiz, > > I agree that adding a decoder for UUID 0x1856 would be useful. > I would like to work on that and send it as a follow-up patch. Too late, Ive already send a patch to address it: https://patchwork.kernel.org/project/bluetooth/patch/20260427192223.2875358-1-luiz.dentz@gmail.com/ > > Thanks & Regards, > Raghavendra > > > > From: Luiz Augusto von Dentz <luiz.dentz@gmail.com> > To: "raghu447"<raghavendra.rao@collabora.com> > Cc: <linux-bluetooth@vger.kernel.org> > Date: Fri, 24 Apr 2026 20:14:00 +0530 > Subject: Re: [PATCH v2 1/2] client: add public-broadcast advertising command > > Hi, > > On Fri, Apr 24, 2026 at 10:19 AM raghu447 <raghavendra.rao@collabora.com> wrote: > > > > From: raghavendra <raghavendra.rao@collabora.com> > > > > --- > > client/advertising.c | 71 ++++++++++++++++++++++++++++++++++++++++++++ > > client/advertising.h | 2 ++ > > client/main.c | 19 ++++++++++++ > > 3 files changed, 92 insertions(+) > > > > diff --git a/client/advertising.c b/client/advertising.c > > index f9df1b855..fc51f8193 100644 > > --- a/client/advertising.c > > +++ b/client/advertising.c > > @@ -20,6 +20,9 @@ > > #include <string.h> > > #include <errno.h> > > > > +#include "bluetooth/bluetooth.h" > > +#include "bluetooth/uuid.h" > > + > > #include "gdbus/gdbus.h" > > #include "src/shared/util.h" > > #include "src/shared/shell.h" > > @@ -27,6 +30,7 @@ > > > > #define AD_PATH "/org/bluez/advertising" > > #define AD_IFACE "org.bluez.LEAdvertisement1" > > +#define AD_PUBLIC_BROADCAST_UUID "0x1856" > > Forgot to mention, we don't seem to have a decoder for 0x1856, would > you like to create one so we can actually see what is being programmed > on btmon? That will probably require extending the > monitor/packet.c:service_data_decoders > > > struct ad_data { > > uint8_t data[245]; > > @@ -1005,6 +1009,73 @@ static void ad_clear_data(int type) > > memset(&ad.data[type], 0, sizeof(ad.data[type])); > > } > > > > +static bool ad_is_public_broadcast_uuid(const char *uuid) > > +{ > > + return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID); > > +} > > + > > +static const char *ad_public_broadcast_state(void) > > +{ > > + if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid)) > > + return NULL; > > + > > + if (ad.service[AD_TYPE_AD].data.len != 2) > > + return NULL; > > + > > + if (ad.service[AD_TYPE_AD].data.data[0] == 0x02 && > > + ad.service[AD_TYPE_AD].data.data[1] == 0x00) > > + return "sq"; > > + > > + if (ad.service[AD_TYPE_AD].data.data[0] == 0x04 && > > + ad.service[AD_TYPE_AD].data.data[1] == 0x00) > > + return "hq"; > > + > > + return NULL; > > +} > > + > > +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, char *argv[]) > > +{ > > + struct ad_data data = { > > + .data = { 0x00, 0x00 }, > > + .len = 2, > > + }; > > + const char *state; > > + > > + if (argc < 2) { > > + state = ad_public_broadcast_state(); > > + if (state) > > + bt_shell_printf("Public Broadcast: %s\n", state); > > + else > > + bt_shell_printf("Public Broadcast not set\n"); > > + > > + return bt_shell_noninteractive_quit(EXIT_SUCCESS); > > + } > > + > > + if (!strlen(argv[1])) { > > + bt_shell_printf("Public broadcast value cannot be empty\n"); > > + return bt_shell_noninteractive_quit(EXIT_FAILURE); > > + } > > + > > + if (!strcasecmp(argv[1], "sq")) > > + data.data[0] = 0x02; > > + else if (!strcasecmp(argv[1], "hq")) > > + data.data[0] = 0x04; > > + else { > > + bt_shell_printf("Invalid argument: accepted values are sq or hq\n"); > > + return bt_shell_noninteractive_quit(EXIT_FAILURE); > > + } > > + > > + ad_clear_service(AD_TYPE_AD); > > + > > + ad.service[AD_TYPE_AD].uuid = g_strdup(AD_PUBLIC_BROADCAST_UUID); > > + ad.service[AD_TYPE_AD].data = data; > > + > > + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, > > + prop_names.service[AD_TYPE_AD]); > > + > > + return bt_shell_noninteractive_quit(EXIT_SUCCESS); > > +} > > + > > void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]) > > { > > char *endptr = NULL; > > diff --git a/client/advertising.h b/client/advertising.h > > index 9d124c7af..98f1bc524 100644 > > --- a/client/advertising.h > > +++ b/client/advertising.h > > @@ -34,6 +34,8 @@ void ad_advertise_local_appearance(DBusConnection *conn, long int *value); > > void ad_advertise_duration(DBusConnection *conn, long int *value); > > void ad_advertise_timeout(DBusConnection *conn, long int *value); > > void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]); > > +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, > > + char *argv[]); > > void ad_disable_data(DBusConnection *conn, int type); > > void ad_advertise_discoverable(DBusConnection *conn, dbus_bool_t *value); > > void ad_advertise_discoverable_timeout(DBusConnection *conn, long int *value); > > diff --git a/client/main.c b/client/main.c > > index 57fa13888..5fd21c80d 100644 > > --- a/client/main.c > > +++ b/client/main.c > > @@ -2920,6 +2920,17 @@ static char *scan_generator(const char *text, int state) > > return argument_generator(text, state, scan_arguments); > > } > > > > +static const char *public_broadcast_arguments[] = { > > + "sq", > > + "hq", > > + NULL > > +}; > > + > > +static char *public_broadcast_generator(const char *text, int state) > > +{ > > + return argument_generator(text, state, public_broadcast_arguments); > > +} > > + > > static void cmd_advertise(int argc, char *argv[]) > > { > > dbus_bool_t enable; > > @@ -2970,6 +2981,11 @@ static void cmd_advertise_data(int argc, char *argv[]) > > ad_advertise_data(dbus_conn, AD_TYPE_AD, argc, argv); > > } > > > > +static void cmd_advertise_public_broadcast(int argc, char *argv[]) > > +{ > > + ad_advertise_public_broadcast(dbus_conn, argc, argv); > > +} > > + > > static void cmd_advertise_sr_uuids(int argc, char *argv[]) > > { > > ad_advertise_uuids(dbus_conn, AD_TYPE_SRD, argc, argv); > > @@ -3653,6 +3669,9 @@ static const struct bt_shell_menu advertise_menu = { > > "Set/Get advertise manufacturer data" }, > > { "data", "[type] [data=xx xx ...]", cmd_advertise_data, > > "Set/Get advertise data" }, > > + { "public-broadcast", "[sq/hq]", cmd_advertise_public_broadcast, > > + "Set/Get BLE Audio Public Broadcast Announcement", > > + public_broadcast_generator }, > > { "sr-uuids", "[uuid1 uuid2 ...]", cmd_advertise_sr_uuids, > > "Set/Get scan response uuids" }, > > { "sr-solicit", "[uuid1 uuid2 ...]", cmd_advertise_sr_solicit, > > -- > > 2.53.0 > > > > > > > -- > Luiz Augusto von Dentz > > > -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 25+ messages in thread
* RE: client: Add public broadcast advertising support 2026-04-24 14:18 ` [PATCH v2 1/2] client: add public-broadcast advertising command raghu447 2026-04-24 14:41 ` Luiz Augusto von Dentz 2026-04-24 14:44 ` Luiz Augusto von Dentz @ 2026-04-24 16:23 ` bluez.test.bot 2 siblings, 0 replies; 25+ messages in thread From: bluez.test.bot @ 2026-04-24 16:23 UTC (permalink / raw) To: linux-bluetooth, raghavendra.rao [-- Attachment #1: Type: text/plain, Size: 12505 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=1085227 ---Test result--- Test Summary: CheckPatch FAIL 1.30 seconds GitLint PASS 0.67 seconds BuildEll PASS 19.93 seconds BluezMake PASS 604.72 seconds CheckSmatch PASS 318.76 seconds bluezmakeextell PASS 162.72 seconds IncrementalBuild PASS 597.91 seconds ScanBuild PASS 910.00 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script Output: [v2,1/2] client: add public-broadcast advertising command WARNING:LEADING_SPACE: please, no spaces at the start of a line #106: FILE: client/advertising.c:1014: + return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #111: FILE: client/advertising.c:1019: + if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid))$ ERROR:CODE_INDENT: code indent should use tabs where possible #112: FILE: client/advertising.c:1020: + return NULL;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #112: FILE: client/advertising.c:1020: + return NULL;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #114: FILE: client/advertising.c:1022: + if (ad.service[AD_TYPE_AD].data.len != 2)$ ERROR:CODE_INDENT: code indent should use tabs where possible #115: FILE: client/advertising.c:1023: + return NULL;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #115: FILE: client/advertising.c:1023: + return NULL;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #117: FILE: client/advertising.c:1025: + if (ad.service[AD_TYPE_AD].data.data[0] == 0x02 &&$ ERROR:CODE_INDENT: code indent should use tabs where possible #118: FILE: client/advertising.c:1026: + ad.service[AD_TYPE_AD].data.data[1] == 0x00)$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #118: FILE: client/advertising.c:1026: + ad.service[AD_TYPE_AD].data.data[1] == 0x00)$ ERROR:CODE_INDENT: code indent should use tabs where possible #119: FILE: client/advertising.c:1027: + return "sq";$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #119: FILE: client/advertising.c:1027: + return "sq";$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #121: FILE: client/advertising.c:1029: + if (ad.service[AD_TYPE_AD].data.data[0] == 0x04 &&$ ERROR:CODE_INDENT: code indent should use tabs where possible #122: FILE: client/advertising.c:1030: + ad.service[AD_TYPE_AD].data.data[1] == 0x00)$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #122: FILE: client/advertising.c:1030: + ad.service[AD_TYPE_AD].data.data[1] == 0x00)$ ERROR:CODE_INDENT: code indent should use tabs where possible #123: FILE: client/advertising.c:1031: + return "hq";$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #123: FILE: client/advertising.c:1031: + return "hq";$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #125: FILE: client/advertising.c:1033: + return NULL;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #130: FILE: client/advertising.c:1038: + struct ad_data data = {$ ERROR:CODE_INDENT: code indent should use tabs where possible #131: FILE: client/advertising.c:1039: + .data = { 0x00, 0x00 },$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #131: FILE: client/advertising.c:1039: + .data = { 0x00, 0x00 },$ ERROR:CODE_INDENT: code indent should use tabs where possible #132: FILE: client/advertising.c:1040: + .len = 2,$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #132: FILE: client/advertising.c:1040: + .len = 2,$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #133: FILE: client/advertising.c:1041: + };$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #134: FILE: client/advertising.c:1042: + const char *state;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #136: FILE: client/advertising.c:1044: + if (argc < 2) {$ ERROR:CODE_INDENT: code indent should use tabs where possible #137: FILE: client/advertising.c:1045: + state = ad_public_broadcast_state();$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #137: FILE: client/advertising.c:1045: + state = ad_public_broadcast_state();$ WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (16, 12) #138: FILE: client/advertising.c:1046: + if (state) + bt_shell_printf("Public Broadcast: %s\n", state); ERROR:CODE_INDENT: code indent should use tabs where possible #139: FILE: client/advertising.c:1047: + bt_shell_printf("Public Broadcast: %s\n", state);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #139: FILE: client/advertising.c:1047: + bt_shell_printf("Public Broadcast: %s\n", state);$ ERROR:CODE_INDENT: code indent should use tabs where possible #140: FILE: client/advertising.c:1048: + else$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #140: FILE: client/advertising.c:1048: + else$ WARNING:SUSPECT_CODE_INDENT: suspect code indent for conditional statements (8, 12) #140: FILE: client/advertising.c:1048: + else + bt_shell_printf("Public Broadcast not set\n"); ERROR:CODE_INDENT: code indent should use tabs where possible #141: FILE: client/advertising.c:1049: + bt_shell_printf("Public Broadcast not set\n");$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #141: FILE: client/advertising.c:1049: + bt_shell_printf("Public Broadcast not set\n");$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #144: FILE: client/advertising.c:1052: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #146: FILE: client/advertising.c:1054: + if (!strlen(argv[1])) {$ ERROR:CODE_INDENT: code indent should use tabs where possible #147: FILE: client/advertising.c:1055: + bt_shell_printf("Public broadcast value cannot be empty\n");$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #147: FILE: client/advertising.c:1055: + bt_shell_printf("Public broadcast value cannot be empty\n");$ ERROR:CODE_INDENT: code indent should use tabs where possible #148: FILE: client/advertising.c:1056: + return bt_shell_noninteractive_quit(EXIT_FAILURE);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #148: FILE: client/advertising.c:1056: + return bt_shell_noninteractive_quit(EXIT_FAILURE);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #149: FILE: client/advertising.c:1057: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #151: FILE: client/advertising.c:1059: + if (!strcasecmp(argv[1], "sq"))$ ERROR:CODE_INDENT: code indent should use tabs where possible #152: FILE: client/advertising.c:1060: + data.data[0] = 0x02;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #152: FILE: client/advertising.c:1060: + data.data[0] = 0x02;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #153: FILE: client/advertising.c:1061: + else if (!strcasecmp(argv[1], "hq"))$ ERROR:CODE_INDENT: code indent should use tabs where possible #154: FILE: client/advertising.c:1062: + data.data[0] = 0x04;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #154: FILE: client/advertising.c:1062: + data.data[0] = 0x04;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #155: FILE: client/advertising.c:1063: + else {$ ERROR:CODE_INDENT: code indent should use tabs where possible #156: FILE: client/advertising.c:1064: + bt_shell_printf("Invalid argument: accepted values are sq or hq\n");$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #156: FILE: client/advertising.c:1064: + bt_shell_printf("Invalid argument: accepted values are sq or hq\n");$ ERROR:CODE_INDENT: code indent should use tabs where possible #157: FILE: client/advertising.c:1065: + return bt_shell_noninteractive_quit(EXIT_FAILURE);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #157: FILE: client/advertising.c:1065: + return bt_shell_noninteractive_quit(EXIT_FAILURE);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #158: FILE: client/advertising.c:1066: + }$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #160: FILE: client/advertising.c:1068: + ad_clear_service(AD_TYPE_AD);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #162: FILE: client/advertising.c:1070: + ad.service[AD_TYPE_AD].uuid = g_strdup(AD_PUBLIC_BROADCAST_UUID);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #163: FILE: client/advertising.c:1071: + ad.service[AD_TYPE_AD].data = data;$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #165: FILE: client/advertising.c:1073: + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE,$ ERROR:CODE_INDENT: code indent should use tabs where possible #166: FILE: client/advertising.c:1074: + prop_names.service[AD_TYPE_AD]);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #166: FILE: client/advertising.c:1074: + prop_names.service[AD_TYPE_AD]);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #168: FILE: client/advertising.c:1076: + return bt_shell_noninteractive_quit(EXIT_SUCCESS);$ ERROR:CODE_INDENT: code indent should use tabs where possible #183: FILE: client/advertising.h:38: + char *argv[]);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #183: FILE: client/advertising.h:38: + char *argv[]);$ WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const #195: FILE: client/main.c:2923: +static const char *public_broadcast_arguments[] = { WARNING:LEADING_SPACE: please, no spaces at the start of a line #196: FILE: client/main.c:2924: + "sq",$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #197: FILE: client/main.c:2925: + "hq",$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #198: FILE: client/main.c:2926: + NULL$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #203: FILE: client/main.c:2931: + return argument_generator(text, state, public_broadcast_arguments);$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #215: FILE: client/main.c:2986: + ad_advertise_public_broadcast(dbus_conn, argc, argv);$ ERROR:CODE_INDENT: code indent should use tabs where possible #226: FILE: client/main.c:3673: + "Set/Get BLE Audio Public Broadcast Announcement",$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #226: FILE: client/main.c:3673: + "Set/Get BLE Audio Public Broadcast Announcement",$ ERROR:CODE_INDENT: code indent should use tabs where possible #227: FILE: client/main.c:3674: + public_broadcast_generator },$ WARNING:LEADING_SPACE: please, no spaces at the start of a line #227: FILE: client/main.c:3674: + public_broadcast_generator },$ /github/workspace/src/patch/14537907.patch total: 22 errors, 52 warnings, 134 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. NOTE: Whitespace errors detected. You may wish to use scripts/cleanpatch or scripts/cleanfile /github/workspace/src/patch/14537907.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. https://github.com/bluez/bluez/pull/2069 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v2 2/2] client: make advertise.name use public broadcast name 2026-04-24 14:18 ` [PATCH BlueZ v2 0/2] client: Add public broadcast advertising support raghu447 2026-04-24 14:18 ` [PATCH v2 1/2] client: add public-broadcast advertising command raghu447 @ 2026-04-24 14:18 ` raghu447 2026-04-28 14:40 ` [PATCH BlueZ v3 0/2] client: Add public broadcast advertising support raghu447 1 sibling, 1 reply; 25+ messages in thread From: raghu447 @ 2026-04-24 14:18 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghavendra From: raghavendra <raghavendra.rao@collabora.com> --- client/advertising.c | 74 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/client/advertising.c b/client/advertising.c index fc51f8193..6921bedec 100644 --- a/client/advertising.c +++ b/client/advertising.c @@ -31,6 +31,7 @@ #define AD_PATH "/org/bluez/advertising" #define AD_IFACE "org.bluez.LEAdvertisement1" #define AD_PUBLIC_BROADCAST_UUID "0x1856" +#define AD_TYPE_PUBLIC_BROADCAST_NAME 0x30 struct ad_data { uint8_t data[245]; @@ -1014,6 +1015,62 @@ static bool ad_is_public_broadcast_uuid(const char *uuid) return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID); } +static bool ad_broadcast_in_use(void) +{ + return ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid); +} + +static bool ad_has_public_broadcast_name(void) +{ + return ad.data[AD_TYPE_AD].valid && + ad.data[AD_TYPE_AD].type == AD_TYPE_PUBLIC_BROADCAST_NAME && + ad.data[AD_TYPE_AD].data.len > 0; +} + +static void ad_print_public_broadcast_name(void) +{ + if (!ad_has_public_broadcast_name()) { + bt_shell_printf("Public Broadcast Name not set\n"); + return; + } + + bt_shell_printf("Public Broadcast Name: %.*s\n", + (int) ad.data[AD_TYPE_AD].data.len, + (char *) ad.data[AD_TYPE_AD].data.data); +} + +static bool ad_set_public_broadcast_name(DBusConnection *conn, + const char *name) +{ + struct ad_data data; + size_t len; + + if (!name || !strlen(name)) { + bt_shell_printf("Public Broadcast Name cannot be empty\n"); + return false; + } + + len = strlen(name); + if (len > sizeof(data.data)) { + bt_shell_printf("Public Broadcast Name too long\n"); + return false; + } + + memset(&data, 0, sizeof(data)); + memcpy(data.data, name, len); + data.len = len; + + ad_clear_data(AD_TYPE_AD); + ad.data[AD_TYPE_AD].valid = true; + ad.data[AD_TYPE_AD].type = AD_TYPE_PUBLIC_BROADCAST_NAME; + ad.data[AD_TYPE_AD].data = data; + + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, + prop_names.data[AD_TYPE_AD]); + + return true; +} + static const char *ad_public_broadcast_state(void) { if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid)) @@ -1200,6 +1257,23 @@ void ad_advertise_name(DBusConnection *conn, bool value) void ad_advertise_local_name(DBusConnection *conn, const char *name) { + if (ad_broadcast_in_use()) { + if (!name) { + ad_print_public_broadcast_name(); + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + } + + if (ad_has_public_broadcast_name() && + ad.data[AD_TYPE_AD].data.len == strlen(name) && + !memcmp(ad.data[AD_TYPE_AD].data.data, name, strlen(name))) + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + + if (!ad_set_public_broadcast_name(conn, name)) + return bt_shell_noninteractive_quit(EXIT_FAILURE); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + } + if (!name) { if (ad.local_name) bt_shell_printf("LocalName: %s\n", ad.local_name); -- 2.53.0 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH BlueZ v3 0/2] client: Add public broadcast advertising support 2026-04-24 14:18 ` [PATCH v2 2/2] client: make advertise.name use public broadcast name raghu447 @ 2026-04-28 14:40 ` raghu447 2026-04-28 14:40 ` [PATCH BlueZ v3 1/2] client: add public-broadcast advertising command raghu447 2026-04-28 14:40 ` [PATCH BlueZ v3 " raghu447 0 siblings, 2 replies; 25+ messages in thread From: raghu447 @ 2026-04-28 14:40 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghu447 This series adds bluetoothctl support for staging Public Broadcast Announcement advertising data used during LE Audio public broadcast qualification. Patch 1 adds a public-broadcast command to the advertise submenu. The command stages Public Broadcast Announcement ServiceData using UUID 0x1856 and supports SQ and HQ presets. Patch 2 makes advertise.name broadcast-aware. When Public Broadcast Announcement ServiceData is staged, advertise.name sets and gets the Public Broadcast Name using AD type 0x30. raghavendra (2): client: add public-broadcast advertising command client: make advertise.name use public broadcast name client/advertising.c | 147 +++++++++++++++++++++++++++++++++++++++++++ client/advertising.h | 2 + client/main.c | 19 ++++++ 3 files changed, 168 insertions(+) -- 2.43.0 ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH BlueZ v3 1/2] client: add public-broadcast advertising command 2026-04-28 14:40 ` [PATCH BlueZ v3 0/2] client: Add public broadcast advertising support raghu447 @ 2026-04-28 14:40 ` raghu447 2026-04-28 16:27 ` client: Add public broadcast advertising support bluez.test.bot 2026-04-29 6:10 ` [PATCH BlueZ v4 0/2] " raghu447 2026-04-28 14:40 ` [PATCH BlueZ v3 " raghu447 1 sibling, 2 replies; 25+ messages in thread From: raghu447 @ 2026-04-28 14:40 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghavendra From: raghavendra <raghavendra.rao@collabora.com> --- client/advertising.c | 73 ++++++++++++++++++++++++++++++++++++++++++++ client/advertising.h | 2 ++ client/main.c | 19 ++++++++++++ 3 files changed, 94 insertions(+) diff --git a/client/advertising.c b/client/advertising.c index f9df1b855..8ffbb085b 100644 --- a/client/advertising.c +++ b/client/advertising.c @@ -20,6 +20,9 @@ #include <string.h> #include <errno.h> +#include "bluetooth/bluetooth.h" +#include "bluetooth/uuid.h" + #include "gdbus/gdbus.h" #include "src/shared/util.h" #include "src/shared/shell.h" @@ -27,6 +30,9 @@ #define AD_PATH "/org/bluez/advertising" #define AD_IFACE "org.bluez.LEAdvertisement1" +#define AD_PUBLIC_BROADCAST_UUID "0x1856" +#define AD_PUBLIC_BROADCAST_SQ BIT(1) +#define AD_PUBLIC_BROADCAST_HQ BIT(2) struct ad_data { uint8_t data[245]; @@ -1005,6 +1011,73 @@ static void ad_clear_data(int type) memset(&ad.data[type], 0, sizeof(ad.data[type])); } +static bool ad_is_public_broadcast_uuid(const char *uuid) +{ + return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID); +} + +static const char *ad_public_broadcast_state(void) +{ + if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid)) + return NULL; + + if (ad.service[AD_TYPE_AD].data.len != 2) + return NULL; + + if (ad.service[AD_TYPE_AD].data.data[0] == AD_PUBLIC_BROADCAST_SQ && + ad.service[AD_TYPE_AD].data.data[1] == 0x00) + return "sq"; + + if (ad.service[AD_TYPE_AD].data.data[0] == AD_PUBLIC_BROADCAST_HQ && + ad.service[AD_TYPE_AD].data.data[1] == 0x00) + return "hq"; + + return NULL; +} + +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, char *argv[]) +{ + struct ad_data data = { + .data = { 0x00, 0x00 }, + .len = 2, + }; + const char *state; + + if (argc < 2) { + state = ad_public_broadcast_state(); + if (state) + bt_shell_printf("Public Broadcast: %s\n", state); + else + bt_shell_printf("Public Broadcast not set\n"); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + } + + if (!strlen(argv[1])) { + bt_shell_printf("Public broadcast value cannot be empty\n"); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + if (!strcasecmp(argv[1], "sq")) + data.data[0] = AD_PUBLIC_BROADCAST_SQ; + else if (!strcasecmp(argv[1], "hq")) + data.data[0] = AD_PUBLIC_BROADCAST_HQ; + else { + bt_shell_printf("Invalid argument: accepted values are sq or hq\n"); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + ad_clear_service(AD_TYPE_AD); + + ad.service[AD_TYPE_AD].uuid = g_strdup(AD_PUBLIC_BROADCAST_UUID); + ad.service[AD_TYPE_AD].data = data; + + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, + prop_names.service[AD_TYPE_AD]); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); +} + void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]) { char *endptr = NULL; diff --git a/client/advertising.h b/client/advertising.h index 9d124c7af..8c3fd041b 100644 --- a/client/advertising.h +++ b/client/advertising.h @@ -34,6 +34,8 @@ void ad_advertise_local_appearance(DBusConnection *conn, long int *value); void ad_advertise_duration(DBusConnection *conn, long int *value); void ad_advertise_timeout(DBusConnection *conn, long int *value); void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]); +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, + char *argv[]); void ad_disable_data(DBusConnection *conn, int type); void ad_advertise_discoverable(DBusConnection *conn, dbus_bool_t *value); void ad_advertise_discoverable_timeout(DBusConnection *conn, long int *value); diff --git a/client/main.c b/client/main.c index 57fa13888..6fb399277 100644 --- a/client/main.c +++ b/client/main.c @@ -2920,6 +2920,17 @@ static char *scan_generator(const char *text, int state) return argument_generator(text, state, scan_arguments); } +static const char *public_broadcast_arguments[] = { + "sq", + "hq", + NULL +}; + +static char *public_broadcast_generator(const char *text, int state) +{ + return argument_generator(text, state, public_broadcast_arguments); +} + static void cmd_advertise(int argc, char *argv[]) { dbus_bool_t enable; @@ -2970,6 +2981,11 @@ static void cmd_advertise_data(int argc, char *argv[]) ad_advertise_data(dbus_conn, AD_TYPE_AD, argc, argv); } +static void cmd_advertise_public_broadcast(int argc, char *argv[]) +{ + ad_advertise_public_broadcast(dbus_conn, argc, argv); +} + static void cmd_advertise_sr_uuids(int argc, char *argv[]) { ad_advertise_uuids(dbus_conn, AD_TYPE_SRD, argc, argv); @@ -3653,6 +3669,9 @@ static const struct bt_shell_menu advertise_menu = { "Set/Get advertise manufacturer data" }, { "data", "[type] [data=xx xx ...]", cmd_advertise_data, "Set/Get advertise data" }, + { "public-broadcast", "[sq/hq]", cmd_advertise_public_broadcast, + "Set/Get BLE Audio Public Broadcast Announcement", + public_broadcast_generator }, { "sr-uuids", "[uuid1 uuid2 ...]", cmd_advertise_sr_uuids, "Set/Get scan response uuids" }, { "sr-solicit", "[uuid1 uuid2 ...]", cmd_advertise_sr_solicit, -- 2.43.0 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* RE: client: Add public broadcast advertising support 2026-04-28 14:40 ` [PATCH BlueZ v3 1/2] client: add public-broadcast advertising command raghu447 @ 2026-04-28 16:27 ` bluez.test.bot 2026-04-29 6:10 ` [PATCH BlueZ v4 0/2] " raghu447 1 sibling, 0 replies; 25+ messages in thread From: bluez.test.bot @ 2026-04-28 16:27 UTC (permalink / raw) To: linux-bluetooth, raghavendra.rao [-- Attachment #1: Type: text/plain, Size: 1964 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=1086916 ---Test result--- Test Summary: CheckPatch FAIL 1.10 seconds GitLint PASS 0.67 seconds BuildEll PASS 20.51 seconds BluezMake PASS 620.88 seconds CheckSmatch PASS 338.52 seconds bluezmakeextell PASS 174.71 seconds IncrementalBuild PASS 622.72 seconds ScanBuild PASS 975.91 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script Output: [BlueZ,v3,1/2] client: add public-broadcast advertising command WARNING:LONG_LINE_STRING: line length of 84 exceeds 80 columns #158: FILE: client/advertising.c:1066: + bt_shell_printf("Invalid argument: accepted values are sq or hq\n"); WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const #197: FILE: client/main.c:2923: +static const char *public_broadcast_arguments[] = { /github/workspace/src/patch/14544460.patch total: 0 errors, 2 warnings, 136 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/patch/14544460.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. https://github.com/bluez/bluez/pull/2081 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH BlueZ v4 0/2] client: Add public broadcast advertising support 2026-04-28 14:40 ` [PATCH BlueZ v3 1/2] client: add public-broadcast advertising command raghu447 2026-04-28 16:27 ` client: Add public broadcast advertising support bluez.test.bot @ 2026-04-29 6:10 ` raghu447 2026-04-29 6:10 ` [PATCH BlueZ v4 1/2] client: add public-broadcast advertising command raghu447 2026-04-29 6:10 ` [PATCH BlueZ v4 2/2] client: make advertise.name use public broadcast name raghu447 1 sibling, 2 replies; 25+ messages in thread From: raghu447 @ 2026-04-29 6:10 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghu447 This series adds bluetoothctl support for staging Public Broadcast Announcement advertising data used during LE Audio public broadcast qualification. Patch 1 adds a public-broadcast command to the advertise submenu. The command stages Public Broadcast Announcement ServiceData using UUID 0x1856 and supports SQ and HQ presets. Patch 2 makes advertise.name broadcast-aware. When Public Broadcast Announcement ServiceData is staged, advertise.name sets and gets the Public Broadcast Name using AD type 0x30. Outside public broadcast mode, the existing LocalName behavior is preserved. raghavendra (2): client: add public-broadcast advertising command client: make advertise.name use public broadcast name client/advertising.c | 148 +++++++++++++++++++++++++++++++++++++++++++ client/advertising.h | 2 + client/main.c | 19 ++++++ 3 files changed, 169 insertions(+) -- 2.43.0 ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH BlueZ v4 1/2] client: add public-broadcast advertising command 2026-04-29 6:10 ` [PATCH BlueZ v4 0/2] " raghu447 @ 2026-04-29 6:10 ` raghu447 2026-04-29 6:46 ` client: Add public broadcast advertising support bluez.test.bot 2026-04-29 7:46 ` [PATCH BlueZ v5 0/2] " raghu447 2026-04-29 6:10 ` [PATCH BlueZ v4 2/2] client: make advertise.name use public broadcast name raghu447 1 sibling, 2 replies; 25+ messages in thread From: raghu447 @ 2026-04-29 6:10 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghavendra From: raghavendra <raghavendra.rao@collabora.com> --- client/advertising.c | 74 ++++++++++++++++++++++++++++++++++++++++++++ client/advertising.h | 2 ++ client/main.c | 19 ++++++++++++ 3 files changed, 95 insertions(+) diff --git a/client/advertising.c b/client/advertising.c index f9df1b855..2fc2ac9c6 100644 --- a/client/advertising.c +++ b/client/advertising.c @@ -20,6 +20,9 @@ #include <string.h> #include <errno.h> +#include "bluetooth/bluetooth.h" +#include "bluetooth/uuid.h" + #include "gdbus/gdbus.h" #include "src/shared/util.h" #include "src/shared/shell.h" @@ -27,6 +30,9 @@ #define AD_PATH "/org/bluez/advertising" #define AD_IFACE "org.bluez.LEAdvertisement1" +#define AD_PUBLIC_BROADCAST_UUID "0x1856" +#define AD_PUBLIC_BROADCAST_SQ BIT(1) +#define AD_PUBLIC_BROADCAST_HQ BIT(2) struct ad_data { uint8_t data[245]; @@ -1005,6 +1011,74 @@ static void ad_clear_data(int type) memset(&ad.data[type], 0, sizeof(ad.data[type])); } +static bool ad_is_public_broadcast_uuid(const char *uuid) +{ + return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID); +} + +static const char *ad_public_broadcast_state(void) +{ + if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid)) + return NULL; + + if (ad.service[AD_TYPE_AD].data.len != 2) + return NULL; + + if (ad.service[AD_TYPE_AD].data.data[0] == AD_PUBLIC_BROADCAST_SQ && + ad.service[AD_TYPE_AD].data.data[1] == 0x00) + return "sq"; + + if (ad.service[AD_TYPE_AD].data.data[0] == AD_PUBLIC_BROADCAST_HQ && + ad.service[AD_TYPE_AD].data.data[1] == 0x00) + return "hq"; + + return NULL; +} + +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, char *argv[]) +{ + struct ad_data data = { + .data = { 0x00, 0x00 }, + .len = 2, + }; + const char *state; + + if (argc < 2) { + state = ad_public_broadcast_state(); + if (state) + bt_shell_printf("Public Broadcast: %s\n", state); + else + bt_shell_printf("Public Broadcast not set\n"); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + } + + if (!strlen(argv[1])) { + bt_shell_printf("Public broadcast value cannot be empty\n"); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + if (!strcasecmp(argv[1], "sq")) + data.data[0] = AD_PUBLIC_BROADCAST_SQ; + else if (!strcasecmp(argv[1], "hq")) + data.data[0] = AD_PUBLIC_BROADCAST_HQ; + else { + bt_shell_printf("Invalid argument: accepted values are " + "sq or hq\n"); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + ad_clear_service(AD_TYPE_AD); + + ad.service[AD_TYPE_AD].uuid = g_strdup(AD_PUBLIC_BROADCAST_UUID); + ad.service[AD_TYPE_AD].data = data; + + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, + prop_names.service[AD_TYPE_AD]); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); +} + void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]) { char *endptr = NULL; diff --git a/client/advertising.h b/client/advertising.h index 9d124c7af..8c3fd041b 100644 --- a/client/advertising.h +++ b/client/advertising.h @@ -34,6 +34,8 @@ void ad_advertise_local_appearance(DBusConnection *conn, long int *value); void ad_advertise_duration(DBusConnection *conn, long int *value); void ad_advertise_timeout(DBusConnection *conn, long int *value); void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]); +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, + char *argv[]); void ad_disable_data(DBusConnection *conn, int type); void ad_advertise_discoverable(DBusConnection *conn, dbus_bool_t *value); void ad_advertise_discoverable_timeout(DBusConnection *conn, long int *value); diff --git a/client/main.c b/client/main.c index 57fa13888..afaf6045b 100644 --- a/client/main.c +++ b/client/main.c @@ -2920,6 +2920,17 @@ static char *scan_generator(const char *text, int state) return argument_generator(text, state, scan_arguments); } +static const char * const public_broadcast_arguments[] = { + "sq", + "hq", + NULL +}; + +static char *public_broadcast_generator(const char *text, int state) +{ + return argument_generator(text, state, public_broadcast_arguments); +} + static void cmd_advertise(int argc, char *argv[]) { dbus_bool_t enable; @@ -2970,6 +2981,11 @@ static void cmd_advertise_data(int argc, char *argv[]) ad_advertise_data(dbus_conn, AD_TYPE_AD, argc, argv); } +static void cmd_advertise_public_broadcast(int argc, char *argv[]) +{ + ad_advertise_public_broadcast(dbus_conn, argc, argv); +} + static void cmd_advertise_sr_uuids(int argc, char *argv[]) { ad_advertise_uuids(dbus_conn, AD_TYPE_SRD, argc, argv); @@ -3653,6 +3669,9 @@ static const struct bt_shell_menu advertise_menu = { "Set/Get advertise manufacturer data" }, { "data", "[type] [data=xx xx ...]", cmd_advertise_data, "Set/Get advertise data" }, + { "public-broadcast", "[sq/hq]", cmd_advertise_public_broadcast, + "Set/Get BLE Audio Public Broadcast Announcement", + public_broadcast_generator }, { "sr-uuids", "[uuid1 uuid2 ...]", cmd_advertise_sr_uuids, "Set/Get scan response uuids" }, { "sr-solicit", "[uuid1 uuid2 ...]", cmd_advertise_sr_solicit, -- 2.43.0 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* RE: client: Add public broadcast advertising support 2026-04-29 6:10 ` [PATCH BlueZ v4 1/2] client: add public-broadcast advertising command raghu447 @ 2026-04-29 6:46 ` bluez.test.bot 2026-04-29 7:46 ` [PATCH BlueZ v5 0/2] " raghu447 1 sibling, 0 replies; 25+ messages in thread From: bluez.test.bot @ 2026-04-29 6:46 UTC (permalink / raw) To: linux-bluetooth, raghavendra.rao [-- Attachment #1: Type: text/plain, Size: 36936 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=1087242 ---Test result--- Test Summary: CheckPatch PASS 0.82 seconds GitLint PASS 0.49 seconds BuildEll PASS 19.80 seconds BluezMake FAIL 563.58 seconds CheckSmatch FAIL 257.55 seconds bluezmakeextell FAIL 149.41 seconds IncrementalBuild FAIL 562.90 seconds ScanBuild FAIL 297.84 seconds Details ############################## Test: BluezMake - FAIL Desc: Build BlueZ Output: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12984:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12984 | int main(int argc, char *argv[]) | ^~~~ unit/test-avdtp.c: In function ‘main’: unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 766 | int main(int argc, char *argv[]) | ^~~~ unit/test-avrcp.c: In function ‘main’: unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 989 | int main(int argc, char *argv[]) | ^~~~ client/main.c: In function ‘public_broadcast_generator’: client/main.c:2931:41: error: passing argument 3 of ‘argument_generator’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 2931 | return argument_generator(text, state, public_broadcast_arguments); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ client/main.c:2893:18: note: expected ‘const char **’ but argument is of type ‘const char * const*’ 2893 | const char *args_list[]) | ~~~~~~~~~~~~^~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7058: client/main.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4172: all] Error 2 ############################## Test: CheckSmatch - FAIL Desc: Run smatch tool with source Output: src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:764:31: warning: Variable length array is used. src/shared/gatt-helpers.c:842:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1335:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1366:23: warning: Variable length array is used. src/shared/gatt-server.c:279:25: warning: Variable length array is used. src/shared/gatt-server.c:622:25: warning: Variable length array is used. src/shared/gatt-server.c:720:25: warning: Variable length array is used. src/shared/bap.c:312:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' src/shared/crypto.c:271:21: warning: Variable length array is used. src/shared/crypto.c:272:23: warning: Variable length array is used. src/shared/gatt-helpers.c:764:31: warning: Variable length array is used. src/shared/gatt-helpers.c:842:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1335:31: warning: Variable length array is used. src/shared/gatt-helpers.c:1366:23: warning: Variable length array is used. src/shared/gatt-server.c:279:25: warning: Variable length array is used. src/shared/gatt-server.c:622:25: warning: Variable length array is used. src/shared/gatt-server.c:720:25: warning: Variable length array is used. src/shared/bap.c:312:25: warning: array of flexible structures src/shared/bap.c: note: in included file: ./src/shared/ascs.h:88:25: warning: array of flexible structures src/shared/shell.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' tools/mesh-cfgtest.c:1453:17: warning: unknown escape sequence: '\%' tools/sco-tester.c: note: in included file: ./lib/bluetooth/bluetooth.h:232:15: warning: array of flexible structures ./lib/bluetooth/bluetooth.h:237:31: warning: array of flexible structures tools/bneptest.c:634:39: warning: unknown escape sequence: '\%' tools/seq2bseq.c:57:26: warning: Variable length array is used. tools/obex-client-tool.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' client/btpclient/gatt.c: note: in included file: ./src/shared/btp.h:328:41: warning: array of flexible structures ./src/shared/btp.h:333:55: warning: array of flexible structures ./src/shared/btp.h:356:47: warning: array of flexible structures ./src/shared/btp.h:385:42: warning: array of flexible structures src/advertising.c: note: in included file: ./src/shared/mgmt.h:95:25: error: redefinition of unsigned int enum mgmt_io_capability src/agent.c: note: in included file: src/shared/queue.h:19:20: error: redefinition of struct queue_entry src/adv_monitor.c: note: in included file: ./src/shared/mgmt.h:95:25: error: redefinition of unsigned int enum mgmt_io_capability unit/avctp.c:505:34: warning: Variable length array is used. unit/avctp.c:556:34: warning: Variable length array is used. unit/test-avrcp.c:373:26: warning: Variable length array is used. unit/test-avrcp.c:398:26: warning: Variable length array is used. unit/test-avrcp.c:414:24: warning: Variable length array is used. unit/avrcp-lib.c:1085:34: warning: Variable length array is used. unit/avrcp-lib.c:1583:34: warning: Variable length array is used. unit/avrcp-lib.c:1612:34: warning: Variable length array is used. unit/avrcp-lib.c:1638:34: warning: Variable length array is used. src/advertising.c: note: in included file: ./src/shared/mgmt.h:95:25: error: redefinition of unsigned int enum mgmt_io_capability src/agent.c: note: in included file: src/shared/queue.h:19:20: error: redefinition of struct queue_entry src/adv_monitor.c: note: in included file: ./src/shared/mgmt.h:95:25: error: redefinition of unsigned int enum mgmt_io_capability src/main.c: note: in included file (through src/device.h): ./src/shared/queue.h:19:20: error: redefinition of struct queue_entry mesh/mesh-io-mgmt.c:525:67: warning: Variable length array is used. client/display.c: note: in included file (through /usr/include/readline/readline.h): /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' /usr/include/readline/rltypedefs.h:36:25: warning: non-ANSI function declaration of function 'VFunction' /usr/include/readline/rltypedefs.h:37:27: warning: non-ANSI function declaration of function 'CPFunction' /usr/include/readline/rltypedefs.h:38:29: warning: non-ANSI function declaration of function 'CPPFunction' client/main.c: In function ‘public_broadcast_generator’: client/main.c:2931:41: error: passing argument 3 of ‘argument_generator’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 2931 | return argument_generator(text, state, public_broadcast_arguments); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ client/main.c:2893:18: note: expected ‘const char **’ but argument is of type ‘const char * const*’ 2893 | const char *args_list[]) | ~~~~~~~~~~~~^~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7058: client/main.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4172: all] Error 2 ############################## Test: bluezmakeextell - FAIL Desc: Build Bluez with External ELL Output: client/main.c: In function ‘public_broadcast_generator’: client/main.c:2931:41: error: passing argument 3 of ‘argument_generator’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 2931 | return argument_generator(text, state, public_broadcast_arguments); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ client/main.c:2893:18: note: expected ‘const char **’ but argument is of type ‘const char * const*’ 2893 | const char *args_list[]) | ~~~~~~~~~~~~^~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7058: client/main.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4172: all] Error 2 ############################## Test: IncrementalBuild - FAIL Desc: Incremental build with the patches in the series Output: tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12984:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12984 | int main(int argc, char *argv[]) | ^~~~ unit/test-avdtp.c: In function ‘main’: unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 766 | int main(int argc, char *argv[]) | ^~~~ unit/test-avrcp.c: In function ‘main’: unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 989 | int main(int argc, char *argv[]) | ^~~~ client/main.c: In function ‘public_broadcast_generator’: client/main.c:2931:41: error: passing argument 3 of ‘argument_generator’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 2931 | return argument_generator(text, state, public_broadcast_arguments); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ client/main.c:2893:18: note: expected ‘const char **’ but argument is of type ‘const char * const*’ 2893 | const char *args_list[]) | ~~~~~~~~~~~~^~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7058: client/main.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4172: all] Error 2 [BlueZ,v4,1/2] client: add public-broadcast advertising command tools/mgmt-tester.c: In function ‘main’: tools/mgmt-tester.c:12984:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 12984 | int main(int argc, char *argv[]) | ^~~~ unit/test-avdtp.c: In function ‘main’: unit/test-avdtp.c:766:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 766 | int main(int argc, char *argv[]) | ^~~~ unit/test-avrcp.c: In function ‘main’: unit/test-avrcp.c:989:5: note: variable tracking size limit exceeded with ‘-fvar-tracking-assignments’, retrying without 989 | int main(int argc, char *argv[]) | ^~~~ client/main.c: In function ‘public_broadcast_generator’: client/main.c:2931:41: error: passing argument 3 of ‘argument_generator’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 2931 | return argument_generator(text, state, public_broadcast_arguments); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ client/main.c:2893:18: note: expected ‘const char **’ but argument is of type ‘const char * const*’ 2893 | const char *args_list[]) | ~~~~~~~~~~~~^~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7058: client/main.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4172: all] Error 2 ############################## Test: ScanBuild - FAIL Desc: Run Scan Build Output: src/shared/gatt-client.c:447:21: warning: Use of memory after it is freed gatt_db_unregister(op->client->db, op->db_id); ^~~~~~~~~~ src/shared/gatt-client.c:692:2: warning: Use of memory after it is freed discovery_op_complete(op, false, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:992:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1098:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1292:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1357:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1632:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1637:2: warning: Use of memory after it is freed discover_all(op); ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1693:56: warning: Use of memory after it is freed notify_data->chrc->ccc_write_id = notify_data->att_id = att_id; ~~~~~~~~~~~~~~~~~~~ ^ src/shared/gatt-client.c:2146:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2154:8: warning: Use of memory after it is freed discovery_op_ref(op), ^~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3332:2: warning: Use of memory after it is freed complete_write_long_op(req, success, 0, false); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3354:2: warning: Use of memory after it is freed request_unref(req); ^~~~~~~~~~~~~~~~~~ 13 warnings generated. src/shared/bap.c:1529:8: warning: Use of memory after it is freed bap = bt_bap_ref_safe(bap); ^~~~~~~~~~~~~~~~~~~~ src/shared/bap.c:2340:20: warning: Use of memory after it is freed return queue_find(stream->bap->streams, NULL, stream); ^~~~~~~~~~~~~~~~~~~~ 2 warnings generated. src/shared/gatt-client.c:447:21: warning: Use of memory after it is freed gatt_db_unregister(op->client->db, op->db_id); ^~~~~~~~~~ src/shared/gatt-client.c:692:2: warning: Use of memory after it is freed discovery_op_complete(op, false, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:992:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1098:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1292:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1357:2: warning: Use of memory after it is freed discovery_op_complete(op, success, att_ecode); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1632:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1637:2: warning: Use of memory after it is freed discover_all(op); ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:1693:56: warning: Use of memory after it is freed notify_data->chrc->ccc_write_id = notify_data->att_id = att_id; ~~~~~~~~~~~~~~~~~~~ ^ src/shared/gatt-client.c:2146:6: warning: Use of memory after it is freed if (read_db_hash(op)) { ^~~~~~~~~~~~~~~~ src/shared/gatt-client.c:2154:8: warning: Use of memory after it is freed discovery_op_ref(op), ^~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3332:2: warning: Use of memory after it is freed complete_write_long_op(req, success, 0, false); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/shared/gatt-client.c:3354:2: warning: Use of memory after it is freed request_unref(req); ^~~~~~~~~~~~~~~~~~ 13 warnings generated. tools/hciattach.c:817:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 10)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:865:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 4)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:887:8: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 10)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:909:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 4)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:930:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 4)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/hciattach.c:974:7: warning: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' if ((n = read_hci_event(fd, resp, 6)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6 warnings generated. src/shared/bap.c:1529:8: warning: Use of memory after it is freed bap = bt_bap_ref_safe(bap); ^~~~~~~~~~~~~~~~~~~~ src/shared/bap.c:2340:20: warning: Use of memory after it is freed return queue_find(stream->bap->streams, NULL, stream); ^~~~~~~~~~~~~~~~~~~~ 2 warnings generated. src/oui.c:50:2: warning: Value stored to 'hwdb' is never read hwdb = udev_hwdb_unref(hwdb); ^ ~~~~~~~~~~~~~~~~~~~~~ src/oui.c:53:2: warning: Value stored to 'udev' is never read udev = udev_unref(udev); ^ ~~~~~~~~~~~~~~~~ 2 warnings generated. tools/rfcomm.c:234:3: warning: Value stored to 'i' is never read i = execvp(cmdargv[0], cmdargv); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/rfcomm.c:234:7: warning: Null pointer passed to 1st parameter expecting 'nonnull' i = execvp(cmdargv[0], cmdargv); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/rfcomm.c:354:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd' if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/rfcomm.c:497:14: warning: Assigned value is garbage or undefined req.channel = raddr.rc_channel; ^ ~~~~~~~~~~~~~~~~ tools/rfcomm.c:515:8: warning: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd' if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) { ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5 warnings generated. tools/ciptool.c:351:7: warning: 5th function call argument is an uninitialized value sk = do_connect(ctl, dev_id, &src, &dst, psm, (1 << CMTP_LOOPBACK)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. src/sdp-xml.c:126:10: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ src/sdp-xml.c:306:11: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ src/sdp-xml.c:344:11: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ 3 warnings generated. tools/sdptool.c:941:26: warning: Result of 'malloc' is converted to a pointer of type 'uint32_t', which is incompatible with sizeof operand type 'int' uint32_t *value_int = malloc(sizeof(int)); ~~~~~~~~~~ ^~~~~~ ~~~~~~~~~~~ tools/sdptool.c:980:4: warning: 1st function call argument is an uninitialized value free(allocArray[i]); ^~~~~~~~~~~~~~~~~~~ tools/sdptool.c:3777:2: warning: Potential leak of memory pointed to by 'si.name' return add_service(0, &si); ^~~~~~~~~~~~~~~~~~~~~~~~~~ tools/sdptool.c:4112:4: warning: Potential leak of memory pointed to by 'context.svc' return -1; ^~~~~~~~~ 4 warnings generated. tools/avtest.c:243:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:253:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:262:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:276:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:283:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:290:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:297:5: warning: Value stored to 'len' is never read len = write(sk, buf, ^ ~~~~~~~~~~~~~~ tools/avtest.c:309:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:313:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:322:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:326:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:335:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:342:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:364:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:368:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:377:5: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:381:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:394:5: warning: Value stored to 'len' is never read len = write(sk, buf, 4); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:398:5: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:405:4: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:415:4: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:580:3: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:588:3: warning: Value stored to 'len' is never read len = write(sk, buf, invalid ? 2 : 3); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/avtest.c:602:3: warning: Value stored to 'len' is never read len = write(sk, buf, 4 + media_transport_size); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/avtest.c:615:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:625:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:637:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:652:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:664:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:673:3: warning: Value stored to 'len' is never read len = write(sk, buf, 3); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:680:3: warning: Value stored to 'len' is never read len = write(sk, buf, 2); ^ ~~~~~~~~~~~~~~~~~ tools/avtest.c:716:2: warning: Value stored to 'len' is never read len = write(sk, buf, AVCTP_HEADER_LENGTH + sizeof(play_pressed)); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 32 warnings generated. tools/btproxy.c:836:15: warning: Null pointer passed to 1st parameter expecting 'nonnull' tcp_port = atoi(optarg); ^~~~~~~~~~~~ tools/btproxy.c:839:8: warning: Null pointer passed to 1st parameter expecting 'nonnull' if (strlen(optarg) > 3 && !strncmp(optarg, "hci", 3)) ^~~~~~~~~~~~~~ 2 warnings generated. tools/create-image.c:76:3: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ tools/create-image.c:84:3: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ tools/create-image.c:92:3: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ tools/create-image.c:105:2: warning: Value stored to 'fd' is never read fd = -1; ^ ~~ 4 warnings generated. tools/check-selftest.c:42:3: warning: Value stored to 'ptr' is never read ptr = fgets(result, sizeof(result), fp); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. tools/btgatt-client.c:1822:2: warning: Value stored to 'argv' is never read argv += optind; ^ ~~~~~~ 1 warning generated. tools/btgatt-server.c:1204:2: warning: Value stored to 'argv' is never read argv -= optind; ^ ~~~~~~ 1 warning generated. tools/gatt-service.c:294:2: warning: 2nd function call argument is an uninitialized value chr_write(chr, value, len); ^~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. tools/obex-server-tool.c:133:13: warning: Null pointer passed to 1st parameter expecting 'nonnull' data->fd = open(name, O_WRONLY | O_CREAT | O_NOCTTY, 0600); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tools/obex-server-tool.c:192:13: warning: Null pointer passed to 1st parameter expecting 'nonnull' data->fd = open(name, O_RDONLY | O_NOCTTY, 0); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. client/btpclient/btpclientctl.c:402:3: warning: Value stored to 'bit' is never read bit = 0; ^ ~ client/btpclient/btpclientctl.c:1655:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull' memcpy(cp->data, ad_data, ad_len); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. src/sdp-client.c:353:14: warning: Access to field 'cb' results in a dereference of a null pointer (*ctxt)->cb = cb; ~~~~~~~~~~~~^~~~ 1 warning generated. src/sdpd-request.c:209:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint16_t' pElem = malloc(sizeof(uint16_t)); ^~~~~~ ~~~~~~~~~~~~~~~~ src/sdpd-request.c:237:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint32_t' pElem = malloc(sizeof(uint32_t)); ^~~~~~ ~~~~~~~~~~~~~~~~ 2 warnings generated. src/gatt-database.c:1171:10: warning: Value stored to 'bits' during its initialization is never read uint8_t bits[] = { BT_GATT_CHRC_CLI_FEAT_ROBUST_CACHING, ^~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. src/gatt-client.c:1569:2: warning: Use of memory after it is freed notify_client_unref(client); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. unit/avrcp-lib.c:1968:3: warning: 1st function call argument is an uninitialized value g_free(text[i]); ^~~~~~~~~~~~~~~ 1 warning generated. unit/avdtp.c:756:25: warning: Use of memory after it is freed session->prio_queue = g_slist_remove(session->prio_queue, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ unit/avdtp.c:763:24: warning: Use of memory after it is freed session->req_queue = g_slist_remove(session->req_queue, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. profiles/audio/avdtp.c:895:25: warning: Use of memory after it is freed session->prio_queue = g_slist_remove(session->prio_queue, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ profiles/audio/avdtp.c:902:24: warning: Use of memory after it is freed session->req_queue = g_slist_remove(session->req_queue, req); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 warnings generated. profiles/audio/a2dp.c:442:8: warning: Use of memory after it is freed if (!cb->resume_cb) ^~~~~~~~~~~~~ profiles/audio/a2dp.c:3354:20: warning: Access to field 'starting' results in a dereference of a null pointer (loaded from variable 'stream') stream->starting = TRUE; ~~~~~~ ^ profiles/audio/a2dp.c:3357:8: warning: Access to field 'suspending' results in a dereference of a null pointer (loaded from variable 'stream') if (!stream->suspending && stream->suspend_timer) { ^~~~~~~~~~~~~~~~~~ profiles/audio/a2dp.c:3417:22: warning: Access to field 'suspending' results in a dereference of a null pointer (loaded from variable 'stream') stream->suspending = TRUE; ~~~~~~ ^ 4 warnings generated. profiles/audio/avrcp.c:1968:2: warning: Value stored to 'operands' is never read operands += sizeof(*pdu); ^ ~~~~~~~~~~~~ 1 warning generated. attrib/gatt.c:970:2: warning: Potential leak of memory pointed to by 'long_write' return prepare_write(long_write); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. src/sdpd-request.c:209:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint16_t' pElem = malloc(sizeof(uint16_t)); ^~~~~~ ~~~~~~~~~~~~~~~~ src/sdpd-request.c:237:13: warning: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint32_t' pElem = malloc(sizeof(uint32_t)); ^~~~~~ ~~~~~~~~~~~~~~~~ 2 warnings generated. src/sdp-client.c:353:14: warning: Access to field 'cb' results in a dereference of a null pointer (*ctxt)->cb = cb; ~~~~~~~~~~~~^~~~ 1 warning generated. src/gatt-database.c:1171:10: warning: Value stored to 'bits' during its initialization is never read uint8_t bits[] = { BT_GATT_CHRC_CLI_FEAT_ROBUST_CACHING, ^~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. src/sdp-xml.c:126:10: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ src/sdp-xml.c:306:11: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ src/sdp-xml.c:344:11: warning: Assigned value is garbage or undefined buf[1] = data[i + 1]; ^ ~~~~~~~~~~~ 3 warnings generated. src/gatt-client.c:1569:2: warning: Use of memory after it is freed notify_client_unref(client); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. gobex/gobex-header.c:95:2: warning: Null pointer passed to 2nd parameter expecting 'nonnull' memcpy(to, from, count); ^~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. gobex/gobex-transfer.c:423:7: warning: Use of memory after it is freed if (!g_slist_find(transfers, transfer)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning generated. mesh/main.c:162:3: warning: Value stored to 'optarg' is never read optarg += strlen("auto"); ^ ~~~~~~~~~~~~~~ 1 warning generated. client/main.c: In function ‘public_broadcast_generator’: client/main.c:2931:41: error: passing argument 3 of ‘argument_generator’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers] 2931 | return argument_generator(text, state, public_broadcast_arguments); | ^~~~~~~~~~~~~~~~~~~~~~~~~~ client/main.c:2893:18: note: expected ‘const char **’ but argument is of type ‘const char * const*’ 2893 | const char *args_list[]) | ~~~~~~~~~~~~^~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7058: client/main.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:4172: all] Error 2 https://github.com/bluez/bluez/pull/2082 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH BlueZ v5 0/2] client: Add public broadcast advertising support 2026-04-29 6:10 ` [PATCH BlueZ v4 1/2] client: add public-broadcast advertising command raghu447 2026-04-29 6:46 ` client: Add public broadcast advertising support bluez.test.bot @ 2026-04-29 7:46 ` raghu447 2026-04-29 7:46 ` [PATCH BlueZ v5 1/2] client: add public-broadcast advertising command raghu447 ` (2 more replies) 1 sibling, 3 replies; 25+ messages in thread From: raghu447 @ 2026-04-29 7:46 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghu447 This series adds bluetoothctl support for staging Public Broadcast Announcement advertising data used during LE Audio public broadcast qualification. Patch 1 adds a public-broadcast command to the advertise submenu. The command stages Public Broadcast Announcement ServiceData using UUID 0x1856 and supports SQ and HQ presets. Patch 2 makes advertise.name broadcast-aware. When Public Broadcast Announcement ServiceData is staged, advertise.name sets and gets the Public Broadcast Name using AD type 0x30. raghavendra (2): client: add public-broadcast advertising command client: make advertise.name use public broadcast name client/advertising.c | 148 +++++++++++++++++++++++++++++++++++++++++++ client/advertising.h | 2 + client/main.c | 19 ++++++ 3 files changed, 169 insertions(+) -- 2.43.0 ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH BlueZ v5 1/2] client: add public-broadcast advertising command 2026-04-29 7:46 ` [PATCH BlueZ v5 0/2] " raghu447 @ 2026-04-29 7:46 ` raghu447 2026-04-29 9:21 ` client: Add public broadcast advertising support bluez.test.bot 2026-04-29 7:46 ` [PATCH BlueZ v5 2/2] client: make advertise.name use public broadcast name raghu447 2026-04-29 13:50 ` [PATCH BlueZ v5 0/2] client: Add public broadcast advertising support patchwork-bot+bluetooth 2 siblings, 1 reply; 25+ messages in thread From: raghu447 @ 2026-04-29 7:46 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghavendra From: raghavendra <raghavendra.rao@collabora.com> --- client/advertising.c | 74 ++++++++++++++++++++++++++++++++++++++++++++ client/advertising.h | 2 ++ client/main.c | 19 ++++++++++++ 3 files changed, 95 insertions(+) diff --git a/client/advertising.c b/client/advertising.c index f9df1b855..2fc2ac9c6 100644 --- a/client/advertising.c +++ b/client/advertising.c @@ -20,6 +20,9 @@ #include <string.h> #include <errno.h> +#include "bluetooth/bluetooth.h" +#include "bluetooth/uuid.h" + #include "gdbus/gdbus.h" #include "src/shared/util.h" #include "src/shared/shell.h" @@ -27,6 +30,9 @@ #define AD_PATH "/org/bluez/advertising" #define AD_IFACE "org.bluez.LEAdvertisement1" +#define AD_PUBLIC_BROADCAST_UUID "0x1856" +#define AD_PUBLIC_BROADCAST_SQ BIT(1) +#define AD_PUBLIC_BROADCAST_HQ BIT(2) struct ad_data { uint8_t data[245]; @@ -1005,6 +1011,74 @@ static void ad_clear_data(int type) memset(&ad.data[type], 0, sizeof(ad.data[type])); } +static bool ad_is_public_broadcast_uuid(const char *uuid) +{ + return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID); +} + +static const char *ad_public_broadcast_state(void) +{ + if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid)) + return NULL; + + if (ad.service[AD_TYPE_AD].data.len != 2) + return NULL; + + if (ad.service[AD_TYPE_AD].data.data[0] == AD_PUBLIC_BROADCAST_SQ && + ad.service[AD_TYPE_AD].data.data[1] == 0x00) + return "sq"; + + if (ad.service[AD_TYPE_AD].data.data[0] == AD_PUBLIC_BROADCAST_HQ && + ad.service[AD_TYPE_AD].data.data[1] == 0x00) + return "hq"; + + return NULL; +} + +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, char *argv[]) +{ + struct ad_data data = { + .data = { 0x00, 0x00 }, + .len = 2, + }; + const char *state; + + if (argc < 2) { + state = ad_public_broadcast_state(); + if (state) + bt_shell_printf("Public Broadcast: %s\n", state); + else + bt_shell_printf("Public Broadcast not set\n"); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + } + + if (!strlen(argv[1])) { + bt_shell_printf("Public broadcast value cannot be empty\n"); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + if (!strcasecmp(argv[1], "sq")) + data.data[0] = AD_PUBLIC_BROADCAST_SQ; + else if (!strcasecmp(argv[1], "hq")) + data.data[0] = AD_PUBLIC_BROADCAST_HQ; + else { + bt_shell_printf("Invalid argument: accepted values are " + "sq or hq\n"); + return bt_shell_noninteractive_quit(EXIT_FAILURE); + } + + ad_clear_service(AD_TYPE_AD); + + ad.service[AD_TYPE_AD].uuid = g_strdup(AD_PUBLIC_BROADCAST_UUID); + ad.service[AD_TYPE_AD].data = data; + + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, + prop_names.service[AD_TYPE_AD]); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); +} + void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]) { char *endptr = NULL; diff --git a/client/advertising.h b/client/advertising.h index 9d124c7af..8c3fd041b 100644 --- a/client/advertising.h +++ b/client/advertising.h @@ -34,6 +34,8 @@ void ad_advertise_local_appearance(DBusConnection *conn, long int *value); void ad_advertise_duration(DBusConnection *conn, long int *value); void ad_advertise_timeout(DBusConnection *conn, long int *value); void ad_advertise_data(DBusConnection *conn, int type, int argc, char *argv[]); +void ad_advertise_public_broadcast(DBusConnection *conn, int argc, + char *argv[]); void ad_disable_data(DBusConnection *conn, int type); void ad_advertise_discoverable(DBusConnection *conn, dbus_bool_t *value); void ad_advertise_discoverable_timeout(DBusConnection *conn, long int *value); diff --git a/client/main.c b/client/main.c index 57fa13888..6fb399277 100644 --- a/client/main.c +++ b/client/main.c @@ -2920,6 +2920,17 @@ static char *scan_generator(const char *text, int state) return argument_generator(text, state, scan_arguments); } +static const char *public_broadcast_arguments[] = { + "sq", + "hq", + NULL +}; + +static char *public_broadcast_generator(const char *text, int state) +{ + return argument_generator(text, state, public_broadcast_arguments); +} + static void cmd_advertise(int argc, char *argv[]) { dbus_bool_t enable; @@ -2970,6 +2981,11 @@ static void cmd_advertise_data(int argc, char *argv[]) ad_advertise_data(dbus_conn, AD_TYPE_AD, argc, argv); } +static void cmd_advertise_public_broadcast(int argc, char *argv[]) +{ + ad_advertise_public_broadcast(dbus_conn, argc, argv); +} + static void cmd_advertise_sr_uuids(int argc, char *argv[]) { ad_advertise_uuids(dbus_conn, AD_TYPE_SRD, argc, argv); @@ -3653,6 +3669,9 @@ static const struct bt_shell_menu advertise_menu = { "Set/Get advertise manufacturer data" }, { "data", "[type] [data=xx xx ...]", cmd_advertise_data, "Set/Get advertise data" }, + { "public-broadcast", "[sq/hq]", cmd_advertise_public_broadcast, + "Set/Get BLE Audio Public Broadcast Announcement", + public_broadcast_generator }, { "sr-uuids", "[uuid1 uuid2 ...]", cmd_advertise_sr_uuids, "Set/Get scan response uuids" }, { "sr-solicit", "[uuid1 uuid2 ...]", cmd_advertise_sr_solicit, -- 2.43.0 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* RE: client: Add public broadcast advertising support 2026-04-29 7:46 ` [PATCH BlueZ v5 1/2] client: add public-broadcast advertising command raghu447 @ 2026-04-29 9:21 ` bluez.test.bot 0 siblings, 0 replies; 25+ messages in thread From: bluez.test.bot @ 2026-04-29 9:21 UTC (permalink / raw) To: linux-bluetooth, raghavendra.rao [-- Attachment #1: Type: text/plain, Size: 1790 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=1087302 ---Test result--- Test Summary: CheckPatch FAIL 1.13 seconds GitLint PASS 0.69 seconds BuildEll PASS 20.11 seconds BluezMake PASS 648.01 seconds CheckSmatch PASS 348.14 seconds bluezmakeextell PASS 181.33 seconds IncrementalBuild PASS 635.58 seconds ScanBuild PASS 1013.92 seconds Details ############################## Test: CheckPatch - FAIL Desc: Run checkpatch.pl script Output: [BlueZ,v5,1/2] client: add public-broadcast advertising command WARNING:STATIC_CONST_CHAR_ARRAY: static const char * array should probably be static const char * const #198: FILE: client/main.c:2923: +static const char *public_broadcast_arguments[] = { /github/workspace/src/patch/14546142.patch total: 0 errors, 1 warnings, 137 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/patch/14546142.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. https://github.com/bluez/bluez/pull/2083 --- Regards, Linux Bluetooth ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH BlueZ v5 2/2] client: make advertise.name use public broadcast name 2026-04-29 7:46 ` [PATCH BlueZ v5 0/2] " raghu447 2026-04-29 7:46 ` [PATCH BlueZ v5 1/2] client: add public-broadcast advertising command raghu447 @ 2026-04-29 7:46 ` raghu447 2026-04-29 13:50 ` [PATCH BlueZ v5 0/2] client: Add public broadcast advertising support patchwork-bot+bluetooth 2 siblings, 0 replies; 25+ messages in thread From: raghu447 @ 2026-04-29 7:46 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghavendra From: raghavendra <raghavendra.rao@collabora.com> --- client/advertising.c | 74 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/client/advertising.c b/client/advertising.c index 2fc2ac9c6..5ca391635 100644 --- a/client/advertising.c +++ b/client/advertising.c @@ -31,6 +31,7 @@ #define AD_PATH "/org/bluez/advertising" #define AD_IFACE "org.bluez.LEAdvertisement1" #define AD_PUBLIC_BROADCAST_UUID "0x1856" +#define AD_TYPE_PUBLIC_BROADCAST_NAME 0x30 #define AD_PUBLIC_BROADCAST_SQ BIT(1) #define AD_PUBLIC_BROADCAST_HQ BIT(2) @@ -1016,6 +1017,62 @@ static bool ad_is_public_broadcast_uuid(const char *uuid) return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID); } +static bool ad_broadcast_in_use(void) +{ + return ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid); +} + +static bool ad_has_public_broadcast_name(void) +{ + return ad.data[AD_TYPE_AD].valid && + ad.data[AD_TYPE_AD].type == AD_TYPE_PUBLIC_BROADCAST_NAME && + ad.data[AD_TYPE_AD].data.len > 0; +} + +static void ad_print_public_broadcast_name(void) +{ + if (!ad_has_public_broadcast_name()) { + bt_shell_printf("Public Broadcast Name not set\n"); + return; + } + + bt_shell_printf("Public Broadcast Name: %.*s\n", + (int) ad.data[AD_TYPE_AD].data.len, + (char *) ad.data[AD_TYPE_AD].data.data); +} + +static bool ad_set_public_broadcast_name(DBusConnection *conn, + const char *name) +{ + struct ad_data data; + size_t len; + + if (!name || !strlen(name)) { + bt_shell_printf("Public Broadcast Name cannot be empty\n"); + return false; + } + + len = strlen(name); + if (len > sizeof(data.data)) { + bt_shell_printf("Public Broadcast Name too long\n"); + return false; + } + + memset(&data, 0, sizeof(data)); + memcpy(data.data, name, len); + data.len = len; + + ad_clear_data(AD_TYPE_AD); + ad.data[AD_TYPE_AD].valid = true; + ad.data[AD_TYPE_AD].type = AD_TYPE_PUBLIC_BROADCAST_NAME; + ad.data[AD_TYPE_AD].data = data; + + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, + prop_names.data[AD_TYPE_AD]); + + return true; +} + static const char *ad_public_broadcast_state(void) { if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid)) @@ -1203,6 +1260,23 @@ void ad_advertise_name(DBusConnection *conn, bool value) void ad_advertise_local_name(DBusConnection *conn, const char *name) { + if (ad_broadcast_in_use()) { + if (!name) { + ad_print_public_broadcast_name(); + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + } + + if (ad_has_public_broadcast_name() && + ad.data[AD_TYPE_AD].data.len == strlen(name) && + !memcmp(ad.data[AD_TYPE_AD].data.data, name, strlen(name))) + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + + if (!ad_set_public_broadcast_name(conn, name)) + return bt_shell_noninteractive_quit(EXIT_FAILURE); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + } + if (!name) { if (ad.local_name) bt_shell_printf("LocalName: %s\n", ad.local_name); -- 2.43.0 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH BlueZ v5 0/2] client: Add public broadcast advertising support 2026-04-29 7:46 ` [PATCH BlueZ v5 0/2] " raghu447 2026-04-29 7:46 ` [PATCH BlueZ v5 1/2] client: add public-broadcast advertising command raghu447 2026-04-29 7:46 ` [PATCH BlueZ v5 2/2] client: make advertise.name use public broadcast name raghu447 @ 2026-04-29 13:50 ` patchwork-bot+bluetooth 2 siblings, 0 replies; 25+ messages in thread From: patchwork-bot+bluetooth @ 2026-04-29 13:50 UTC (permalink / raw) To: raghu447; +Cc: linux-bluetooth Hello: This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>: On Wed, 29 Apr 2026 13:16:03 +0530 you wrote: > This series adds bluetoothctl support for staging Public Broadcast > Announcement advertising data used during LE Audio public broadcast > qualification. > > Patch 1 adds a public-broadcast command to the advertise submenu. The > command stages Public Broadcast Announcement ServiceData using UUID > 0x1856 and supports SQ and HQ presets. > > [...] Here is the summary with links: - [BlueZ,v5,1/2] client: add public-broadcast advertising command https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=5dc2d7e3334e - [BlueZ,v5,2/2] client: make advertise.name use public broadcast name https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=278f3439c45f You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH BlueZ v4 2/2] client: make advertise.name use public broadcast name 2026-04-29 6:10 ` [PATCH BlueZ v4 0/2] " raghu447 2026-04-29 6:10 ` [PATCH BlueZ v4 1/2] client: add public-broadcast advertising command raghu447 @ 2026-04-29 6:10 ` raghu447 1 sibling, 0 replies; 25+ messages in thread From: raghu447 @ 2026-04-29 6:10 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghavendra From: raghavendra <raghavendra.rao@collabora.com> --- client/advertising.c | 74 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/client/advertising.c b/client/advertising.c index 2fc2ac9c6..5ca391635 100644 --- a/client/advertising.c +++ b/client/advertising.c @@ -31,6 +31,7 @@ #define AD_PATH "/org/bluez/advertising" #define AD_IFACE "org.bluez.LEAdvertisement1" #define AD_PUBLIC_BROADCAST_UUID "0x1856" +#define AD_TYPE_PUBLIC_BROADCAST_NAME 0x30 #define AD_PUBLIC_BROADCAST_SQ BIT(1) #define AD_PUBLIC_BROADCAST_HQ BIT(2) @@ -1016,6 +1017,62 @@ static bool ad_is_public_broadcast_uuid(const char *uuid) return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID); } +static bool ad_broadcast_in_use(void) +{ + return ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid); +} + +static bool ad_has_public_broadcast_name(void) +{ + return ad.data[AD_TYPE_AD].valid && + ad.data[AD_TYPE_AD].type == AD_TYPE_PUBLIC_BROADCAST_NAME && + ad.data[AD_TYPE_AD].data.len > 0; +} + +static void ad_print_public_broadcast_name(void) +{ + if (!ad_has_public_broadcast_name()) { + bt_shell_printf("Public Broadcast Name not set\n"); + return; + } + + bt_shell_printf("Public Broadcast Name: %.*s\n", + (int) ad.data[AD_TYPE_AD].data.len, + (char *) ad.data[AD_TYPE_AD].data.data); +} + +static bool ad_set_public_broadcast_name(DBusConnection *conn, + const char *name) +{ + struct ad_data data; + size_t len; + + if (!name || !strlen(name)) { + bt_shell_printf("Public Broadcast Name cannot be empty\n"); + return false; + } + + len = strlen(name); + if (len > sizeof(data.data)) { + bt_shell_printf("Public Broadcast Name too long\n"); + return false; + } + + memset(&data, 0, sizeof(data)); + memcpy(data.data, name, len); + data.len = len; + + ad_clear_data(AD_TYPE_AD); + ad.data[AD_TYPE_AD].valid = true; + ad.data[AD_TYPE_AD].type = AD_TYPE_PUBLIC_BROADCAST_NAME; + ad.data[AD_TYPE_AD].data = data; + + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, + prop_names.data[AD_TYPE_AD]); + + return true; +} + static const char *ad_public_broadcast_state(void) { if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid)) @@ -1203,6 +1260,23 @@ void ad_advertise_name(DBusConnection *conn, bool value) void ad_advertise_local_name(DBusConnection *conn, const char *name) { + if (ad_broadcast_in_use()) { + if (!name) { + ad_print_public_broadcast_name(); + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + } + + if (ad_has_public_broadcast_name() && + ad.data[AD_TYPE_AD].data.len == strlen(name) && + !memcmp(ad.data[AD_TYPE_AD].data.data, name, strlen(name))) + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + + if (!ad_set_public_broadcast_name(conn, name)) + return bt_shell_noninteractive_quit(EXIT_FAILURE); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + } + if (!name) { if (ad.local_name) bt_shell_printf("LocalName: %s\n", ad.local_name); -- 2.43.0 ^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH BlueZ v3 2/2] client: make advertise.name use public broadcast name 2026-04-28 14:40 ` [PATCH BlueZ v3 0/2] client: Add public broadcast advertising support raghu447 2026-04-28 14:40 ` [PATCH BlueZ v3 1/2] client: add public-broadcast advertising command raghu447 @ 2026-04-28 14:40 ` raghu447 1 sibling, 0 replies; 25+ messages in thread From: raghu447 @ 2026-04-28 14:40 UTC (permalink / raw) To: linux-bluetooth; +Cc: raghavendra From: raghavendra <raghavendra.rao@collabora.com> --- client/advertising.c | 74 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/client/advertising.c b/client/advertising.c index 8ffbb085b..98e3895c3 100644 --- a/client/advertising.c +++ b/client/advertising.c @@ -31,6 +31,7 @@ #define AD_PATH "/org/bluez/advertising" #define AD_IFACE "org.bluez.LEAdvertisement1" #define AD_PUBLIC_BROADCAST_UUID "0x1856" +#define AD_TYPE_PUBLIC_BROADCAST_NAME 0x30 #define AD_PUBLIC_BROADCAST_SQ BIT(1) #define AD_PUBLIC_BROADCAST_HQ BIT(2) @@ -1016,6 +1017,62 @@ static bool ad_is_public_broadcast_uuid(const char *uuid) return uuid && !bt_uuid_strcmp(uuid, AD_PUBLIC_BROADCAST_UUID); } +static bool ad_broadcast_in_use(void) +{ + return ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid); +} + +static bool ad_has_public_broadcast_name(void) +{ + return ad.data[AD_TYPE_AD].valid && + ad.data[AD_TYPE_AD].type == AD_TYPE_PUBLIC_BROADCAST_NAME && + ad.data[AD_TYPE_AD].data.len > 0; +} + +static void ad_print_public_broadcast_name(void) +{ + if (!ad_has_public_broadcast_name()) { + bt_shell_printf("Public Broadcast Name not set\n"); + return; + } + + bt_shell_printf("Public Broadcast Name: %.*s\n", + (int) ad.data[AD_TYPE_AD].data.len, + (char *) ad.data[AD_TYPE_AD].data.data); +} + +static bool ad_set_public_broadcast_name(DBusConnection *conn, + const char *name) +{ + struct ad_data data; + size_t len; + + if (!name || !strlen(name)) { + bt_shell_printf("Public Broadcast Name cannot be empty\n"); + return false; + } + + len = strlen(name); + if (len > sizeof(data.data)) { + bt_shell_printf("Public Broadcast Name too long\n"); + return false; + } + + memset(&data, 0, sizeof(data)); + memcpy(data.data, name, len); + data.len = len; + + ad_clear_data(AD_TYPE_AD); + ad.data[AD_TYPE_AD].valid = true; + ad.data[AD_TYPE_AD].type = AD_TYPE_PUBLIC_BROADCAST_NAME; + ad.data[AD_TYPE_AD].data = data; + + g_dbus_emit_property_changed(conn, AD_PATH, AD_IFACE, + prop_names.data[AD_TYPE_AD]); + + return true; +} + static const char *ad_public_broadcast_state(void) { if (!ad_is_public_broadcast_uuid(ad.service[AD_TYPE_AD].uuid)) @@ -1202,6 +1259,23 @@ void ad_advertise_name(DBusConnection *conn, bool value) void ad_advertise_local_name(DBusConnection *conn, const char *name) { + if (ad_broadcast_in_use()) { + if (!name) { + ad_print_public_broadcast_name(); + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + } + + if (ad_has_public_broadcast_name() && + ad.data[AD_TYPE_AD].data.len == strlen(name) && + !memcmp(ad.data[AD_TYPE_AD].data.data, name, strlen(name))) + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + + if (!ad_set_public_broadcast_name(conn, name)) + return bt_shell_noninteractive_quit(EXIT_FAILURE); + + return bt_shell_noninteractive_quit(EXIT_SUCCESS); + } + if (!name) { if (ad.local_name) bt_shell_printf("LocalName: %s\n", ad.local_name); -- 2.43.0 ^ permalink raw reply related [flat|nested] 25+ messages in thread
end of thread, other threads:[~2026-04-29 13:50 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17 14:26 [PATCH BlueZ 0/1] client: add public-broadcast advertise helper raghava447
2026-03-17 14:26 ` [PATCH BlueZ 1/1] client: Add public-broadcast profile advertise command raghava447
2026-03-17 16:21 ` client: add public-broadcast advertise helper bluez.test.bot
2026-03-17 18:00 ` [PATCH BlueZ 1/1] client: Add public-broadcast profile advertise command Luiz Augusto von Dentz
2026-03-20 8:34 ` raghava447
2026-04-24 14:18 ` [PATCH BlueZ v2 0/2] client: Add public broadcast advertising support raghu447
2026-04-24 14:18 ` [PATCH v2 1/2] client: add public-broadcast advertising command raghu447
2026-04-24 14:41 ` Luiz Augusto von Dentz
2026-04-24 14:44 ` Luiz Augusto von Dentz
[not found] ` <19dd4843cc9.16a62f4c253537.8494966934612526917@collabora.com>
2026-04-28 14:42 ` Luiz Augusto von Dentz
2026-04-24 16:23 ` client: Add public broadcast advertising support bluez.test.bot
2026-04-24 14:18 ` [PATCH v2 2/2] client: make advertise.name use public broadcast name raghu447
2026-04-28 14:40 ` [PATCH BlueZ v3 0/2] client: Add public broadcast advertising support raghu447
2026-04-28 14:40 ` [PATCH BlueZ v3 1/2] client: add public-broadcast advertising command raghu447
2026-04-28 16:27 ` client: Add public broadcast advertising support bluez.test.bot
2026-04-29 6:10 ` [PATCH BlueZ v4 0/2] " raghu447
2026-04-29 6:10 ` [PATCH BlueZ v4 1/2] client: add public-broadcast advertising command raghu447
2026-04-29 6:46 ` client: Add public broadcast advertising support bluez.test.bot
2026-04-29 7:46 ` [PATCH BlueZ v5 0/2] " raghu447
2026-04-29 7:46 ` [PATCH BlueZ v5 1/2] client: add public-broadcast advertising command raghu447
2026-04-29 9:21 ` client: Add public broadcast advertising support bluez.test.bot
2026-04-29 7:46 ` [PATCH BlueZ v5 2/2] client: make advertise.name use public broadcast name raghu447
2026-04-29 13:50 ` [PATCH BlueZ v5 0/2] client: Add public broadcast advertising support patchwork-bot+bluetooth
2026-04-29 6:10 ` [PATCH BlueZ v4 2/2] client: make advertise.name use public broadcast name raghu447
2026-04-28 14:40 ` [PATCH BlueZ v3 " raghu447
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox