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 5 from autotest_lib.server import utils 6 7 AUTHOR = "jimishs (a] google.com" 8 NAME = "kernel_ExternalUsbPeripheralsDetectionTest" 9 PURPOSE = "Kernel USB detection test" 10 CRITERIA = "This test will fail if any of the actions or checks fail." 11 TIME = "SHORT" 12 TEST_CATEGORY = "Functional" 13 TEST_CLASS = "platform, kernel" 14 TEST_TYPE = "server" 15 ATTRIBUTES = "suite:usb_detect" 16 DEPENDENCIES = "servo, kernel_usb" 17 18 DOC = """ 19 This test uses servo to connect USB devices. 20 This test verifies if drivers are created for each USB device or not. 21 22 The 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 28 Set1 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 37 args_dict = utils.args_to_dict(args) 38 servo_args = hosts.CrosHost.get_servo_arguments(args_dict) 39 40 def 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 63 parallel_simple(run, machines) 64