device: Add btd_device_bdaddr_type_connected
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH v2 1/5 device: Add btd_device_bdaddr_type_connected
From: Luiz Augusto von Dentz <[email protected]>
This adds btd_device_bdaddr_type_connected which can return the connected state based on the address type.
--- src/device.c | 8 ++++++++ src/device.h | 1 + 2 files changed, 9 insertions(+)
src/device.c +8 -0
@@ -3632,6 +3632,14 @@ bool btd_device_bearer_is_connected(struct btd_device *dev)return dev->bredr_state.connected || dev->le_state.connected; } +bool btd_device_bdaddr_type_connected (struct btd_device *dev,uint8_t type) +{ +if (type ==BDADDR_BREDR ) +return dev->bredr_state.connected; + +return dev->le_state.connected; +} +static void clear_temporary_timer (struct btd_device *dev) {if (dev->temporary_timer) {
src/device.h +1 -0
@@ -110,6 +110,7 @@ void device_set_tx_power(struct btd_device *device, int8_t tx_power);void device_set_flags (struct btd_device *device,uint8_t flags);bool btd_device_is_connected (struct btd_device *dev);bool btd_device_bearer_is_connected (struct btd_device *dev); +bool btd_device_bdaddr_type_connected (struct btd_device *dev,uint8_t type);uint8_t btd_device_get_bdaddr_type (struct btd_device *dev);bool device_is_retrying (struct btd_device *device); void device_bonding_complete(struct btd_device *device, uint8_t bdaddr_type,
Signature · 1 line
2.50.0
Luiz Augusto von Dentz
maintainerPATCH v2 2/5 doc: Add org.bluez.Bearer.LE and org.bluez.Bearer.BREDR
From: Luiz Augusto von Dentz <[email protected]>
This adds bearer specific interfaces so they can properly be operated separately.
--- Makefile.am | 3 + doc/org.bluez.Bearer.BREDR.rst | 143 +++++++++++++++++++++++++++++++++ doc/org.bluez.Bearer.LE.rst | 143 +++++++++++++++++++++++++++++++++ 3 files changed, 289 insertions(+) create mode 100644 doc/org.bluez.Bearer.BREDR.rst create mode 100644 doc/org.bluez.Bearer.LE.rst
Makefile.am +3 -0
@@ -358,6 +358,7 @@ if MANPAGES man_MANS += src/bluetoothd.8 man_MANS += doc/hci.7 doc/mgmt.7 doc/l2cap.7 doc/rfcomm.7 doc/sco.7 man_MANS += doc/org.bluez.Adapter.5 doc/org.bluez.Device.5 \ + doc/org.bluez.Bearer.LE.5 doc/org.bluez.Bearer.BREDR.5 \ doc/org.bluez.DeviceSet.5 doc/org.bluez.AgentManager.5 \ doc/org.bluez.Agent.5 doc/org.bluez.ProfileManager.5 \ doc/org.bluez.Profile.5 doc/org.bluez.NetworkServer.5 \
@@ -392,6 +393,7 @@ endif manual_pages += src/bluetoothd.8 manual_pages += doc/hci.7 doc/mgmt.7 doc/l2cap.7 doc/rfcomm.7 doc/sco.7 manual_pages += doc/org.bluez.Adapter.5 doc/org.bluez.Device.5 \ + doc/org.bluez.Bearer.LE.5 doc/org.bluez.Bearer.BREDR.5 \ doc/org.bluez.DeviceSet.5 doc/org.bluez.AgentManager.5 \ doc/org.bluez.Agent.5 doc/org.bluez.ProfileManager.5 \ doc/org.bluez.Profile.5 doc/org.bluez.NetworkServer.5 \
@@ -470,6 +472,7 @@ EXTRA_DIST += doc/health-api.txt \ EXTRA_DIST += doc/hci.rst doc/mgmt.rst doc/l2cap.rst doc/rfcomm.rst doc/sco.rst EXTRA_DIST += doc/org.bluez.Adapter.rst doc/org.bluez.Device.rst \ + doc/org.bluez.Bearer.LE.rst doc/org.bluez.Bearer.BREDR.rst \ doc/org.bluez.DeviceSet.rst doc/org.bluez.AgentManager.rst \ doc/org.bluez.Agent.rst doc/org.bluez.ProfileManager.rst \ doc/org.bluez.Profile.rst doc/org.bluez.NetworkServer.rst \
doc/org.bluez.Bearer.BREDR.rst new file +143 -0
143 lines not on this page · raw message
doc/org.bluez.Bearer.LE.rst new file +143 -0
143 lines not on this page · raw message
Signature · 1 line
2.50.0
Luiz Augusto von Dentz
maintainerPATCH v2 3/5 bearer: Add initial implementation of org.bluez.Bearer.{BREDR, LE}
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This adds initial implementation of org.bluez.Bearer{BREDR, LE}(5) interfaces.
--- Makefile.am | 3 +- src/bearer.c | 260 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/bearer.h | 22 +++++ src/device.c | 66 ++++++++++--- 4 files changed, 339 insertions(+), 12 deletions(-) create mode 100644 src/bearer.c create mode 100644 src/bearer.h
Makefile.am +2 -1
@@ -330,7 +330,8 @@ src_bluetoothd_SOURCES = $(builtin_sources) \ src/adv_monitor.h src/adv_monitor.c \ src/battery.h src/battery.c \ src/settings.h src/settings.c \ - src/set.h src/set.c + src/set.h src/set.c \ + src/bearer.h src/bearer.c src_bluetoothd_LDADD = lib/libbluetooth-internal.la \ gdbus/libgdbus-internal.la \ src/libshared-glib.la \
src/bearer.c new file +260 -0
260 lines not on this page · raw message
src/bearer.h new file +22 -0
@@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* +* +* BlueZ - Bluetooth protocol stack for Linux +* +* Copyright (C) 2025 Intel Corporation +* +* +*/ + +#define BTD_BEARER_BREDR_INTERFACE "org.bluez.Bearer.BREDR1" +#define BTD_BEARER_LE_INTERFACE "org.bluez.Bearer.LE1" + +struct btd_bearer ; + +struct btd_bearer *btd_bearer_new (struct btd_device *device,uint8_t type); +void btd_bearer_destroy (struct btd_bearer *bearer); + +void btd_bearer_paired (struct btd_bearer *bearer); +void btd_bearer_bonded (struct btd_bearer *bearer); +void btd_bearer_connected (struct btd_bearer *bearer); +void btd_bearer_disconnected (struct btd_bearer *bearer,uint8_t reason);
src/device.c +55 -11
172 lines not on this page · raw message
Signature · 1 line
2.50.0
Luiz Augusto von Dentz
maintainerPATCH v2 4/5 client: Add support for org.bluez.Bearer.{BREDR, LE}1
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
This adds support for printing properties related to org.bluez.Bearer.{BREDR, LE}1:
Quoted 1 line
info XX:XX:XX:XX:XX:XX
...
BREDR.Paired: yes
BREDR.Bonded: yes
BREDR.Connected: no
LE.Paired: yes
LE.Bonded: yes
LE.Connected: no
...
[CHG] BREDR XX:XX:XX:XX:XX:XX Connected: yes
--- client/main.c | 124 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 122 insertions(+), 2 deletions(-)
client/main.c +122 -2
@@ -58,6 +58,7 @@ struct adapter {GDBusProxy *adv_monitor_proxy;GList *devices;GList *sets; +GList *bearers; };static struct adapter *default_ctrl;
@@ -452,6 +453,36 @@ static void set_added(GDBusProxy *proxy)bt_shell_set_env (g_dbus_proxy_get_path (proxy), proxy); } +static void print_bearer (GDBusProxy *proxy,const char *label, +const char *description) +{ +bt_shell_printf ("%s%s%s%s %s\n" , + description ?"[" :"" , + description ? :"" , + description ?"] " :"" , + label, +g_dbus_proxy_get_path (proxy)); +} + +static void bearer_added (GDBusProxy *proxy) +{ +struct adapter *adapter =find_parent (proxy); + +if (!adapter) +return ; + + adapter->bearers =g_list_append (adapter->bearers, proxy); + +if (!strcmp (g_dbus_proxy_get_interface (proxy), +"org.bluez.Bearer.BREDR1" )) +print_bearer (proxy,"BREDR" ,COLORED_NEW ); +else if (!strcmp (g_dbus_proxy_get_interface (proxy), +"org.bluez.Bearer.LE1" )) +print_bearer (proxy,"LE" ,COLORED_NEW ); + +bt_shell_set_env (g_dbus_proxy_get_path (proxy), proxy); +} +static void proxy_added (GDBusProxy *proxy,void *user_data) {const char *interface;
@@ -489,6 +520,10 @@ static void proxy_added(GDBusProxy *proxy, void *user_data)admon_manager_added (proxy); }else if (!strcmp (interface,"org.bluez.DeviceSet1" )) {set_added (proxy); + }else if (!strcmp (interface,"org.bluez.Bearer.BREDR1" )) { +bearer_added (proxy); + }else if (!strcmp (interface,"org.bluez.Bearer.LE1" )) { +bearer_added (proxy); } }
@@ -540,6 +575,7 @@ static void adapter_removed(GDBusProxy *proxy) ctrl_list =g_list_remove_link (ctrl_list, ll);g_list_free (adapter->devices);g_list_free (adapter->sets); +g_list_free (adapter->bearers);g_free (adapter);g_list_free (ll);return ;
@@ -560,6 +596,19 @@ static void set_removed(GDBusProxy *proxy)bt_shell_set_env (g_dbus_proxy_get_path (proxy),NULL ); } +static void bearer_removed (GDBusProxy *proxy) +{ +struct adapter *adapter =find_parent (proxy); + +if (!adapter) +return ; + + adapter->bearers =g_list_remove (adapter->bearers, proxy); + +print_set (proxy,COLORED_DEL ); +bt_shell_set_env (g_dbus_proxy_get_path (proxy),NULL ); +} +static void proxy_removed (GDBusProxy *proxy,void *user_data) {const char *interface;
@@ -602,6 +651,10 @@ static void proxy_removed(GDBusProxy *proxy, void *user_data)adv_monitor_remove_manager (dbus_conn); }else if (!strcmp (interface,"org.bluez.DeviceSet1" )) {set_removed (proxy); + }else if (!strcmp (interface,"org.bluez.Bearer.BREDR1" )) { +bearer_removed (proxy); + }else if (!strcmp (interface,"org.bluez.Bearer.LE1" )) { +bearer_removed (proxy); } }
@@ -619,6 +672,20 @@ static struct adapter *find_ctrl(GList *source, const char *path)return NULL ; } +static GDBusProxy *find_proxies_by_path (GList *source,const char *path) +{ +GList *list; + +for (list =g_list_first (source); list; list =g_list_next (list)) { +GDBusProxy *proxy = list->data; + +if (strcmp (g_dbus_proxy_get_path (proxy), path) ==0 ) +return proxy; + } + +return NULL ; +} +static void property_changed (GDBusProxy *proxy,const char *name,DBusMessageIter *iter,void *user_data) {
@@ -703,6 +770,36 @@ static void property_changed(GDBusProxy *proxy, const char *name,print_iter (str, name, iter);g_free (str); + }else if (!strcmp (interface,"org.bluez.Bearer.BREDR1" ) || + !strcmp (interface,"org.bluez.Bearer.LE1" )) { +if (default_ctrl && +proxy_is_child (proxy, default_ctrl->proxy)) { +DBusMessageIter addr_iter; +GDBusProxy *dev; +char *str; +bool le = !strcmp (interface,"org.bluez.Bearer.LE1" ); + + dev =find_proxies_by_path (default_ctrl->devices, +g_dbus_proxy_get_path (proxy)); +if (!dev) +return ; + +if (g_dbus_proxy_get_property (dev,"Address" , + &addr_iter)) { +const char *address; + +dbus_message_iter_get_basic (&addr_iter, + &address); + str =g_strdup_printf ("[" COLORED_CHG +"] %s %s " , + le ?"LE" :"BREDR" , + address); + }else + str =g_strdup ("" ); + +print_iter (str, name, iter); +g_free (str); + } } }
@@ -753,14 +850,17 @@ static struct adapter *find_ctrl_by_address(GList *source, const char *address)return NULL ; } -static GDBusProxy *find_proxies_by_path (GList *source,const char *path) +static GDBusProxy *find_proxies_by_iface (GList *source,const char *path, +const char *iface) {GList *list;for (list =g_list_first (source); list; list =g_list_next (list)) {GDBusProxy *proxy = list->data; -if (strcmp (g_dbus_proxy_get_path (proxy), path) ==0 ) +if (!strcmp (g_dbus_proxy_get_path (proxy), path) && + !strcmp (g_dbus_proxy_get_interface (proxy), + iface))return proxy; }
@@ -1728,6 +1828,7 @@ static void cmd_info(int argc, char *argv[]) {GDBusProxy *proxy;GDBusProxy *battery_proxy; +GDBusProxy *bearer;DBusMessageIter iter;const char *address;
@@ -1779,6 +1880,25 @@ static void cmd_info(int argc, char *argv[])print_property_with_label (battery_proxy,"Percentage" ,"Battery Percentage" ); + bearer =find_proxies_by_iface (default_ctrl->bearers, +g_dbus_proxy_get_path (proxy), +"org.bluez.Bearer.BREDR1" ); +if (bearer) { +print_property_with_label (proxy,"Paired" ,"BREDR.Paired" ); +print_property_with_label (proxy,"Bonded" ,"BREDR.Bonded" ); +print_property_with_label (proxy,"Connected" , +"BREDR.Connected" ); + } + + bearer =find_proxies_by_iface (default_ctrl->bearers, +g_dbus_proxy_get_path (proxy), +"org.bluez.Bearer.LE1" ); +if (bearer) { +print_property_with_label (proxy,"Paired" ,"LE.Paired" ); +print_property_with_label (proxy,"Bonded" ,"LE.Bonded" ); +print_property_with_label (proxy,"Connected" ,"LE.Connected" ); + } +return bt_shell_noninteractive_quit (EXIT_SUCCESS ); }
Signature · 1 line
2.50.0
Luiz Augusto von Dentz
maintainerPATCH v2 5/5 client: Rework handling of Disconnected signal
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
Print with color the signal to indicate there is a change, also rework the order of the parameters and use bearer specific suffix if the signal comes from org.bluez.Bearer.*.
--- client/main.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
client/main.c +17 -7
@@ -806,7 +806,11 @@ static void property_changed(GDBusProxy *proxy, const char *name,static void message_handler (DBusConnection *connection,DBusMessage *message,void *user_data) { -if (!strcmp (dbus_message_get_member (message),"Disconnected" )) { +const char *iface =dbus_message_get_interface (message); +const char *member =dbus_message_get_member (message); + +if (!strcmp (member,"Disconnected" )) { +const char *label;const char *name;const char *msg;
@@ -816,16 +820,22 @@ static void message_handler(DBusConnection *connection, DBUS_TYPE_INVALID)) goto failed; -bt_shell_printf ("[SIGNAL] %s.%s %s %s\n" , -dbus_message_get_interface (message), -dbus_message_get_member (message), - name, msg); +if (!strcmp (iface,"org.bluez.Bearer.BREDR1" )) + label ="BREDR.Disconnected" ; +else if (!strcmp (iface,"org.bluez.Bearer.LE1" )) + label ="LE.Disconnected" ; +else + label ="Disconnected" ; + +bt_shell_printf ("[" COLOR_YELLOW "SIGNAL" COLOR_OFF "] " +"%s - %s, %s\n" , + label, name, msg);return ; } failed: -bt_shell_printf ("[SIGNAL] %s.%s\n" ,dbus_message_get_interface (message), -dbus_message_get_member (message)); +bt_shell_printf ("[" COLOR_YELLOW "SIGNAL" COLOR_OFF "] %s.%s\n" , + iface, member); }static struct adapter *find_ctrl_by_address (GList *source,const char *address)
Signature · 1 line
2.50.0
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=982213
---Test result---
Test Summary:
CheckPatch PENDING 0.30 seconds GitLint PENDING 0.33 seconds BuildEll PASS 20.15 seconds BluezMake PASS 2519.77 seconds MakeCheck PASS 19.97 seconds MakeDistcheck PASS 183.84 seconds CheckValgrind PASS 236.40 seconds CheckSmatch PASS 306.15 seconds bluezmakeextell PASS 127.83 seconds IncrementalBuild PENDING 0.27 seconds ScanBuild PASS 908.01 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:
---
Regards,
Linux Bluetooth
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 8 lines · On Mon, 14 Jul 2025 16:35:15 -0400 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
This adds
btd_device_bdaddr_type_connectedwhich can return the connected state based on the address type.--- src/device.c | 8 ++++++++ src/device.h | 1 + 2 files changed, 9 insertions(+)
Here is the summary with links:
- [BlueZ,v2,1/5] device: Add btd_device_bdaddr_type_connected
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f406028b5d2e - [BlueZ,v2,2/5] doc: Add org.bluez.Bearer.LE and org.bluez.Bearer.BREDR https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=8c8b5ed25a88 - [BlueZ,v2,3/5] bearer: Add initial implementation of org.bluez.Bearer.{BREDR, LE} https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=fdfaeddc9c71 - [BlueZ,v2,4/5] client: Add support for org.bluez.Bearer.{BREDR, LE}1 https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=f4f8fe3e4813 - [BlueZ,v2,5/5] client: Rework handling of Disconnected signal https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=4c431e5dae3e
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html