Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ v3 0/5] Add Role property to org.bluez.Bearer.LE1
@ 2026-10-09 18:04 Kevin Dewald
  2026-10-09 18:04 ` [PATCH BlueZ v3 1/5] org.bluez.Bearer: Add Role property Kevin Dewald
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Kevin Dewald @ 2026-10-09 18:04 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Luiz Augusto von Dentz, Kevin Dewald

Applications acting as a peripheral, or in both roles, cannot tell
whether a connected device is a central that connected to the adapter
or a peripheral the adapter connected to. When several applications
share the adapter, a device object can appear because of any of them,
so the order of events does not answer it either.

bluetoothd already tracks this per bearer from the Device Connected
event. This series exposes it as a Role property on
org.bluez.Bearer.LE1, "central" or "peripheral", present only while
the device is connected over LE, and prints it as LE.Role in
bluetoothctl info. The documentation states that it is the link layer
role and says nothing about GATT client and server roles.

As a step towards marking the bearer interfaces stable, the series also
adds functional tests for them, test/functional/test_bearer.py,
described in doc/functional-bearer.rst. Two hosts connect or pair over
LE or BR/EDR, and each checks the bearer interfaces of the device
object it has for the other: Connect and Disconnect, Connected and the
Disconnected signal with its reason, Paired and Bonded, Connectable for
a connectable advertiser and for a broadcaster, and Role on both sides
of an LE connection.

The five tests take about 45 seconds and passed in five consecutive
runs, and the rest of test-functional still passes.

If these tests cover what you had in mind, I can follow up with a patch
marking the bearer interfaces stable.

Changes in v3:
- Add functional tests for the bearer interfaces, with their
  documentation (Luiz)

Changes in v2:
- Move the property from org.bluez.Device1 to org.bluez.Bearer.LE1, so
  it is clearly per connection (Luiz)
- State in the documentation that it says nothing about GATT roles
  (Luiz)

Kevin Dewald (5):
  org.bluez.Bearer: Add Role property
  bearer: Add Role property
  client: Print LE.Role in info
  doc: Add functional-bearer documentation
  test: functional: add bearer tests

 Makefile.am                    |   1 +
 client/main.c                  |   1 +
 doc/functional-bearer.rst      | 141 +++++++++++++++
 doc/functional-testing.rst     |   1 +
 doc/org.bluez.Bearer.LE.rst    |  24 +++
 src/bearer.c                   |  42 +++++
 src/device.c                   |   5 +
 src/device.h                   |   1 +
 test/functional/test_bearer.py | 302 +++++++++++++++++++++++++++++++++
 9 files changed, 518 insertions(+)
 create mode 100644 doc/functional-bearer.rst
 create mode 100644 test/functional/test_bearer.py

-- 
2.54.0 (Apple Git-157)


^ permalink raw reply	[flat|nested] 9+ messages in thread
* [PATCH BlueZ v2 1/3] org.bluez.Bearer: Add Role property
@ 2026-10-08 17:29 Kevin Dewald
  2026-10-08 22:35 ` Add Role property to org.bluez.Bearer.LE1 bluez.test.bot
  0 siblings, 1 reply; 9+ messages in thread
From: Kevin Dewald @ 2026-10-08 17:29 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Luiz Augusto von Dentz, Kevin Dewald

This adds Role property to org.bluez.Bearer.LE1 which indicates whether
the remote device is the central or the peripheral of the current LE
connection, so applications can tell a central that connected to the
adapter from a peripheral the adapter connected to.

Assisted-by: Claude:claude-opus-5.5
---
 doc/org.bluez.Bearer.LE.rst | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/doc/org.bluez.Bearer.LE.rst b/doc/org.bluez.Bearer.LE.rst
index ec92a5ce5..dfd809739 100644
--- a/doc/org.bluez.Bearer.LE.rst
+++ b/doc/org.bluez.Bearer.LE.rst
@@ -153,3 +153,27 @@ The property is only present once the device has been discovered or connected
 over LE bearer.
 
 A PropertiesChanged signal indicate changes to this status.
+
+string Role [readonly, optional, experimental]
+``````````````````````````````````````````````
+
+Indicates the role of the remote device in the current connection on LE bearer.
+It is only present while the remote device is connected over LE bearer.
+
+It is the link layer role of the connection. It does not imply which side acts
+as GATT client or server, as GATT roles are independent of it and both may be
+used at the same time.
+
+Possible values:
+
+:"central":
+
+	The remote device initiated the connection, and the adapter is the
+	peripheral.
+
+:"peripheral":
+
+	The adapter initiated the connection, and the remote device is the
+	peripheral.
+
+A PropertiesChanged signal indicate changes to this status.
-- 
2.54.0 (Apple Git-157)


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

end of thread, other threads:[~2026-10-09 21:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09 18:04 [PATCH BlueZ v3 0/5] Add Role property to org.bluez.Bearer.LE1 Kevin Dewald
2026-10-09 18:04 ` [PATCH BlueZ v3 1/5] org.bluez.Bearer: Add Role property Kevin Dewald
2026-10-09 21:01   ` Add Role property to org.bluez.Bearer.LE1 bluez.test.bot
2026-10-09 18:04 ` [PATCH BlueZ v3 2/5] bearer: Add Role property Kevin Dewald
2026-10-09 18:04 ` [PATCH BlueZ v3 3/5] client: Print LE.Role in info Kevin Dewald
2026-10-09 18:04 ` [PATCH BlueZ v3 4/5] doc: Add functional-bearer documentation Kevin Dewald
2026-10-09 18:04 ` [PATCH BlueZ v3 5/5] test: functional: add bearer tests Kevin Dewald
2026-10-09 20:50 ` [PATCH BlueZ v3 0/5] Add Role property to org.bluez.Bearer.LE1 patchwork-bot+bluetooth
  -- strict thread matches above, loose matches on Subject: below --
2026-10-08 17:29 [PATCH BlueZ v2 1/3] org.bluez.Bearer: Add Role property Kevin Dewald
2026-10-08 22:35 ` Add Role property to org.bluez.Bearer.LE1 bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox