* [PATCH v4] Bluetooth: hci_event: Add HCI_Write_Link_Supervision_Timeout command/event structures
@ 2026-08-08 6:25 zhangchen200426
2026-08-08 8:00 ` [v4] " bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: zhangchen200426 @ 2026-08-08 6:25 UTC (permalink / raw)
To: luiz.von.dentz, pmenzel, pav, yang.li, tim.bird, gustavoars,
naga.akella
Cc: linux-bluetooth, Chen Zhang, kernel test robot
From: Chen Zhang <zhangchen01@kylinos.cn>
Some speakers do not actively initiate disconnection when powering off. As
a result, the central device can only wait for a timeout to disconnect,
with the default timeout being 20s. In certain scenarios, this can
significantly impact user experience. For example, a phone actively
connects to a speaker, the phone acts as the central device and the speaker
is the peripheral device. If the speaker is playing music and is then
turned off, it takes 20s before the music starts playing from the phone.
Define HCI_Write_Link_Supervision_Timeout command, event structure, and
corresponding event handler function, set the timeout to 5s after ACL
link is established.
Changes in v4:
- Fix sparse warning: convert the timeout to little-endian with
cpu_to_le16() when sending the command
- Use hci_rp_write_link_supervision_timeout instead of hci_ev_status in
the command complete handler, matching the style of
hci_cc_write_link_policy()
- Rename timeout_ms to timeout since the command parameter holds raw HCI
slots (0.625 ms units), not milliseconds
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202608080528.0kc5JCoL-lkp@intel.com/
Signed-off-by: Chen Zhang <zhangchen01@kylinos.cn>
---
include/net/bluetooth/hci.h | 10 ++++++++
include/net/bluetooth/hci_core.h | 1 +
net/bluetooth/hci_event.c | 44 ++++++++++++++++++++++++++++++++
3 files changed, 55 insertions(+)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 50f0eef71fb1..f3c91cc1fc45 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -1239,6 +1239,16 @@ struct hci_cp_host_buffer_size {
__le16 sco_max_pkt;
} __packed;
+#define HCI_OP_WRITE_LINK_SUPERVISION_TIMEOUT 0x0c37
+struct hci_cp_write_link_supervision_timeout {
+ __le16 handle;
+ __le16 timeout; /* in units of 0.625 ms */
+} __packed;
+struct hci_rp_write_link_supervision_timeout {
+ __u8 status;
+ __le16 handle;
+} __packed;
+
#define HCI_OP_READ_NUM_SUPPORTED_IAC 0x0c38
struct hci_rp_read_num_supported_iac {
__u8 status;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index e7133ff87fbf..866903a9b5c8 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -702,6 +702,7 @@ struct hci_conn {
__u8 le_features[248];
__u16 pkt_type;
__u16 link_policy;
+ __u16 link_supervision_timeout;
__u8 key_type;
__u8 auth_type;
__u8 sec_level;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index ea858391c789..0ee6d5922ca4 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -609,6 +609,37 @@ static u8 hci_cc_write_voice_setting(struct hci_dev *hdev, void *data,
return rp->status;
}
+static u8 hci_cc_write_link_supervision_timeout(struct hci_dev *hdev, void *data,
+ struct sk_buff *skb)
+{
+ struct hci_rp_write_link_supervision_timeout *rp = data;
+ struct hci_cp_write_link_supervision_timeout *sent;
+ struct hci_conn *conn;
+
+ bt_dev_dbg(hdev, "status 0x%2.2x", rp->status);
+
+ if (rp->status)
+ return rp->status;
+
+ sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_LINK_SUPERVISION_TIMEOUT);
+ if (!sent)
+ return rp->status;
+
+ hci_dev_lock(hdev);
+
+ conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(rp->handle));
+ if (conn) {
+ conn->link_supervision_timeout = __le16_to_cpu(sent->timeout);
+ bt_dev_dbg(hdev, "handle 0x%4.4x timeout 0x%4.4x (%u ms)",
+ __le16_to_cpu(rp->handle), conn->link_supervision_timeout,
+ conn->link_supervision_timeout * 5 / 8);
+ }
+
+ hci_dev_unlock(hdev);
+
+ return rp->status;
+}
+
static u8 hci_cc_read_num_supported_iac(struct hci_dev *hdev, void *data,
struct sk_buff *skb)
{
@@ -3243,6 +3274,16 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, void *data,
hci_send_cmd(hdev, HCI_OP_CHANGE_CONN_PTYPE, sizeof(cp),
&cp);
}
+
+ if (conn->type == ACL_LINK && conn->role == HCI_ROLE_MASTER) {
+ struct hci_cp_write_link_supervision_timeout cp;
+
+ cp.handle = ev->handle;
+ cp.timeout = cpu_to_le16(0x1F40); /* 8000 * 0.625ms = 5000ms */
+ hci_send_cmd(hdev, HCI_OP_WRITE_LINK_SUPERVISION_TIMEOUT,
+ sizeof(cp), &cp);
+ }
+
}
if (conn->type == ACL_LINK)
@@ -4100,6 +4141,9 @@ static const struct hci_cc {
HCI_CC_STATUS(HCI_OP_WRITE_CLASS_OF_DEV, hci_cc_write_class_of_dev),
HCI_CC(HCI_OP_READ_VOICE_SETTING, hci_cc_read_voice_setting,
sizeof(struct hci_rp_read_voice_setting)),
+ HCI_CC(HCI_OP_WRITE_LINK_SUPERVISION_TIMEOUT,
+ hci_cc_write_link_supervision_timeout,
+ sizeof(struct hci_rp_write_link_supervision_timeout)),
HCI_CC_STATUS(HCI_OP_WRITE_VOICE_SETTING, hci_cc_write_voice_setting),
HCI_CC(HCI_OP_READ_NUM_SUPPORTED_IAC, hci_cc_read_num_supported_iac,
sizeof(struct hci_rp_read_num_supported_iac)),
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [v4] Bluetooth: hci_event: Add HCI_Write_Link_Supervision_Timeout command/event structures
2026-08-08 6:25 [PATCH v4] Bluetooth: hci_event: Add HCI_Write_Link_Supervision_Timeout command/event structures zhangchen200426
@ 2026-08-08 8:00 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2026-08-08 8:00 UTC (permalink / raw)
To: linux-bluetooth, zhangchen200426
[-- Attachment #1: Type: text/plain, Size: 2772 bytes --]
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/project/bluetooth/list/?series=1142545
---Test result---
Test Summary:
CheckPatch PASS 1.24 seconds
VerifyFixes PASS 0.09 seconds
VerifySignedoff PASS 0.10 seconds
GitLint FAIL 0.25 seconds
SubjectPrefix PASS 0.09 seconds
BuildKernel PASS 25.86 seconds
CheckAllWarning PASS 28.40 seconds
CheckSparse PASS 27.13 seconds
BuildKernel32 PASS 24.78 seconds
CheckKernelLLVM SKIP 0.00 seconds
TestRunnerSetup PASS 458.71 seconds
TestRunner_l2cap-tester PASS 61.52 seconds
TestRunner_iso-tester PASS 91.80 seconds
TestRunner_bnep-tester PASS 19.64 seconds
TestRunner_mgmt-tester FAIL 219.47 seconds
TestRunner_rfcomm-tester PASS 25.64 seconds
TestRunner_sco-tester PASS 31.55 seconds
TestRunner_ioctl-tester PASS 26.45 seconds
TestRunner_mesh-tester FAIL 26.23 seconds
TestRunner_smp-tester PASS 23.57 seconds
TestRunner_userchan-tester PASS 20.05 seconds
TestRunner_6lowpan-tester PASS 23.05 seconds
IncrementalBuild PASS 23.90 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v4] Bluetooth: hci_event: Add HCI_Write_Link_Supervision_Timeout command/event structures
1: T1 Title exceeds max length (90>80): "[v4] Bluetooth: hci_event: Add HCI_Write_Link_Supervision_Timeout command/event structures"
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 501, Passed: 495 (98.8%), Failed: 2, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.248 seconds
LL Privacy - Unpair 1 Timed out 1.860 seconds
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 2.484 seconds
Mesh - Send cancel - 2 Timed out 1.988 seconds
https://github.com/bluez/bluetooth-next/pull/558
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-08 8:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-08 6:25 [PATCH v4] Bluetooth: hci_event: Add HCI_Write_Link_Supervision_Timeout command/event structures zhangchen200426
2026-08-08 8:00 ` [v4] " bluez.test.bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.