public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: "Frédéric Danis" <frederic.danis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ v2 3/6] shared/hfp: Add in-band ring tone setting support
Date: Thu,  9 Oct 2025 21:58:39 +0200	[thread overview]
Message-ID: <20251009195842.776231-3-frederic.danis@collabora.com> (raw)
In-Reply-To: <20251009195842.776231-1-frederic.danis@collabora.com>

---
 src/shared/hfp.c | 16 ++++++++++++++++
 src/shared/hfp.h |  1 +
 2 files changed, 17 insertions(+)

diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index a6f9645d8..bc81a07ee 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -1752,6 +1752,20 @@ static bool call_active_match(const void *data, const void *match_data)
 	return (call->status == CALL_STATUS_ACTIVE);
 }
 
+static void bsir_cb(struct hfp_context *context, void *user_data)
+{
+	struct hfp_hf *hfp = user_data;
+	unsigned int val;
+
+	DBG(hfp, "");
+
+	if (!hfp_context_get_number(context, &val))
+		return;
+
+	if (hfp->callbacks && hfp->callbacks->update_inband_ring)
+		hfp->callbacks->update_inband_ring(!!val, hfp->callbacks_data);
+}
+
 static void ciev_callsetup_cb(uint8_t val, void *user_data)
 {
 	struct hfp_hf *hfp = user_data;
@@ -2083,6 +2097,8 @@ static void slc_cmer_resp(enum hfp_result result, enum hfp_error cme_err,
 	}
 
 	/* Register unsolicited results handlers */
+	if (hfp->features & HFP_AG_FEAT_IN_BAND_RING_TONE)
+		hfp_hf_register(hfp, bsir_cb, "+BSIR", hfp, NULL);
 	hfp_hf_register(hfp, ciev_cb, "+CIEV", hfp, NULL);
 	hfp_hf_register(hfp, clip_cb, "+CLIP", hfp, NULL);
 	hfp_hf_register(hfp, cops_cb, "+COPS", hfp, NULL);
diff --git a/src/shared/hfp.h b/src/shared/hfp.h
index 21214eee4..27315bfa0 100644
--- a/src/shared/hfp.h
+++ b/src/shared/hfp.h
@@ -201,6 +201,7 @@ struct hfp_hf_callbacks {
 	void (*update_indicator)(enum hfp_indicator indicator, uint32_t val,
 							void *user_data);
 	void (*update_operator)(const char *operator_name, void *user_data);
+	void (*update_inband_ring)(bool enabled, void *user_data);
 
 	void (*call_added)(uint id, enum hfp_call_status status,
 							void *user_data);
-- 
2.43.0


  parent reply	other threads:[~2025-10-09 19:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09 19:58 [PATCH BlueZ v2 1/6] shared/hfp: Add dial support Frédéric Danis
2025-10-09 19:58 ` [PATCH BlueZ v2 2/6] unit/test-hfp: Add dial tests for HF Frédéric Danis
2025-10-09 19:58 ` Frédéric Danis [this message]
2025-10-09 19:58 ` [PATCH BlueZ v2 4/6] unit/test-hfp: Add Answer Incoming Call with In-Band Ring " Frédéric Danis
2025-10-09 19:58 ` [PATCH BlueZ v2 5/6] unit/test-hfp: Add incoming call prior to connection test Frédéric Danis
2025-10-09 19:58 ` [PATCH BlueZ v2 6/6] unit/test-hfp: Add incoming call interrupted test Frédéric Danis
2025-10-09 21:31 ` [BlueZ,v2,1/6] shared/hfp: Add dial support bluez.test.bot
2025-10-13 16:00 ` [PATCH BlueZ v2 1/6] " patchwork-bot+bluetooth

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=20251009195842.776231-3-frederic.danis@collabora.com \
    --to=frederic.danis@collabora.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