1# Copyright (c) 2014 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 = "jimishs@google.com" 8NAME = "kernel_ExternalUsbPeripheralsDetectionTest" 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" 15ATTRIBUTES = "suite:usb_detect" 16DEPENDENCIES = "servo, kernel_usb" 17 18DOC = """ 19This test uses servo to connect USB devices. 20This test verifies if drivers are created for each USB device or not. 21 22The test fails if 23- if USB device is not detected in lsusb command 24- if driver for USB device is not created 25- USB detected peripherals are different than expected 26- there is no servo board attached 27 28Set1 is set of four USB peripherals plugged 29- LG Android phone 30- USB 3G dongle 31- USB HD Webcam - should be Logitech HD Pro Webcam C920 32- USB3.0 Card Reader 33- USB Headphone 34- USB Mouse 35""" 36 37args_dict = utils.args_to_dict(args) 38servo_args = hosts.CrosHost.get_servo_arguments(args_dict) 39 40def run(machine): 41 host = hosts.create_host(machine, servo_args=servo_args) 42 43 usb_checks = { 44 # Microsoft Headphone 45 # str("lsusb -v -d 045e:070f") : 46 # ["idVendor\s+0x045e\s+Microsoft", "Audio"], 47 # Webcam 48 str("lsusb -v -d 058f:") : 49 ["idVendor\s+0x058f\s+Alcor", "iProduct.*(TeckNet|2.0 PC Camera)"], 50 51 } 52 53 vendor_id_dict_control_file = { 54 # '045e': 'Microsoft Headphone', 55 56 '058f': 'Webcam', 57 } 58 59 job.run_test("kernel_ExternalUsbPeripheralsDetectionTest", host=host, 60 disable_sysinfo=True, usb_checks=usb_checks, 61 vendor_id_dict_control_file=vendor_id_dict_control_file) 62 63parallel_simple(run, machines) 64