浏览代码

Disable bluetooth when suspending without anything connected.

On Surface Book 2 it is not possible to archive stable S0ix while bluetooth is
enabled but no device is connected. Either S0ix fails completely, or the
residency is pretty bad. When bluetooth is disabled, or a device such as the pen
is connected, S0ix works fine and residency is great again.

By disabling bluetooth when no device is connected, we get proper S0ix in all
situations. And since no device is connected, the reset won't really matter.

Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
Dorian Stoll 5 年之前
父节点
当前提交
b74befa0ca
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      root/lib/systemd/system-sleep/sleep

+ 9 - 0
root/lib/systemd/system-sleep/sleep

@@ -1,6 +1,12 @@
 #!/bin/bash
 case $1 in
   pre)    # unload the modules before going to sleep
+
+    # Disable bluetooth if no device is connected
+    if ! bluetoothctl info; then
+      bluetoothctl power off
+    fi
+
     # handle wifi issues
     modprobe -r mwifiex_pcie;
     modprobe -r mwifiex;
@@ -25,6 +31,9 @@ case $1 in
     #modprobe mei_hdcp
     #modprobe intel_ipts
 
+    # Restart bluetooth
+    bluetoothctl power on
+
     # handle wifi issues: complete cycle
     modprobe cfg80211;
     modprobe mwifiex;