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// Use the <code>chrome.usbPrivate</code> API to interact with connected USB 6// devices. This API provides private extensions to the <code>chrome.usb</code> 7// API which should only be available to trusted pages. 8namespace usbPrivate { 9 10 dictionary DeviceInfo { 11 long vendorId; // idVendor from the device 12 long productId; // idProduct from the device 13 14 // Vendor and product names from an internal database. 15 DOMString? vendorName; 16 DOMString? productName; 17 18 // iManufacturer, iProduct and iSerial strings from the device. 19 DOMString? manufacturerString; 20 DOMString? productString; 21 DOMString? serialString; 22 }; 23 24 callback GetDevicesCallback = void (long[] deviceIds); 25 callback GetDeviceInfoCallback = void (DeviceInfo deviceInfo); 26 27 interface Functions { 28 // Lists USB devices matching any of the given filters. 29 // |filters|: The properties to search for on target devices. 30 // |callback|: Invoked with a list of device IDs on complete. 31 static void getDevices(usb.DeviceFilter[] filters, 32 GetDevicesCallback callback); 33 34 // Gets basic display information about a device. 35 // |deviceId|: The device ID (from |getDevices|). 36 // |callback|: Invoked with |DeviceInfo| from the device. 37 static void getDeviceInfo(long deviceId, GetDeviceInfoCallback callback); 38 }; 39}; 40