blob: 329f1829e93f085e5a19aa297d8f1908d619397e [file] [log] [blame]
# Copyright 2017 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.
description "Start sensors for a container"
author "chromium-os-dev@chromium.org"
start on started arc-boot-continue
stop on stopped arc-boot-continue
# 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