| # Copyright 2017 The ChromiumOS Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| description "Start sensors for a container" | |
| author "chromium-os-dev@chromium.org" | |
| start on started arcpp-post-login-services | |
| stop on stopped arcpp-post-login-services | |
| # This job does not have script/exec stanza, so it is considered running forever | |
| # once started. See: http://upstart.ubuntu.com/cookbook/#jobs-that-run-forever | |
| post-stop script | |
| { | |
| echo "Post-stop arc-sensor" | |
| set +e -x | |
| ring_buffer_dir="$(find /sys/devices -path '*cros-ec-ring*' -name buffer)" | |
| if [ -d "${ring_buffer_dir}" ]; then | |
| # Disable the ring buffer, nobody will process the entries anymore. | |
| # Android Sensor HAL has code to disable the buffer, but it is never | |
| # called. | |
| echo 0 > "${ring_buffer_dir}/enable" | |
| fi | |
| } 2>&1 | logger -t "${UPSTART_JOB}" | |
| end script |