Roll src/third_party/WebKit c8d1660:ae3684d (svn 197337:197343)
[chromium-blink-merge.git] / tools / usb_gadget / default_gadget.py
blob707c51be55920f3111f64e453e5462f7028d5e59
1 # Copyright 2014 The Chromium 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.
5 """Default gadget configuration."""
7 import gadget
8 import usb_constants
9 import usb_descriptors
12 class DefaultGadget(gadget.Gadget):
14 def __init__(self):
15 device_desc = usb_descriptors.DeviceDescriptor(
16 idVendor=usb_constants.VendorID.GOOGLE,
17 idProduct=usb_constants.ProductID.GOOGLE_TEST_GADGET,
18 bcdUSB=0x0200,
19 iManufacturer=1,
20 iProduct=2,
21 iSerialNumber=3,
22 bcdDevice=0x0100)
24 fs_config_desc = usb_descriptors.ConfigurationDescriptor(
25 bmAttributes=0x80,
26 MaxPower=50)
28 hs_config_desc = usb_descriptors.ConfigurationDescriptor(
29 bmAttributes=0x80,
30 MaxPower=50)
32 interface_desc = usb_descriptors.InterfaceDescriptor(
33 bInterfaceNumber=0)
34 fs_config_desc.AddInterface(interface_desc)
35 hs_config_desc.AddInterface(interface_desc)
37 super(DefaultGadget, self).__init__(
38 device_desc, fs_config_desc, hs_config_desc)
40 self.AddStringDescriptor(1, "Google Inc.")
41 self.AddStringDescriptor(2, "Test Gadget (default state)")