浏览代码

sleep-script: Prevent bluetoothctl from timing out

If bluetooth is disabled in the BIOS, the bluetoothd process won't be
running. bluetoothctl waits for that process to launch, which means it
timeouts indefinitly, breaking suspend entirely.

By checking if bluetoothd is running before calling bluetoothctl suspend
works fine even if bluetooth is disabled in the BIOS.

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

+ 4 - 2
root/lib/systemd/system-sleep/sleep

@@ -3,7 +3,7 @@ case $1 in
   pre)    # unload the modules before going to sleep
 
     # Disable bluetooth if no device is connected
-    if ! bluetoothctl info; then
+    if ps cax | grep bluetoothd && ! bluetoothctl info; then
       bluetoothctl power off
     fi
 
@@ -32,7 +32,9 @@ case $1 in
     #modprobe intel_ipts
 
     # Restart bluetooth
-    bluetoothctl power on
+    if ps cax | grep bluetoothd; then
+      bluetoothctl power on
+    fi
 
     # handle wifi issues: complete cycle
     modprobe cfg80211;