Skip to contentSkip to conversation

audio/hfp-hf: Fix org.bluez.Telephony1.Dial reply message

PATCH Applied Frédéric Danis 3 participants 3 messages Nov 15 – Nov 16 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 audio/hfp-hf: Fix org.bluez.Telephony1.Dial reply message

From: Frédéric Danis <[email protected]>

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(-)
profiles/audio/hfp-hf.c +48 -3
index 4e626653d..bc6d7229f 100644
@@ -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;
 }
Signature · 1 line
2.43.0
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1211774/

---Test result---

Test Summary:

CheckPatch                    PASS      0.51 seconds
GitLint                       PASS      0.33 seconds
BuildEll                      PASS      16.18 seconds
BluezMake                     PASS      233.84 seconds
MakeCheck                     PASS      3.25 seconds
MakeDistcheck                 PASS      121.14 seconds
CheckValgrind                 PASS      129.54 seconds
CheckSmatch                   PASS      234.35 seconds
bluezmakeextell               PASS      75.96 seconds
TestFunctional                FAIL      1015.95 seconds
IncrementalBuild              PASS      235.24 seconds
ScanBuild                     PASS      874.81 seconds

Details
##############################
Test: TestFunctional - FAIL
Desc: Run test-functional
Output:
FAIL functional.test_bap::test_bass_past_earbuds_transport_acquire[hosts11-vm3]: AssertionError: Failed to acquire: org.bluez.Error.Failed

https://github.com/bluez/bluez/pull/2829

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Frédéric Danis
This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluez.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 7 lines · On Sun, 15 Nov 2026 11:19:07 +0100 you wrote:

From: Frédéric Danis <[email protected]>

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(-)

Here is the summary with links:
- [BlueZ] audio/hfp-hf: Fix org.bluez.Telephony1.Dial reply message

    https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=b5deaf496419

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html