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

Side by Side Diff: src/platform/acpi/action_lid.sh

Issue 2079014: Log time in suspend. (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: Simplify the option parsing code for now. Created 10 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/platform/init/dump-boot-stats.conf » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 logger "action_lid.sh: " `cat /proc/acpi/button/lid/*/state` 7 logger "action_lid.sh: " `cat /proc/acpi/button/lid/*/state`
8 8
9 grep -q "closed" /proc/acpi/button/lid/*/state 9 grep -q "closed" /proc/acpi/button/lid/*/state
10 if [ $? != 0 ]; then 10 if [ $? != 0 ]; then
11 logger "action_lid.sh: lid is not closed. Bailing out." 11 logger "action_lid.sh: lid is not closed. Bailing out."
12 exit 0 12 exit 0
13 fi 13 fi
14 14
15 15
16 # Shutdowns instead of sleeping if no one is logged in. 16 # Shutdowns instead of sleeping if no one is logged in.
17 if ! test -f /var/run/state/logged-in; then 17 if ! test -f /var/run/state/logged-in; then
18 logger "action_lid.sh: lid closed. Shutting down since no one is logged in" 18 logger "action_lid.sh: lid closed. Shutting down since no one is logged in"
19 shutdown -h now 19 shutdown -h now
20 exit 0 20 exit 0
21 fi 21 fi
22 22
23 logger "action_lid.sh: lid closed. Going to suspend-to-RAM state" 23 logger "action_lid.sh: lid closed. Going to suspend-to-RAM state"
24 24
25 # On lid close: 25 # On lid close:
26 # - locks the screen 26 # - locks the screen
27 export HOME=/home/chronos 27 export HOME=/home/chronos
28 /usr/bin/xscreensaver-command -l 28 /usr/bin/xscreensaver-command -l
29 29
30 # - logs the time going to suspend (no-op if no RTC).
31 cp /sys/class/rtc/rtc0/since_epoch /var/log/metrics/suspend-to-ram-time \
32 2> /dev/null || true
33
30 # - announces the event 34 # - announces the event
31 /usr/bin/dbus-send --type=signal --system / \ 35 /usr/bin/dbus-send --type=signal --system / \
32 org.chromium.Power.Manager.PowerStateChanged string:mem 36 org.chromium.Power.Manager.PowerStateChanged string:mem
33 37
34 # - sleeps for a bit to give the window manager time to draw the xscreensaver 38 # - sleeps for a bit to give the window manager time to draw the xscreensaver
35 # window to the screen -- see http://crosbug.com/2250. 39 # window to the screen -- see http://crosbug.com/2250.
36 # TODO: Remove this hack once we have a better solution in place that adds 40 # TODO: Remove this hack once we have a better solution in place that adds
37 # some coordination between the screen locker and the window manager. 41 # some coordination between the screen locker and the window manager.
38 sleep 0.5 42 sleep 0.5
39 43
40 # - suspends the cryptohome device 44 # - suspends the cryptohome device
41 #CRYPTOHOME=/dev/mapper/cryptohome 45 #CRYPTOHOME=/dev/mapper/cryptohome
42 #/usr/bin/test -b $CRYPTOHOME && /sbin/dmsetup suspend $CRYPTOHOME 46 #/usr/bin/test -b $CRYPTOHOME && /sbin/dmsetup suspend $CRYPTOHOME
43 47
44 # - suspends to ram 48 # - suspends to ram
45 echo -n mem > /sys/power/state 49 echo -n mem > /sys/power/state
46 50
47 # On lid open: 51 # On lid open:
48 # - has it such that you don't have to press a key to display lock screen 52 # - has it such that you don't have to press a key to display lock screen
49 /usr/bin/xscreensaver-command -deactivate 53 /usr/bin/xscreensaver-command -deactivate
50 54
51 # - announces the event 55 # - announces the event
52 /usr/bin/dbus-send --type=signal --system / \ 56 /usr/bin/dbus-send --type=signal --system / \
53 org.chromium.Power.Manager.PowerStateChanged string:on 57 org.chromium.Power.Manager.PowerStateChanged string:on &
58
59 # - sends UMA metrics on resume
60 /usr/bin/send_metrics_on_resume
54 61
55 # - resumes cryptohome device 62 # - resumes cryptohome device
56 #/usr/bin/test -b $CRYPTOHOME && /sbin/dmsetup resume $CRYPTOHOME 63 #/usr/bin/test -b $CRYPTOHOME && /sbin/dmsetup resume $CRYPTOHOME
OLDNEW
« no previous file with comments | « no previous file | src/platform/init/dump-boot-stats.conf » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698