From: "Frédéric Danis" <frederic.danis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ 04/12] shared/hfp: Add hangup all calls support
Date: Fri, 25 Sep 2026 15:25:20 +0200 [thread overview]
Message-ID: <20260925132528.3361517-5-frederic.danis@collabora.com> (raw)
In-Reply-To: <20260925132528.3361517-1-frederic.danis@collabora.com>
From: Frédéric Danis <frederic.danis.oss@gmail.com>
This releases all calls except waiting calls. This includes
multiparty calls.
---
src/shared/hfp.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
src/shared/hfp.h | 3 +++
2 files changed, 50 insertions(+)
diff --git a/src/shared/hfp.c b/src/shared/hfp.c
index 59e09f80e..f9fa53ae4 100644
--- a/src/shared/hfp.c
+++ b/src/shared/hfp.c
@@ -2970,6 +2970,53 @@ bool hfp_hf_swap_calls(struct hfp_hf *hfp,
return hfp_hf_send_command(hfp, resp_cb, user_data, "AT+CHLD=2");
}
+bool hfp_hf_hangup_all(struct hfp_hf *hfp,
+ hfp_response_func_t resp_cb,
+ void *user_data)
+{
+ bool found_active = false;
+ bool found_held = false;
+ const struct queue_entry *entry;
+
+ if (!hfp)
+ return false;
+
+ DBG(hfp, "");
+
+ for (entry = queue_get_entries(hfp->calls); entry;
+ entry = entry->next) {
+ struct hf_call *call = entry->data;
+
+ if (call_setup_match(call, NULL) ||
+ call_active_match(call, NULL)) {
+ found_active = true;
+ } else if (call_held_match(call, NULL)) {
+ found_held = true;
+ }
+ }
+
+ if (!found_active && !found_held)
+ return false;
+
+ if (found_held && (hfp->chlds & HFP_CHLD_0)) {
+ if (!hfp_hf_send_command(hfp, resp_cb, user_data,
+ "AT+CHLD=0")) {
+ DBG(hfp, "Failed to hangup held calls");
+ return false;
+ }
+ }
+
+ if (found_active) {
+ if (!hfp_hf_send_command(hfp, resp_cb, user_data,
+ "AT+CHUP")) {
+ DBG(hfp, "Failed to hangup active calls");
+ return false;
+ }
+ }
+
+ return true;
+}
+
bool hfp_hf_call_answer(struct hfp_hf *hfp, uint id,
hfp_response_func_t resp_cb,
void *user_data)
diff --git a/src/shared/hfp.h b/src/shared/hfp.h
index 201777605..77ada40b6 100644
--- a/src/shared/hfp.h
+++ b/src/shared/hfp.h
@@ -258,6 +258,9 @@ bool hfp_hf_release_and_accept(struct hfp_hf *hfp,
bool hfp_hf_swap_calls(struct hfp_hf *hfp,
hfp_response_func_t resp_cb,
void *user_data);
+bool hfp_hf_hangup_all(struct hfp_hf *hfp,
+ hfp_response_func_t resp_cb,
+ void *user_data);
bool hfp_hf_call_answer(struct hfp_hf *hfp, uint id,
hfp_response_func_t resp_cb,
void *user_data);
--
2.43.0
next prev parent reply other threads:[~2026-09-25 13:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 13:25 [PATCH BlueZ 00/12] hfp-hf: Enhance HFP Hands-Free profile support Frédéric Danis
2026-09-25 13:25 ` [PATCH BlueZ 01/12] audio/hfp-hf: Add HFP HF server and SDP record Frédéric Danis
2026-09-25 15:37 ` hfp-hf: Enhance HFP Hands-Free profile support bluez.test.bot
2026-09-25 13:25 ` [PATCH BlueZ 02/12] audio/hfp-hf: Add MediaEndpoint for HFP codecs Frédéric Danis
2026-09-25 13:25 ` [PATCH BlueZ 03/12] client/player: Add MediaEndpoints for HFP HF codecs Frédéric Danis
2026-09-25 13:25 ` Frédéric Danis [this message]
2026-09-25 13:25 ` [PATCH BlueZ 05/12] audio/hfp-hf: Add hangup all calls support Frédéric Danis
2026-09-25 13:25 ` [PATCH BlueZ 06/12] shared/hfp: Add send tones support Frédéric Danis
2026-09-25 13:25 ` [PATCH BlueZ 07/12] audio/hfp-hf: Add Send Tones support Frédéric Danis
2026-09-25 13:25 ` [PATCH BlueZ 08/12] client/telephony: Add Send Tones menu entry Frédéric Danis
2026-09-25 13:25 ` [PATCH BlueZ 09/12] audio/hfp-hf: Add multi calls support Frédéric Danis
2026-09-25 13:25 ` [PATCH BlueZ 10/12] client/telephony: " Frédéric Danis
2026-09-25 13:25 ` [PATCH BlueZ 11/12] shared/hfp: Add codecs support Frédéric Danis
2026-09-25 13:25 ` [PATCH BlueZ 12/12] audio/hfp-hf: " Frédéric Danis
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=20260925132528.3361517-5-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