Linux bluetooth development
 help / color / mirror / Atom feed
From: Kevin Dewald <kevin@simpleble.org>
To: linux-bluetooth@vger.kernel.org
Cc: Kevin Dewald <kevin@simpleble.org>
Subject: [PATCH BlueZ 0/3] Add Role property to org.bluez.Device
Date: Thu,  8 Oct 2026 06:36:31 -0700	[thread overview]
Message-ID: <20261008133634.30362-1-kevin@simpleble.org> (raw)

Applications acting as a peripheral, or in both roles, cannot tell
from org.bluez.Device1 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 knows: the kernel flags connections the adapter
initiated in the Device Connected event, and bluetoothd keeps that per
bearer and uses it, e.g. to decide whether to discover the remote GATT
database. This series exposes it as a Role property, "central" or
"peripheral", present only while the device is connected over LE, and
prints it in bluetoothctl info.

It is limited to LE since an LE connection keeps its roles for its
lifetime, while BR/EDR roles can switch and the switch is not reported
to bluetoothd. It describes the link only, not GATT client and server
roles, and nothing is stored. Other stacks report the same per
connection, e.g. Zephyr's bt_conn_info role and NimBLE's
ble_gap_conn_desc role.

Tested with two btvirt controllers, where the advertising side reports
the other as "central" and the connecting side reports it as
"peripheral", and with a real adapter connecting to an nRF52840. The
property goes away when the connection does.

Kevin Dewald (3):
  org.bluez.Device: Add Role property
  device: Add Role property
  client: Print Role in info

 client/main.c            |  1 +
 doc/org.bluez.Device.rst | 20 ++++++++++++++++++++
 src/device.c             | 31 +++++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+)

-- 
2.54.0 (Apple Git-157)


             reply	other threads:[~2026-10-08 13:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 13:36 Kevin Dewald [this message]
2026-10-08 13:36 ` [PATCH BlueZ 1/3] org.bluez.Device: Add Role property Kevin Dewald
2026-10-08 17:46   ` Add Role property to org.bluez.Device bluez.test.bot
2026-10-08 13:36 ` [PATCH BlueZ 2/3] device: Add Role property Kevin Dewald
2026-10-08 13:36 ` [PATCH BlueZ 3/3] client: Print Role in info Kevin Dewald
2026-10-08 14:37 ` [PATCH BlueZ 0/3] Add Role property to org.bluez.Device Luiz Augusto von Dentz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261008133634.30362-1-kevin@simpleble.org \
    --to=kevin@simpleble.org \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox