diff mbox series

[BlueZ,4/5] btdev: report right reason for local Disconnect complete

Message ID d1b47d578b8e78ea349356dae031e7744a5cf009.1684682575.git.pav@iki.fi (mailing list archive)
State Accepted
Commit 0c32cfdf94624fcfc3ac329f313d9e48311b52a7
Headers show
Series [BlueZ,1/5] iso-tester: always use DEFER_SETUP for multiple CIS in same CIG | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Pauli Virtanen May 21, 2023, 3:27 p.m. UTC
Disconnect initiated by local host should get Connection Terminated by
Local Host (0x16) as termination reason.
---
 emulator/btdev.c | 4 +++-
 monitor/bt.h     | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/emulator/btdev.c b/emulator/btdev.c
index 0eec1d9f2..f9260511a 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -749,7 +749,9 @@  static int cmd_disconnect_complete(struct btdev *dev, const void *data,
 		return 0;
 	}
 
-	disconnect_complete(dev, conn->handle, BT_HCI_ERR_SUCCESS, cmd->reason);
+	/* Local host has different reason (Core v5.3 Vol 4 Part E Sec 7.1.6) */
+	disconnect_complete(dev, conn->handle, BT_HCI_ERR_SUCCESS,
+						BT_HCI_ERR_LOCAL_HOST_TERM);
 
 	if (conn->link)
 		disconnect_complete(conn->link->dev, conn->link->handle,
diff --git a/monitor/bt.h b/monitor/bt.h
index 2548f0dcd..b99ada0b2 100644
--- a/monitor/bt.h
+++ b/monitor/bt.h
@@ -3716,6 +3716,7 @@  struct bt_hci_evt_le_big_info_adv_report {
 #define BT_HCI_ERR_COMMAND_DISALLOWED		0x0c
 #define BT_HCI_ERR_UNSUPPORTED_FEATURE		0x11
 #define BT_HCI_ERR_INVALID_PARAMETERS		0x12
+#define BT_HCI_ERR_LOCAL_HOST_TERM		0x16
 #define BT_HCI_ERR_UNSPECIFIED_ERROR		0x1f
 #define BT_HCI_ERR_ADV_TIMEOUT			0x3c
 #define BT_HCI_ERR_CONN_FAILED_TO_ESTABLISH	0x3e