sleep 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. case $1 in
  3. pre) # unload the modules before going to sleep
  4. # Disable bluetooth if no device is connected
  5. if ! bluetoothctl info; then
  6. bluetoothctl power off
  7. fi
  8. # handle wifi issues
  9. modprobe -r mwifiex_pcie;
  10. modprobe -r mwifiex;
  11. modprobe -r cfg80211;
  12. ## IPTS: see notes below
  13. ## > Remove IPTS from ME side
  14. #modprobe -r intel_ipts
  15. #modprobe -r mei_hdcp
  16. #modprobe -r mei_me
  17. #modprobe -r mei
  18. ## > Remove IPTS from i915 side
  19. #for i in $(find /sys/kernel/debug/dri -name i915_intel_ipts_cleanup); do echo 1 > $i; done
  20. ;;
  21. post) # re-load modules after resume
  22. ## IPTS: see notes below
  23. ## > Load IPTS from i915 side
  24. #for i in $(find /sys/kernel/debug/dri -name i915_intel_ipts_init); do echo 1 > $i; done
  25. ## > Load IPTS from ME side
  26. #modprobe mei
  27. #modprobe mei_me
  28. #modprobe mei_hdcp
  29. #modprobe intel_ipts
  30. # Restart bluetooth
  31. bluetoothctl power on
  32. # handle wifi issues: complete cycle
  33. modprobe cfg80211;
  34. modprobe mwifiex;
  35. modprobe mwifiex_pcie;
  36. echo 1 > /sys/bus/pci/rescan
  37. systemctl restart NetworkManager.service
  38. ;;
  39. esac
  40. # Notes:
  41. # - For IPTS, see
  42. # > https://github.com/jakeday/linux-surface/issues/544#issuecomment-519126757
  43. # for an explanation/discussion. We do not unload/reload modules for now as
  44. # the IPTS drivers should be able to resume/suspend without this. If you
  45. # experience any issues on suspend/resume, please file an appropriate issue or
  46. # join the discussion linked above so that we can fix it. As a temporary
  47. # workaround, you may want to uncomment the IPTS-related lines above.