• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# Installed by ADHD package.
6# cras upstart job.
7
8description     "Chrome OS audio server"
9author          "chromium-os-dev@chromium.org"
10
11env CRAS_SOCKET_DIR=/run/cras
12env CRAS_VMS_SOCKET_DIR=/run/cras/vms
13env CRAS_PLUGIN_DIR=/run/cras/vms/plugin
14env CRAS_ARGS=
15
16start on starting system-services
17stop on stopping system-services
18respawn
19
20# Allow the audio server real time priority.
21limit rtprio 12 12
22
23pre-start script
24  mkdir -p -m 1770 "${CRAS_SOCKET_DIR}"
25  chown -R cras:cras "${CRAS_SOCKET_DIR}"
26  mkdir -p -m 1770 "${CRAS_VMS_SOCKET_DIR}"
27  chown -R cras:cras "${CRAS_VMS_SOCKET_DIR}"
28  for socket_dir in playback unified; do
29    mkdir -p -m 1770 "${CRAS_PLUGIN_DIR}/${socket_dir}"
30    chown -R cras:cras "${CRAS_PLUGIN_DIR}/${socket_dir}"
31  done
32  mkdir -m 0755 -p /var/lib/cras
33  chown -R cras:cras /var/lib/cras
34end script
35
36exec /bin/sh /usr/share/cros/init/cras.sh
37
38# sound_card_init uses CRAS stop timestamp as a criterion to skip boot time
39# calibration for DSM.
40post-stop script
41  echo "$(date +---%\nsecs:\ %s%\nnanos:\ %N)" > /var/lib/cras/stop
42end script
43