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

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

Issue 661352: Add a hack to deal with needing to spawn pulseaudio, and deal with the changes HOME of chronos. (Closed)
Patch Set: Use minijail instead Created 10 years, 10 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/platform/acpi/action_hotkey.sh
diff --git a/src/platform/acpi/action_hotkey.sh b/src/platform/acpi/action_hotkey.sh
index 7e3c28765d8e86ada366b0760f02b05d5fea905b..57cf831ca10288c96b925359e359aca7df1eb243 100755
--- a/src/platform/acpi/action_hotkey.sh
+++ b/src/platform/acpi/action_hotkey.sh
@@ -6,15 +6,28 @@
# TODO: This is specific to eeepc. Figure out a way to generalize and
# add support for additional hotkeys.
+#
+# TODO(ajwong): Find a better way to talk to pulseaudio than changing to the
+# chronos user and talking to pulseaudio via amixer.
+
+USER_ID="$(/usr/bin/id -u chronos)"
+MINIJAIL_FLAGS="--use-capabilities"
+
+# Needed by amixer to so that the alsa pulseaudio plugin, can locate the
+# correct ${HOME}/.pulse directory.
+export HOME=/home/chronos/user
case "$3" in
00000013) # Toggle sound
- amixer set Master toggle
+ /sbin/minijail ${MINIJAIL_FLAGS} --uid=${USER_ID} -- \
+ /usr/bin/amixer set Master toggle
;;
00000014) # Decrease volume
- amixer set Master 5%-
+ /sbin/minijail ${MINIJAIL_FLAGS} --uid=${USER_ID} -- \
+ /usr/bin/amixer set Master 5%-
;;
00000015) # Increase volume
- amixer set Master 5%+
+ /sbin/minijail ${MINIJAIL_FLAGS} --uid=${USER_ID} -- \
+ /usr/bin/amixer set Master 5%+
;;
esac
« 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