1"""CfM USB device constants.
2
3This module contains constants for known USB device specs.
4
5A UsbDeviceSpec instance represents a known USB device and its spec;
6 - VendorID
7 - ProdID
8 - interfaces
9
10This is different from a UsbDevice instance which represents a device actually
11connected to the CfM and found by the usb-device command.
12
13A UsbDevice instance found connected to a CfM is expected to match a known
14UsbDeviceSpec (mapping is done using vid:pid), but due to bugs that might
15not be the case (list of interfaces might be different for example).
16"""
17
18from autotest_lib.client.common_lib.cros.cfm.usb import usb_device_spec
19
20# Cameras
21HUDDLY_GO = usb_device_spec.UsbDeviceSpec(
22    vid='2bd9',
23    pid='0011',
24    product='Huddly GO',
25    interfaces=['uvcvideo', 'uvcvideo', 'uvcvideo', 'uvcvideo'],
26)
27
28LOGITECH_WEBCAM_C930E = usb_device_spec.UsbDeviceSpec(
29    vid='046d',
30    pid='0843',
31    product='Logitech Webcam C930e',
32    interfaces=['uvcvideo', 'uvcvideo', 'snd-usb-audio', 'snd-usb-audio']
33)
34
35HD_PRO_WEBCAM_C920 = usb_device_spec.UsbDeviceSpec(
36    vid='046d',
37    pid='082d',
38    product='HD Pro Webcam C920',
39    interfaces=['uvcvideo', 'uvcvideo', 'snd-usb-audio', 'snd-usb-audio'],
40)
41
42PTZ_PRO_CAMERA = usb_device_spec.UsbDeviceSpec(
43    vid='046d',
44    pid='0853',
45    product='PTZ Pro Camera',
46    interfaces=['uvcvideo', 'uvcvideo', 'usbhid'],
47)
48
49PTZ_PRO_2_CAMERA = usb_device_spec.UsbDeviceSpec(
50    vid='046d',
51    pid='085f',
52    product='PTZ Pro 2 Camera',
53    interfaces=['uvcvideo', 'uvcvideo', 'usbhid'],
54)
55
56# Audio peripherals
57ATRUS = usb_device_spec.UsbDeviceSpec(
58    vid='18d1',
59    pid='8001',
60    product='Hangouts Meet speakermic',
61    interfaces=['snd-usb-audio', 'snd-usb-audio', 'snd-usb-audio', 'usbhid'],
62)
63
64JABRA_SPEAK_410 = usb_device_spec.UsbDeviceSpec(
65    vid='0b0e',
66    pid='0412',
67    product='Jabra SPEAK 410',
68    interfaces=['snd-usb-audio', 'snd-usb-audio', 'snd-usb-audio'],
69)
70
71# MiMOs
72MIMO_VUE_HD_DISPLAY = usb_device_spec.UsbDeviceSpec(
73    vid='17e9',
74    pid='016b',
75    product='MIMO VUE HD',
76    interfaces=['udl'],
77)
78
79# The MiMO's firmware is tied to the Chrome OS version. The firmware was updated
80# in Chrome OS 65.0.3319.0. This resulted in the PID being changed from 016b to
81# 416d. The following device is the device with the new PID. We need to support
82# both versions since we want to support tests at the ToT revision running
83# against older Chrome OS versions.
84MIMO_VUE_HD_DISPLAY_PLANKTON = usb_device_spec.UsbDeviceSpec(
85    vid='17e9',
86    pid='416d',
87    product='MIMO VUE HD',
88    interfaces=['udl'],
89)
90
91# Tuple with all known MIMO display specs that we support.
92ALL_MIMO_DISPLAYS = (MIMO_VUE_HD_DISPLAY, MIMO_VUE_HD_DISPLAY_PLANKTON)
93
94MIMO_VUE_HID_TOUCH_CONTROLLER = usb_device_spec.UsbDeviceSpec(
95    vid='266e',
96    pid='0110',
97    product='SiS HID Touch Controller',
98    interfaces=['usbhid'],
99)
100
101# Utility methods
102def get_usb_device_spec(vid_pid):
103  """
104  Look up UsbDeviceSpec based on vid_pid.
105  @return UsbDeviceSpec with matching vid_pid or None if no match.
106  """
107  return usb_device_spec.UsbDeviceSpec.get_usb_device_spec(vid_pid)
108