OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 """Default gadget configuration.""" |
| 6 |
| 7 import gadget |
| 8 import usb_constants |
| 9 import usb_descriptors |
| 10 |
| 11 |
| 12 class DefaultGadget(gadget.Gadget): |
| 13 |
| 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) |
| 23 |
| 24 fs_config_desc = usb_descriptors.ConfigurationDescriptor( |
| 25 bmAttributes=0x80, |
| 26 MaxPower=50) |
| 27 |
| 28 hs_config_desc = usb_descriptors.ConfigurationDescriptor( |
| 29 bmAttributes=0x80, |
| 30 MaxPower=50) |
| 31 |
| 32 interface_desc = usb_descriptors.InterfaceDescriptor( |
| 33 bInterfaceNumber=0) |
| 34 fs_config_desc.AddInterface(interface_desc) |
| 35 hs_config_desc.AddInterface(interface_desc) |
| 36 |
| 37 super(DefaultGadget, self).__init__( |
| 38 device_desc, fs_config_desc, hs_config_desc) |
| 39 |
| 40 self.AddStringDescriptor(1, "Google Inc.") |
| 41 self.AddStringDescriptor(2, "Test Gadget (default state)") |
OLD | NEW |