123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- #!/bin/bash
- case $1 in
- pre) # unload the modules before going to sleep
- # Disable bluetooth if no device is connected
- if ps cax | grep bluetoothd && ! bluetoothctl info; then
- bluetoothctl power off
- fi
- ## Disable bluetooth regardless if devices are connected (see notes below)
- #if ps cax | grep bluetoothd; then
- # bluetoothctl power off
- #fi
- # handle wifi issues
- modprobe -r mwifiex_pcie;
- modprobe -r mwifiex;
- modprobe -r cfg80211;
- ## IPTS: see notes below
- ## > Remove IPTS from ME side
- #modprobe -r ipts_surface
- #modprobe -r intel_ipts
- #modprobe -r mei_hdcp
- #modprobe -r mei_me
- #modprobe -r mei
- ## > Remove IPTS from i915 side
- #for i in $(find /sys/kernel/debug/dri -name i915_intel_ipts_cleanup); do echo 1 > $i; done
- ;;
- post) # re-load modules after resume
- ## IPTS: see notes below
- ## > Load IPTS from i915 side
- #for i in $(find /sys/kernel/debug/dri -name i915_intel_ipts_init); do echo 1 > $i; done
- ## > Load IPTS from ME side
- #modprobe mei
- #modprobe mei_me
- #modprobe mei_hdcp
- #modprobe intel_ipts
- #modprobe ipts_surface
- # Restart bluetooth
- if ps cax | grep bluetoothd; then
- bluetoothctl power on
- fi
- # handle wifi issues: complete cycle
- modprobe cfg80211;
- modprobe mwifiex;
- modprobe mwifiex_pcie;
- echo 1 > /sys/bus/pci/rescan
- if [ -x "$(command -v nmcli)" ] && [ "$(nmcli net)" = "enabled" ]; then
- nmcli net off
- nmcli net on
- fi
- ;;
- esac
- # Notes:
- # - For IPTS, see
- # > https://github.com/jakeday/linux-surface/issues/544#issuecomment-519126757
- # for an explanation/discussion. We do not unload/reload modules for now as
- # the IPTS drivers should be able to resume/suspend without this. If you
- # experience any issues on suspend/resume, please file an appropriate issue or
- # join the discussion linked above so that we can fix it. As a temporary
- # workaround, you may want to uncomment the IPTS-related lines above.
- # - For bluetooth: If you have spontaneous wakeups, you may want to disable
- # bluetooth completely, regardless if any devices are connected or not, by
- # removing the `! bluetoothctl info;` part as indicated in the comment (e.g.
- # comment-out the original check and comment-in the one below). Note that you
- # may be required to re-connect your devices after resume if you choose this
- # change.
|