Linux bluetooth development
 help / color / mirror / Atom feed
From: Naga Bhavani Akella <naga.akella@oss.qualcomm.com>
To: linux-bluetooth@vger.kernel.org
Cc: luiz.dentz@gmail.com, quic_mohamull@quicinc.com,
	quic_hbandi@quicinc.com, quic_anubhavg@quicinc.com,
	Naga Bhavani Akella <naga.akella@oss.qualcomm.com>
Subject: [PATCH BlueZ v1 2/6] profiles: update bt_rap_attach_hci call to drop default settings args
Date: Tue, 30 Jun 2026 15:41:54 +0530	[thread overview]
Message-ID: <20260630101158.2239682-3-naga.akella@oss.qualcomm.com> (raw)
In-Reply-To: <20260630101158.2239682-1-naga.akella@oss.qualcomm.com>

role, cs_sync_ant_sel and max_tx_power are no longer passed at attach
time. They are applied via bt_rap_set_default_settings_params() in
start_measurement where they belong, alongside the other per-session
CS parameters
---
 profiles/ranging/rap.c     |  7 ++-----
 profiles/ranging/rap_hci.c | 27 ++++++++++-----------------
 2 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/profiles/ranging/rap.c b/profiles/ranging/rap.c
index fa3e27328..da6f1241b 100644
--- a/profiles/ranging/rap.c
+++ b/profiles/ranging/rap.c
@@ -383,11 +383,8 @@ static int rap_accept(struct btd_service *service)
 
 	/* per-device HCI state machine */
 	if (!data->hci_sm) {
-		data->hci_sm = bt_rap_attach_hci(data->rap,
-					data->adapter_data->hci,
-					btd_opts.defaults.bcs.role,
-					btd_opts.defaults.bcs.cs_sync_ant_sel,
-					btd_opts.defaults.bcs.max_tx_power);
+		data->hci_sm = bt_rap_attach_hci_v2(data->rap,
+					data->adapter_data->hci);
 		if (!data->hci_sm) {
 			error("Failed to attach HCI state machine for device");
 			rap_adapter_data_unref(data->adapter_data);
diff --git a/profiles/ranging/rap_hci.c b/profiles/ranging/rap_hci.c
index 13f1365f3..8726ce824 100644
--- a/profiles/ranging/rap_hci.c
+++ b/profiles/ranging/rap_hci.c
@@ -169,9 +169,7 @@ static void remove_conn_mapping(struct cs_state_machine *sm, uint16_t handle)
 
 /*  State Machine Functions */
 static void cs_state_machine_init(struct cs_state_machine *sm,
-				struct bt_rap *rap, struct bt_hci *hci,
-				uint8_t role, uint8_t cs_sync_ant_sel,
-				int8_t max_tx_power)
+				struct bt_rap *rap, struct bt_hci *hci)
 {
 	if (!sm)
 		return;
@@ -183,16 +181,18 @@ static void cs_state_machine_init(struct cs_state_machine *sm,
 	sm->procedure_active = false;
 	sm->conn_mappings = queue_new();
 
-	/* Store role_enable for HCI commands (1, 2, or 3 from config) */
-	sm->role_enable = role;
+	/* Defaults — caller
+	 * should follow up with bt_rap_set_default_settings_params()
+	 */
+	sm->role_enable = 0x03;
 
 	/* Initialize per-instance CS options
 	 * Note: cs_opt.role will be overwritten with actual role (0x00 or 0x01)
 	 * from config complete event, but role_enable preserves the HCI value
 	 */
-	sm->cs_opt.role = role;
-	sm->cs_opt.cs_sync_ant_sel = cs_sync_ant_sel;
-	sm->cs_opt.max_tx_power = max_tx_power;
+	sm->cs_opt.role = 0x03;
+	sm->cs_opt.cs_sync_ant_sel = 0xFF;
+	sm->cs_opt.max_tx_power = 0x14;
 	sm->cs_opt.rtt_type = 0;  /* Will be set from config complete event */
 }
 
@@ -1533,9 +1533,7 @@ static void unregister_event_id(void *data, void *user_data)
 	bt_hci_unregister_subevent(hci, PTR_TO_UINT(data));
 }
 
-void *bt_rap_attach_hci(struct bt_rap *rap, struct bt_hci *hci,
-			uint8_t role, uint8_t cs_sync_ant_sel,
-			int8_t max_tx_power)
+void *bt_rap_attach_hci_v2(struct bt_rap *rap, struct bt_hci *hci)
 {
 	struct cs_state_machine *sm;
 	unsigned int id;
@@ -1552,9 +1550,7 @@ void *bt_rap_attach_hci(struct bt_rap *rap, struct bt_hci *hci,
 		return NULL;
 	}
 
-	/* Initialize state machine with provided CS options */
-	cs_state_machine_init(sm, rap, hci, role, cs_sync_ant_sel,
-				max_tx_power);
+	cs_state_machine_init(sm, rap, hci);
 
 	sm->event_ids = queue_new();
 	if (!sm->event_ids) {
@@ -1621,9 +1617,6 @@ void *bt_rap_attach_hci(struct bt_rap *rap, struct bt_hci *hci,
 
 	queue_push_tail(sm->event_ids, UINT_TO_PTR(id));
 
-	DBG("CS options: role=%u, cs_sync_ant_sel=%u, max_tx_power=%d",
-		role, cs_sync_ant_sel, max_tx_power);
-
 	/* place holder, need DBus API to be called */
 	bt_rap_read_local_supported_capabilities(sm);
 
-- 


  parent reply	other threads:[~2026-06-30 10:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30 10:11 [PATCH BlueZ v1 0/6] RAP: Move CS default settings Naga Bhavani Akella
2026-06-30 10:11 ` [PATCH BlueZ v1 1/6] shared: remove default settings params from bt_rap_attach_hci Naga Bhavani Akella
2026-06-30 12:20   ` RAP: Move CS default settings bluez.test.bot
2026-06-30 10:11 ` Naga Bhavani Akella [this message]
2026-06-30 10:11 ` [PATCH BlueZ v1 3/6] rap: remove CS default settings from main.conf Naga Bhavani Akella
2026-06-30 10:11 ` [PATCH BlueZ v1 4/6] shared: replace the wrapper API Naga Bhavani Akella
2026-06-30 10:11 ` [PATCH BlueZ v1 5/6] profiles: replace " Naga Bhavani Akella
2026-06-30 10:11 ` [PATCH BlueZ v1 6/6] shared: remove " Naga Bhavani Akella

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=20260630101158.2239682-3-naga.akella@oss.qualcomm.com \
    --to=naga.akella@oss.qualcomm.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=quic_anubhavg@quicinc.com \
    --cc=quic_hbandi@quicinc.com \
    --cc=quic_mohamull@quicinc.com \
    /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