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 // 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.
10 // Properties for matching devices. A device matches of any of its interfaces
11 // match the given properties. An empty dictionary matches any device.
12 dictionary DeviceFilter
{
13 // Device-level matching criteria:
15 // Checked only if the vendorId matches.
18 // Per-interface matching criteria:
20 // Checked only if the interfaceClass matches.
21 long? interfaceSubclass
;
22 // Checked only if the interfaceSubclass matches.
23 long? interfaceProtocol
;
26 dictionary DeviceInfo
{
27 long vendorId
; // idVendor from the device
28 long productId
; // idProduct from the device
30 // Vendor and product names from an internal database.
31 DOMString? vendorName
;
32 DOMString? productName
;
34 // iManufacturer, iProduct and iSerial strings from the device.
35 DOMString? manufacturerString
;
36 DOMString? productString
;
37 DOMString? serialString
;
40 callback GetDevicesCallback
= void (long[] deviceIds
);
41 callback GetDeviceInfoCallback
= void (DeviceInfo deviceInfo
);
44 // Lists USB devices matching any of the given filters.
45 // |filters|: The properties to search for on target devices.
46 // |callback|: Invoked with a list of device IDs on complete.
47 static
void getDevices
(DeviceFilter
[] filters
,
48 GetDevicesCallback
callback);
50 // Gets basic display information about a device.
51 // |deviceId|: The device ID (from |getDevices|).
52 // |callback|: Invoked with |DeviceInfo| from the device.
53 static
void getDeviceInfo
(long deviceId
, GetDeviceInfoCallback
callback);