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

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

Issue 1753012: Check for lid state being "closed" instead of not "open". (Closed) Base URL: ssh://git@chromiumos-git/chromeos
Patch Set: 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 | no next file » | 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`
8
9 grep -q "closed" /proc/acpi/button/lid/*/state
10 if [ $? != 0 ]; then
11 logger "action_lid.sh: lid is not closed. Bailing out."
12 exit 0
13 fi
14
15
7 # Shutdowns instead of sleeping if no one is logged in. 16 # Shutdowns instead of sleeping if no one is logged in.
8 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"
9 shutdown -h now 19 shutdown -h now
10 exit 0 20 exit 0
11 fi 21 fi
12 22
13 # Checks whether the lid is closed before proceeding. 23 logger "action_lid.sh: lid closed. Going to suspend-to-RAM state"
14 grep -q open /proc/acpi/button/lid/*/state
15 if [ $? = 0 ]; then
16 exit 0
17 fi
18 24
19 # On lid close: 25 # On lid close:
20 # - locks the screen 26 # - locks the screen
21 export HOME=/home/chronos 27 export HOME=/home/chronos
22 /usr/bin/xscreensaver-command -l 28 /usr/bin/xscreensaver-command -l
23 29
24 # - announces the event 30 # - announces the event
25 /usr/bin/dbus-send --type=signal --system / \ 31 /usr/bin/dbus-send --type=signal --system / \
26 org.chromium.Power.Manager.PowerStateChanged string:mem 32 org.chromium.Power.Manager.PowerStateChanged string:mem
27 33
(...skipping 13 matching lines...) Expand all
41 # On lid open: 47 # On lid open:
42 # - has it such that you don't have to press a key to display lock screen 48 # - has it such that you don't have to press a key to display lock screen
43 /usr/bin/xscreensaver-command -deactivate 49 /usr/bin/xscreensaver-command -deactivate
44 50
45 # - announces the event 51 # - announces the event
46 /usr/bin/dbus-send --type=signal --system / \ 52 /usr/bin/dbus-send --type=signal --system / \
47 org.chromium.Power.Manager.PowerStateChanged string:on 53 org.chromium.Power.Manager.PowerStateChanged string:on
48 54
49 # - resumes cryptohome device 55 # - resumes cryptohome device
50 #/usr/bin/test -b $CRYPTOHOME && /sbin/dmsetup resume $CRYPTOHOME 56 #/usr/bin/test -b $CRYPTOHOME && /sbin/dmsetup resume $CRYPTOHOME
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698