1# Copyright (c) 2016 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 5from autotest_lib.server import utils 6 7AUTHOR = "Chrome OS Team" 8NAME = "kernel_ExternalUsbPeripheralsDetectionTest.printer_hp" 9PURPOSE = "Kernel USB detection test" 10CRITERIA = "This test will fail if any of the actions or checks fail." 11TIME = "SHORT" 12TEST_CATEGORY = "Functional" 13TEST_CLASS = "platform, kernel" 14TEST_TYPE = "server" 15DEPENDENCIES = "servo_state:WORKING, usb_printer_hp" 16 17DOC = """ 18This test uses servo to connect USB devices. 19This test verifies if drivers are created for each USB device or not. 20 21The test fails if 22- if USB device is not detected in lsusb command 23- if driver for USB device is not created 24- USB detected peripherals are different than expected 25- there is no servo board attached 26 27USB peripherals plugged 28- USB printer 29""" 30 31args_dict = utils.args_to_dict(args) 32servo_args = hosts.CrosHost.get_servo_arguments(args_dict) 33 34def run(machine): 35 host = hosts.create_host(machine, servo_args=servo_args) 36 37 usb_checks = { 38 # Epson or HP USB printer 39 str("lsusb") : 40 ["03f0:d911 Hewlett-Packard"], 41 str("lsusb -v -d 03f0:d911") : 42 ["iProduct.*OfficeJet 4650 series", 43 "bInterfaceClass.*Printer"], 44 } 45 46 vendor_id_dict_control_file = {'03f0': 'Printer'} 47 48 job.run_test("kernel_ExternalUsbPeripheralsDetectionTest", host=host, 49 disable_sysinfo=True, usb_checks=usb_checks, tag="printer_hp", 50 vendor_id_dict_control_file=vendor_id_dict_control_file) 51 52parallel_simple(run, machines) 53