Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(674)

Unified Diff: src/platform/acpi/action_lid.sh

Issue 1799001: Log time between network drops -- from online to offline. (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: address review comments. Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/platform/metrics/Makefile » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/acpi/action_lid.sh
diff --git a/src/platform/acpi/action_lid.sh b/src/platform/acpi/action_lid.sh
index dc0646c7eb46b7d779efffac5c18ef7905d5b261..d8700695f628434eda0f40672445ac65c02ca98a 100755
--- a/src/platform/acpi/action_lid.sh
+++ b/src/platform/acpi/action_lid.sh
@@ -4,39 +4,47 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-# Shutdown instead of sleeping if no one is logged in
+# Shutdowns instead of sleeping if no one is logged in.
if ! test -f /var/run/state/logged-in; then
shutdown -h now
exit 0
fi
-# Check whether the lid is closed before proceeding
+# Checks whether the lid is closed before proceeding.
grep -q open /proc/acpi/button/lid/*/state
if [ $? = 0 ]; then
exit 0
fi
# On lid close:
-# - lock the screen
+# - locks the screen
export HOME=/home/chronos
/usr/bin/xscreensaver-command -l
-# - sleep for a bit to give the window manager time to draw the xscreensaver
+# - announces the event
+/usr/bin/dbus-send --type=signal --system / \
+ org.chromium.Power.Manager.PowerStateChanged string:mem
+
+# - sleeps for a bit to give the window manager time to draw the xscreensaver
# window to the screen -- see http://crosbug.com/2250.
# TODO: Remove this hack once we have a better solution in place that adds
# some coordination between the screen locker and the window manager.
sleep 0.5
-# - suspend the cryptohome device
+# - suspends the cryptohome device
#CRYPTOHOME=/dev/mapper/cryptohome
#/usr/bin/test -b $CRYPTOHOME && /sbin/dmsetup suspend $CRYPTOHOME
-# - suspend to ram
+# - suspends to ram
echo -n mem > /sys/power/state
# On lid open:
# - has it such that you don't have to press a key to display lock screen
/usr/bin/xscreensaver-command -deactivate
-# - resume cryptohome device
+# - announces the event
+/usr/bin/dbus-send --type=signal --system / \
+ org.chromium.Power.Manager.PowerStateChanged string:on
+
+# - resumes cryptohome device
#/usr/bin/test -b $CRYPTOHOME && /sbin/dmsetup resume $CRYPTOHOME
« no previous file with comments | « no previous file | src/platform/metrics/Makefile » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698