From: "Frédéric Danis" <frederic.danis@collabora.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH BlueZ] audio/hfp-hf: Fix org.bluez.Telephony1.Dial reply message
Date: Sun, 15 Nov 2026 11:19:07 +0100 [thread overview]
Message-ID: <20261115101907.68963-1-frederic.danis@collabora.com> (raw)
From: Frédéric Danis <frederic.danis.oss@gmail.com>
An org.bluez.Call1 object is expected to be returned on
org.bluez.Telephony1.Dial() success.
---
profiles/audio/hfp-hf.c | 51 ++++++++++++++++++++++++++++++++++++++---
1 file changed, 48 insertions(+), 3 deletions(-)
diff --git a/profiles/audio/hfp-hf.c b/profiles/audio/hfp-hf.c
index 4e626653d..bc6d7229f 100644
--- a/profiles/audio/hfp-hf.c
+++ b/profiles/audio/hfp-hf.c
@@ -90,6 +90,7 @@ struct hfp_device {
uint8_t codec;
unsigned int resume_id;
struct connect_data *pending_connect;
+ DBusMessage *dial_msg;
hfp_hf_sco_closed_cb sco_closed_cb;
void *sco_closed_data;
};
@@ -192,6 +193,29 @@ static void sco_connect_complete(struct connect_data *connect_data, int status)
g_free(connect_data);
}
+static void dial_complete(enum hfp_result res, enum hfp_error cme_err,
+ void *user_data)
+{
+ struct hfp_device *dev = user_data;
+
+ if (dev->dial_msg == NULL)
+ return;
+
+ if (res != HFP_RESULT_OK) {
+ DBusMessage *reply;
+ const char *name = dbus_message_get_member(dev->dial_msg);
+
+ error("Command %s error: %d", name, res);
+ reply = g_dbus_create_error(dev->dial_msg, ERROR_INTERFACE
+ ".Failed",
+ "Command %s failed: %d", name, res);
+ g_dbus_send_message(btd_get_dbus_connection(), reply);
+ dbus_message_unref(dev->dial_msg);
+ dev->dial_msg = NULL;
+ return;
+ }
+}
+
static void device_destroy(struct hfp_device *dev)
{
struct hfp_server *server;
@@ -200,6 +224,10 @@ static void device_destroy(struct hfp_device *dev)
telephony_set_state(dev->telephony, DISCONNECTING);
+ if (dev->dial_msg)
+ dial_complete(HFP_RESULT_ERROR,
+ HFP_ERROR_NO_CONNECTION_TO_PHONE, dev);
+
if (dev->pending_connect)
sco_connect_complete(dev->pending_connect, -ENOTCONN);
@@ -288,10 +316,23 @@ static void hfp_hf_call_added(uint id, enum hfp_call_status status,
call->multiparty = mpty;
if (telephony_call_register_interface(call)) {
telephony_free_call(call);
+ if (status == CALL_STATUS_DIALING ||
+ status == CALL_STATUS_ALERTING)
+ dial_complete(HFP_RESULT_ERROR, HFP_ERROR_MEMORY_FULL,
+ dev);
return;
}
queue_push_tail(dev->calls, call);
+
+ if ((status == CALL_STATUS_DIALING || status == CALL_STATUS_ALERTING)
+ && dev->dial_msg) {
+ g_dbus_send_reply(btd_get_dbus_connection(), dev->dial_msg,
+ DBUS_TYPE_OBJECT_PATH, &call->path,
+ DBUS_TYPE_INVALID);
+ dbus_message_unref(dev->dial_msg);
+ dev->dial_msg = NULL;
+ }
}
static void hfp_hf_call_removed(uint id, void *user_data)
@@ -566,10 +607,14 @@ static DBusMessage *dial(DBusConnection *conn, DBusMessage *msg,
if (strncmp(number, URI_PREFIX, strlen(URI_PREFIX)) != 0)
return btd_error_invalid_args(msg);
- ret = hfp_hf_dial(dev->hf, number + strlen(URI_PREFIX), cmd_complete,
- dbus_message_ref(msg));
- if (!ret)
+ dev->dial_msg = dbus_message_ref(msg);
+ ret = hfp_hf_dial(dev->hf, number + strlen(URI_PREFIX), dial_complete,
+ dev);
+ if (!ret) {
+ dbus_message_unref(dev->dial_msg);
+ dev->dial_msg = NULL;
return btd_error_failed(msg, "Dial command failed");
+ }
return NULL;
}
--
2.43.0
reply other threads:[~2026-11-15 10:19 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261115101907.68963-1-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