OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # Copyright (c) 2009 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 # TODO: This is specific to eeepc. Figure out a way to generalize and | 7 # TODO: This is specific to eeepc. Figure out a way to generalize and |
8 # add support for additional hotkeys. | 8 # add support for additional hotkeys. |
9 # | 9 # |
10 # TODO(ajwong): Find a better way to talk to pulseaudio than changing to the | 10 # TODO(ajwong): Find a better way to talk to pulseaudio than changing to the |
11 # chronos user and talking to pulseaudio via amixer. | 11 # chronos user and talking to pulseaudio via amixer. |
12 | 12 |
13 USER_ID="$(/usr/bin/id -u chronos)" | 13 USER_ID="$(/usr/bin/id -u chronos)" |
14 MINIJAIL_FLAGS="--use-capabilities" | 14 MINIJAIL_FLAGS="--use-capabilities" |
15 | 15 |
16 # Needed by amixer to so that the alsa pulseaudio plugin, can locate the | 16 export PULSE_RUNTIME_PATH=/var/run/pulse |
17 # correct ${HOME}/.pulse directory. | |
18 export HOME=/home/chronos/user | |
19 | 17 |
20 case "$3" in | 18 case "$3" in |
21 00000013) # Toggle sound | 19 00000013) # Toggle sound |
22 /sbin/minijail ${MINIJAIL_FLAGS} --uid=${USER_ID} -- \ | 20 /sbin/minijail ${MINIJAIL_FLAGS} --uid=${USER_ID} -- \ |
23 /usr/bin/amixer set Master toggle | 21 /usr/bin/amixer set Master toggle |
24 ;; | 22 ;; |
25 00000014) # Decrease volume | 23 00000014) # Decrease volume |
26 /sbin/minijail ${MINIJAIL_FLAGS} --uid=${USER_ID} -- \ | 24 /sbin/minijail ${MINIJAIL_FLAGS} --uid=${USER_ID} -- \ |
27 /usr/bin/amixer set Master 5%- | 25 /usr/bin/amixer set Master 5%- |
28 ;; | 26 ;; |
29 00000015) # Increase volume | 27 00000015) # Increase volume |
30 /sbin/minijail ${MINIJAIL_FLAGS} --uid=${USER_ID} -- \ | 28 /sbin/minijail ${MINIJAIL_FLAGS} --uid=${USER_ID} -- \ |
31 /usr/bin/amixer set Master 5%+ | 29 /usr/bin/amixer set Master 5%+ |
32 ;; | 30 ;; |
33 esac | 31 esac |
OLD | NEW |