Skip to contentSkip to conversation

shared/asha: send STOP without waiting for a response

PATCH Superseded Kyle Pepper 2 participants 4 messages Oct 13 – Oct 28

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 shared/asha: send STOP without waiting for a response

STOP resets local state without consuming the ATT response. Use a Write Command so an unresponsive renderer does not hold the request queue until timeout.

Test command semantics, failure handling and peer STATUS notification.

Fixes 9948168cca15 ("shared/asha: Don't wait for status notification on stop")
Assisted-by OpenCode:gpt-6.1-sol

---
Submission review notes (not part of the commit message):
Local validation is for base 7428ca2df9356363079db0f48412c20cbdb9471f. Compatibility with newer upstream tips has not been verified locally. This topic uses the verified STOP introducing commit as its Fixes tag. Existing N8 blocking-STOP failure evidence is retained; the new unit test mocks setup and GATT writes, not hardware or daemon concurrency.

 .gitignore            |  1 +
 Makefile.am           |  6 +++
 src/shared/asha.c     |  5 ++-
 unit/test-asha-stop.c | 97 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 107 insertions(+), 2 deletions(-)
 create mode 100644 unit/test-asha-stop.c
.gitignore +1 -0
index 06b24735df..8a4195c05a 100644
@@ -112,6 +112,7 @@ unit/test-lib
 unit/test-mgmt
 unit/test-uhid
 unit/test-hfp
+unit/test-asha-stop
 unit/test-crypto
 unit/test-ecc
 unit/test-hog
Makefile.am +6 -0
index f742458d11..6016913145 100644
@@ -706,6 +706,12 @@ unit_test_avrcp_LDADD = lib/libbluetooth-internal.la \
 
 unit_tests += unit/test-hfp
 
+unit_tests += unit/test-asha-stop
+
+unit_test_asha_stop_SOURCES = unit/test-asha-stop.c
+unit_test_asha_stop_LDADD = src/libshared-glib.la \
+	lib/libbluetooth-internal.la $(GLIB_LIBS)
+
 unit_test_hfp_SOURCES = unit/test-hfp.c
 unit_test_hfp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
src/shared/asha.c +3 -2
index 79bb29bf9a..0e6261d37d 100644
@@ -284,8 +284,9 @@ unsigned int bt_asha_stop(struct bt_asha *asha)
 
 	asha->state = ASHA_STOPPED;
 
-	ret = asha_send_acp(asha, acp_stop_cmd, sizeof(acp_stop_cmd), NULL,
-			NULL);
+	/* State is reset below without waiting for an ATT response. */
+	ret = asha_send_acp_without_response(asha, acp_stop_cmd,
+			sizeof(acp_stop_cmd));
 	asha_set_send_status(asha, false);
 
 	/* We reset our state without waiting for a response */
unit/test-asha-stop.c new file +97 -0

97 lines not on this page · raw message

base-commit: 7428ca2df9356363079db0f48412c20cbdb9471f

#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/1184353/

---Test result---

Test Summary:

CheckPatch                    PASS      0.39 seconds
GitLint                       PASS      0.23 seconds
BuildEll                      PASS      15.65 seconds
BluezMake                     PASS      223.77 seconds
MakeCheck                     PASS      13.57 seconds
MakeDistcheck                 PASS      114.78 seconds
CheckValgrind                 PASS      183.82 seconds
CheckSmatch                   PASS      219.50 seconds
bluezmakeextell               PASS      71.55 seconds
TestFunctional                FAIL      958.79 seconds
IncrementalBuild              PASS      225.37 seconds
ScanBuild                     PASS      823.69 seconds

Details
##############################
Test: TestFunctional - FAIL
Desc: Run test-functional
Output:
FAIL functional.test_hog::test_hog[sci-hosts18-vm2]: pytest_bluezenv.rpc.RemoteTimeoutError: Connection recv timed out

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

---
Regards,
Linux Bluetooth

author
#2 lore raw
In reply to Kyle Pepper

Could the failed TestFunctional CI check for this patch be reran? The matching checks pass locally.

CI: https://github.com/bluez/bluez/pull/2664

Quoted 174 lines · Kyle Pepper

STOP resets local state without consuming the ATT response. Use a Write Command so an unresponsive renderer does not hold the request queue until timeout.

Test command semantics, failure handling and peer STATUS notification.

Fixes 9948168cca15 ("shared/asha: Don't wait for status notification on stop")
Assisted-by OpenCode:gpt-6.1-sol

---
Submission review notes (not part of the commit message):
Local validation is for base 7428ca2df9356363079db0f48412c20cbdb9471f. Compatibility with newer upstream tips has not been verified locally. This topic uses the verified STOP introducing commit as its Fixes tag. Existing N8 blocking-STOP failure evidence is retained; the new unit test mocks setup and GATT writes, not hardware or daemon concurrency.

 .gitignore            |  1 +
 Makefile.am           |  6 +++
 src/shared/asha.c     |  5 ++-
 unit/test-asha-stop.c | 97 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 107 insertions(+), 2 deletions(-)
 create mode 100644 unit/test-asha-stop.c
.gitignore +1 -0
index 06b24735df..8a4195c05a 100644
@@ -112,6 +112,7 @@ unit/test-lib
 unit/test-mgmt
 unit/test-uhid
 unit/test-hfp
+unit/test-asha-stop
 unit/test-crypto
 unit/test-ecc
 unit/test-hog
Makefile.am +6 -0
index f742458d11..6016913145 100644
@@ -706,6 +706,12 @@ unit_test_avrcp_LDADD = lib/libbluetooth-internal.la \
 
 unit_tests += unit/test-hfp
 
+unit_tests += unit/test-asha-stop
+
+unit_test_asha_stop_SOURCES = unit/test-asha-stop.c
+unit_test_asha_stop_LDADD = src/libshared-glib.la \
+	lib/libbluetooth-internal.la $(GLIB_LIBS)
+
 unit_test_hfp_SOURCES = unit/test-hfp.c
 unit_test_hfp_LDADD = src/libshared-glib.la $(GLIB_LIBS)
 
src/shared/asha.c +3 -2
index 79bb29bf9a..0e6261d37d 100644
@@ -284,8 +284,9 @@ unsigned int bt_asha_stop(struct bt_asha *asha)
 
 	asha->state = ASHA_STOPPED;
 
-	ret = asha_send_acp(asha, acp_stop_cmd, sizeof(acp_stop_cmd), NULL,
-			NULL);
+	/* State is reset below without waiting for an ATT response. */
+	ret = asha_send_acp_without_response(asha, acp_stop_cmd,
+			sizeof(acp_stop_cmd));
 	asha_set_send_status(asha, false);
 
 	/* We reset our state without waiting for a response */
unit/test-asha-stop.c new file +97 -0
new file mode 100644
index 0000000000..5ef6d03623
@@ -0,0 +1,97 @@
+// SPDX-License-Identifier: LGPL-2.1-or-later
+#include <assert.h>
+
+/* Source-level mocks remain effective with link-time optimization. */
+#define bt_gatt_client_write_without_response test_write_command
+#define bt_gatt_client_write_value test_write_request
+#include "src/shared/asha.c"
+#undef bt_gatt_client_write_without_response
+#undef bt_gatt_client_write_value
+#include "src/shared/tester.h"
+
+static unsigned int commands, requests, peer_updates;
+static bool command_ok;
+
+void btd_error(uint16_t index, const char *format, ...)
+{
+}
+
+void btd_debug(uint16_t index, const char *format, ...)
+{
+}
+
+unsigned int test_write_command(struct bt_gatt_client *client, uint16_t handle,
+					bool signed_write,
+					const uint8_t *value, uint16_t length)
+{
+	assert(client && handle == 0x79 && !signed_write);
+
+	if (value[0] == 0x02) {
+		assert(length == 1);
+		commands++;
+		return command_ok;
+	}
+
+	assert(length == 2 && value[0] == 0x03 && value[1] == 0x00);
+	peer_updates++;
+	return 1;
+}
+
+unsigned int test_write_request(struct bt_gatt_client *client, uint16_t handle,
+				const uint8_t *value, uint16_t length,
+				bt_gatt_client_callback_t callback, void *data,
+				bt_gatt_client_destroy_func_t destroy)
+{
+	requests++;
+	return 1;
+}
+
+static void state_callback(int status, void *data)
+{
+	assert(false);
+}
+
+static void test_stop(const void *user_data)
+{
+	unsigned int fail;
+
+	for (fail = 0; fail < 2; fail++) {
+		struct bt_asha left = {
+			.client = (void *) 1, .acp_handle = 0x79,
+			.hisyncid = { 1 }, .state = ASHA_STARTED,
+			.state_cb = state_callback, .state_cb_data = (void *) 1,
+		};
+		struct bt_asha right = {
+			.client = (void *) 2, .acp_handle = 0x79,
+			.hisyncid = { 1 }, .right_side = true,
+			.state = ASHA_STARTED,
+		};
+
+		asha_devices = queue_new();
+		update_asha_set(&left, true);
+		update_asha_set(&right, true);
+		commands = requests = peer_updates = 0;
+		command_ok = !fail;
+		assert(bt_asha_stop(&left) == (fail ? (unsigned int) -1 : 0));
+		assert(commands == 1 && requests == 0 && peer_updates == 1);
+		assert(left.state == ASHA_STOPPED);
+		assert(right.state == ASHA_STARTED);
+		assert(!left.state_cb && !left.state_cb_data);
+
+		/* Repeated stop must not send another control command. */
+		assert(bt_asha_stop(&left) == 0);
+		assert(commands == 1 && requests == 0 && peer_updates == 1);
+		update_asha_set(&left, false);
+		update_asha_set(&right, false);
+		assert(!asha_devices);
+	}
+
+	tester_test_passed();
+}
+
+int main(int argc, char *argv[])
+{
+	tester_init(&argc, &argv);
+	tester_add("ASHA/stop/command", NULL, NULL, test_stop, NULL);
+	return tester_run();
+}

base-commit: 7428ca2df9356363079db0f48412c20cbdb9471f

#3 lore raw
In reply to Kyle Pepper

This is an automated email and please do not reply to this email.

Dear Submitter,

This series was picked up by the CI more than 2 weeks ago and the pull request created for it is still open, which means the series was never applied to the tree.

Series: shared/asha: send STOP without waiting for a response
Pull Request: https://github.com/bluez/bluez/pull/2664
Created: 2026-10-13 04:00:12+00:00

The pull request has been closed and no further action is taken on this series.

If the change should still be considered, it must be resent to the Linux Bluetooth mailing list ([email protected]) so that it is picked up again.

---
Regards,
Linux Bluetooth