| # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| # Installed by ADHD package. |
| # cras upstart job. |
| |
| description "ChromeOS audio server" |
| author "chromium-os-dev@chromium.org" |
| |
| env CRAS_SOCKET_DIR=/var/run/cras |
| |
| start on starting system-services |
| stop on stopping system-services |
| respawn |
| |
| # Allow the audio server real time priority. |
| limit rtprio 12 12 |
| |
| pre-start script |
| mkdir -p -m 1770 "${CRAS_SOCKET_DIR}" |
| chown -R cras:cras "${CRAS_SOCKET_DIR}" |
| end script |
| |
| script |
| # Use /etc/cras/enable_hfp as a flag to enable HFP/HSP |
| # support for testing purpose. In test image, touch or |
| # rm this file to toggle this feature. |
| # TODO(hychao): remove this temporary flag when we pass |
| # qualification and ready to launch this feature. |
| if [ -f /etc/cras/enable_hfp ]; then |
| ENABLE_HFP="--enable_hfp" |
| else |
| ENABLE_HFP="" |
| fi |
| |
| # For Samus only, check which dsp.ini to load. |
| if [ "$(mosys platform name)" = "Samus" ]; then |
| local hw_version="$(mosys platform version)" |
| if [ "$hw_version" = "MP.A" ] || |
| [ "$hw_version" = "EVT" ] || |
| [ "$hw_version" = "DVT" ] || |
| [ "$hw_version" = "PVT" ]; then |
| DSP_CONFIG="--dsp_config=/etc/cras/dsp.samus.orig.ini" |
| fi |
| fi |
| # For board needs different device configs, check which config |
| # directory to use. Use that directory for both volume curves |
| # and dsp config. |
| if [ -f /etc/cras/get_device_config_dir ]; then |
| local device_config_dir="$(sh /etc/cras/get_device_config_dir)" |
| DEVICE_CONFIG_DIR="--device_config_dir=${device_config_dir}" |
| DSP_CONFIG="--dsp_config=${device_config_dir}/dsp.ini" |
| fi |
| exec minijail0 -u cras -g cras -G -- /usr/bin/cras ${ENABLE_HFP} \ |
| ${DSP_CONFIG} ${DEVICE_CONFIG_DIR} |
| end script |