Explorar o código

updating sleep script to fix resume issues

Jake Day %!s(int64=7) %!d(string=hai) anos
pai
achega
bcc46bc1e1
Modificáronse 3 ficheiros con 33 adicións e 26 borrados
  1. 0 24
      root/lib/systemd/system-sleep/hibernate
  2. 31 0
      root/lib/systemd/system-sleep/sleep
  3. 2 2
      setup.sh

+ 0 - 24
root/lib/systemd/system-sleep/hibernate

@@ -1,24 +0,0 @@
-#!/bin/sh
-case $1/$2 in
-  pre/*)
-    systemctl stop NetworkManager.service
-    #echo 1 > /sys/bus/pci/devices/0000\:02\:00.0/reset
-    #echo 0 > "/sys/bus/pci/devices/0000:02:00.0/d3cold_allowed" # nvme
-    #echo 0 > "/sys/bus/pci/devices/0000:03:00.0/d3cold_allowed" # wifi
-    rmmod intel_ipts
-    rmmod mei_me
-    rmmod mei
-    rmmod mwifiex_pcie
-    rmmod mwifiex
-    ;;
-  post/*)
-    modprobe intel_ipts
-    modprobe mei_me
-    modprobe mei
-    modprobe mwifiex_pcie
-    modprobe mwifiex
-    #echo 1 > /sys/bus/pci/devices/0000\:02\:00.0/reset
-    echo 1 > /sys/bus/pci/rescan
-    systemctl start NetworkManager.service
-    ;;
-esac

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

@@ -0,0 +1,31 @@
+#!/bin/bash
+case $1 in
+  pre)
+    # unload the modules before going to sleep
+    systemctl stop NetworkManager.service
+    modprobe -r intel_ipts
+    modprobe -r mei_me
+    modprobe -r mei
+    modprobe -r mwifiex_pcie;
+    modprobe -r mwifiex;
+    modprobe -r cfg80211;
+    ;;
+  post)
+    # need to cycle the modules on a resume and after the reset is called, so unload...
+    modprobe -r intel_ipts
+    modprobe -r mei_me
+    modprobe -r mei
+    modprobe -r mwifiex_pcie;
+    modprobe -r mwifiex;
+    modprobe -r cfg80211;
+    # and reload
+    modprobe -i intel_ipts
+    modprobe -i mei_me
+    modprobe -i mei
+    modprobe -i cfg80211;
+    modprobe -i mwifiex;
+    modprobe -i mwifiex_pcie;
+    echo 1 > /sys/bus/pci/rescan
+    systemctl restart NetworkManager.service
+    ;;
+esac

+ 2 - 2
setup.sh

@@ -34,8 +34,8 @@ echo "\nContinuing setup...\n"
 echo "Coping the config files under root to where they belong...\n"
 cp -R root/* /
 
-echo "Making /lib/systemd/system-sleep/hibernate executable...\n"
-chmod a+x /lib/systemd/system-sleep/hibernate
+echo "Making /lib/systemd/system-sleep/sleep executable...\n"
+chmod a+x /lib/systemd/system-sleep/sleep
 
 read -rp "Do you want to replace suspend with hibernate? (type yes or no) " usehibernate;echo