| # Copyright (c) 2014 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. |
| |
| from autotest_lib.server import utils |
| |
| AUTHOR = "[email protected]" |
| NAME = "kernel_ExternalUsbPeripheralsDetectionTest" |
| PURPOSE = "Kernel USB detection test" |
| CRITERIA = "This test will fail if any of the actions or checks fail." |
| TIME = "SHORT" |
| TEST_CATEGORY = "Functional" |
| TEST_CLASS = "platform, kernel" |
| TEST_TYPE = "server" |
| #ATTRIBUTES = "suite:usb_detect" |
| DEPENDENCIES = "servo, kernel_usb" |
| |
| DOC = """ |
| This test uses servo to connect USB devices. |
| This test verifies if drivers are created for each USB device or not. |
| |
| The test fails if |
| - if USB device is not detected in lsusb command |
| - if driver for USB device is not created |
| - USB detected peripherals are different than expected |
| - there is no servo board attached |
| |
| Set1 is set of four USB peripherals plugged |
| - LG Android phone |
| - USB 3G dongle |
| - USB HD Webcam - should be Logitech HD Pro Webcam C920 |
| - USB3.0 Card Reader |
| - USB Headphone |
| - USB Mouse |
| """ |
| |
| args_dict = utils.args_to_dict(args) |
| servo_args = hosts.CrosHost.get_servo_arguments(args_dict) |
| |
| def run(machine): |
| host = hosts.create_host(machine, servo_args=servo_args) |
| |
| usb_checks = { |
| # Microsoft Headphone |
| # str("lsusb -v -d 045e:070f") : |
| # ["idVendor\s+0x045e\s+Microsoft", "Audio"], |
| # Webcam |
| str("lsusb -v -d 058f:") : |
| ["idVendor\s+0x058f\s+Alcor", "iProduct.*(TeckNet|2.0 PC Camera)"], |
| |
| } |
| |
| vendor_id_dict_control_file = { |
| # '045e': 'Microsoft Headphone', |
| |
| '058f': 'Webcam', |
| } |
| |
| job.run_test("kernel_ExternalUsbPeripheralsDetectionTest", host=host, |
| disable_sysinfo=True, usb_checks=usb_checks, |
| vendor_id_dict_control_file=vendor_id_dict_control_file) |
| |
| parallel_simple(run, machines) |