Created
June 8, 2014 19:25
-
-
Save rutsky/1ed8e9779f0b2941c5a6 to your computer and use it in GitHub Desktop.
pm-utils script to disable wakup by events from USB devices on Sony Vaio 1311s9rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# /usr/lib/pm-utils/sleep.d/45fix-usb-wakup | |
# Disable wakup from USB devices on Sony Vaio 1311s9rb | |
function print_state { | |
cat /proc/acpi/wakeup | grep $1 | cut -f3 | cut -d' ' -f1 | tr -d '*' | |
} | |
function disable_wakup { | |
dev=$1 | |
if [ "`print_state $dev`" == "enabled" ]; then | |
echo $dev > /proc/acpi/wakeup | |
fi | |
} | |
function enable_wakup { | |
dev=$1 | |
if [ "`print_state $dev`" == "disabled" ]; then | |
echo $dev > /proc/acpi/wakeup | |
fi | |
} | |
case $1 in | |
hibernate) | |
echo "Going to suspend to disk!" | |
;; | |
suspend) | |
echo "Fixing acpi settings." | |
# Disable wakup by events from USB hubs | |
# (e.g. mouse move on some mices) | |
disable_wakup XHC | |
disable_wakup EHC1 | |
disable_wakup EHC2 | |
echo "Suspending to RAM." | |
;; | |
thaw) | |
echo "Suspend to disk is now over!" | |
;; | |
resume) | |
echo "We are now resuming." | |
;; | |
*) | |
echo "Somebody is callin me totally wrong." | |
;; | |
esac |
What is purpose of enable_wakup
function?
At least its not called inside this script.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a bunch ... working perfectly to prevent USB keyboard waking system in Kubuntu 14.04 desktop.