blob: 632570ab42ed279f475254dd2f2a3785c8a48b91 [file] [log] [blame]
# Copyright (c) 2010 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.
import logging
import os
from autotest_lib.client.bin import test, utils
from autotest_lib.client.common_lib import error
from import device_capability
class camera_V4L2(test.test):
version = 1
preserve_srcdir = True
def run_once(self, capability=None, test_list=None):
if capability is not None:
# Enable USB camera HW timestamp
path = "/sys/module/uvcvideo/parameters/hwtimestamps"
if os.path.exists(path):
utils.system("echo 1 > %s" % path)
if test_list is None:
test_list = "halv3" if self.should_test_halv3() else "default"
self.test_list = test_list
for device in self.v4l2_devices:
def should_test_halv3(self):
has_v3 = os.path.exists('/usr/bin/cros_camera_service')
has_v1 = os.path.exists('/usr/bin/arc_camera_service')
return has_v3 and not has_v1
def find_video_capture_devices(self):
cmd = ["media_v4l2_test", "--list_usbcam"]
stdout = utils.system_output(cmd, retain_output=True)
self.v4l2_devices = stdout.splitlines()
if not self.v4l2_devices:
raise error.TestFail("No V4L2 devices found!")
def run_v4l2_test(self, device):
cmd = [
"--device_path=%s" % device,
if self.test_list:
cmd.append("--test_list=%s" % self.test_list)"Running %s", cmd)
stdout = utils.system_output(cmd, retain_output=True)