From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v3 03/16] shared/rap: Subscribe on-demand data with the requested transport
Date: Thu, 19 Nov 2026 12:16:11 -0500 [thread overview]
Message-ID: <20261119171625.1014004-4-luiz.dentz@gmail.com> (raw)
In-Reply-To: <20261119171625.1014004-1-luiz.dentz@gmail.com>
From: Cheng Jiang <cheng.jiang@oss.qualcomm.com>
The On-demand Ranging Data characteristic was always subscribed with
notifications, so an indication request from the Upper Tester was
ignored for the data characteristic, while the RAS Control Point,
Ranging Data Ready and Ranging Data Overwritten followed it.
RAS v1.0 Table 3.1 has it the other way around: On-demand Ranging Data
must support both notifications and indications, the RAS Control Point
supports only indications, and notifications are optional for Ranging
Data Ready and Ranging Data Overwritten. With notifications selected
the Control Point subscription was rejected, so no On-demand transfer
could be requested.
Use the requested transport for On-demand Ranging Data, always
subscribe to Control Point indications, and subscribe Ready and
Overwritten with indications when the server supports them, falling
back to notifications only when it does not. A server may send Ready
only as indications: PTS does so in RAP/REQ/ORD/BV-01-C.
Assisted-by: Claude:claude-opus-5-5
---
doc/org.bluez.ChannelSounding1.rst | 5 +++--
src/shared/rap.c | 32 +++++++++++++++++++++++-------
2 files changed, 28 insertions(+), 9 deletions(-)
diff --git a/doc/org.bluez.ChannelSounding1.rst b/doc/org.bluez.ChannelSounding1.rst
index 32c83e36f536..e75535b97092 100644
--- a/doc/org.bluez.ChannelSounding1.rst
+++ b/doc/org.bluez.ChannelSounding1.rst
@@ -275,8 +275,9 @@ CCCD subscriptions, then enables the selected mode.
``transport`` selects the CCCD value for Real-time or On-demand mode. It is
ignored for Disabled mode. Use ``0x01`` for notifications or ``0x02`` for
-indications. For On-demand mode, this applies to Control Point, Ready, and
-Overwritten; segmented On-demand Data always uses notifications.
+indications. For On-demand mode, this applies to On-demand Data. Control
+Point always uses indications, and Ready and Overwritten use indications
+if the peer supports them, notifications otherwise.
Raises ``org.bluez.Error.Failed`` when remote RAS discovery and Features read
have not completed, or the selected mode is unsupported by the peer.
diff --git a/src/shared/rap.c b/src/shared/rap.c
index 6de8111d1067..1c4b5239e1ba 100644
--- a/src/shared/rap.c
+++ b/src/shared/rap.c
@@ -4556,6 +4556,21 @@ static void ras_cp_response_notify_cb(struct bt_rap *rap,
}
}
+/* Indicate Ranging Data Ready and Ranging Data Overwritten when the server
+ * supports it; otherwise let the client fall back to notifications.
+ */
+static uint16_t rap_status_ccc(struct gatt_db_attribute *chrc)
+{
+ uint8_t props;
+
+ if (gatt_db_attribute_get_char_data(chrc, NULL, NULL, &props, NULL,
+ NULL) &&
+ !(props & BT_GATT_CHRC_PROP_INDICATE))
+ return 0;
+
+ return BT_RAP_RANGING_INDICATE;
+}
+
/* Initiator role: subscribe to a single on-demand-related characteristic,
* logging (not failing) on any missing attribute/handle so a
* partially-capable peer doesn't block subscription to the others.
@@ -4637,21 +4652,24 @@ static bool rap_subscribe_ranging_data(struct bt_rap *rap,
if (mode == BT_RAP_RANGING_DATA_ONDEMAND) {
uint16_t value_handle;
- /* Data is segmented and can be large, so keep it on
- * notifications. The control and status characteristics use
- * the requested transport.
+ /* Only the data characteristic follows the requested
+ * transport (RAS v1.0 Table 3.1). The RAS Control Point can
+ * only be indicated, and Ranging Data Ready and Ranging Data
+ * Overwritten are indicated whenever the server supports it,
+ * since a server may send them only as indications.
*/
rap_subscribe_ondemand_chrc(rap, ras->ondemand_chrc,
- BT_RAP_RANGING_NOTIFY, ras_segment_notify_cb,
+ rap->ondemand_ccc_value, ras_segment_notify_cb,
"on-demand", &rap->ondemand_notify_id);
rap_subscribe_ondemand_chrc(rap, ras->cp_chrc,
- rap->ondemand_ccc_value, ras_cp_response_notify_cb,
+ BT_RAP_RANGING_INDICATE, ras_cp_response_notify_cb,
"RAS Control Point", &rap->cp_notify_id);
rap_subscribe_ondemand_chrc(rap, ras->ready_chrc,
- rap->ondemand_ccc_value, ras_data_ready_notify_cb,
+ rap_status_ccc(ras->ready_chrc),
+ ras_data_ready_notify_cb,
"Ranging Data Ready", &rap->ready_notify_id);
rap_subscribe_ondemand_chrc(rap, ras->overwritten_chrc,
- rap->ondemand_ccc_value,
+ rap_status_ccc(ras->overwritten_chrc),
ras_data_overwritten_notify_cb,
"Ranging Data Overwritten",
&rap->overwritten_notify_id);
--
2.56.0
next prev parent reply other threads:[~2026-11-19 17:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 17:16 [PATCH BlueZ v3 00/16] Channel Sounding and RAP fixes Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 01/16] gatt-database: Drop stale device state for removed bonds Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 02/16] shared/rap: Reset the readable Ranging Counters per connection Luiz Augusto von Dentz
2026-11-19 17:16 ` Luiz Augusto von Dentz [this message]
2026-11-19 17:16 ` [PATCH BlueZ v3 04/16] shared/rap: Subscribe to Ranging Data when a measurement starts Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 05/16] client/cs: Fix use-after-free in stop_measurement_reply Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 06/16] shared/hci: Look up the connection handle on the right link Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 07/16] profiles/ranging: Let the Reflector run the CS setup phase Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 08/16] profiles/ranging: Let StartMeasurement() pick the Initiator for Both Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 09/16] profiles/ranging: Take the CS role from Config Complete Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 10/16] profiles/ranging: Act on a CS configuration created by the peer Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 11/16] profiles/ranging: Keep a peer-driven setup from being rewound Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 12/16] profiles/ranging: Defer CS Security Enable until the link is encrypted Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 13/16] profiles/ranging: Choose the CS antenna configuration from both ends Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 14/16] profiles/ranging: Do not start a procedure after StopMeasurement() Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 15/16] shared/rap: Start the Real-time timeout when the procedure starts Luiz Augusto von Dentz
2026-11-19 17:16 ` [PATCH BlueZ v3 16/16] unit/test-rap: Add tests for Ranging Data subscription and counters 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=20261119171625.1014004-4-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--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