| # Copyright 2018 The ChromiumOS Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| description "Load vivid module, required by camera tests on VM" | |
| author "chromium-os-dev@chromium.org" | |
| start on started system-services | |
| task | |
| # This need to be run to ensure that camera tests works on VM. | |
| # The task is short-lived setup after boot and unlikely to run out of memory. | |
| oom score never | |
| # We use vivid, which emulates video4linux hardwares, to run camera tests on VM | |
| # boards. | |
| # By loading vivid in upstart, each test doesn't have to care whether a DUT is a | |
| # VM or not. | |
| # | |
| # The following script loads vivid as a video capture device if the DUT is QEMU | |
| # or GCE. | |
| # |n_devs| in the module parameter is the number of instances to create. | |
| # "0x101" for |node_types| represents a video capture device and a video output | |
| # device. | |
| # TODO(b:235025532): Currently a check in vivid-core.c prevents creating only | |
| # the video capture device without an output device. | |
| script | |
| if grep -sq "^QEMU$" /sys/devices/virtual/dmi/id/sys_vendor || | |
| grep -sq "^Google Compute Engine$" /sys/devices/virtual/dmi/id/board_name | |
| then | |
| modprobe vivid n_devs=1 node_types=0x101 | |
| fi | |
| end script |