Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1463)

Side by Side Diff: chrome/common/extensions/api/usb.idl

Issue 12471013: Add chrome.usb.listInterfaces API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 namespace usb { 5 namespace usb {
6 6
7 // Direction, Recipient and RequestType all map to their namesakes within the 7 // Direction, Recipient, RequestType, and EndpointType all map to their
8 // USB specification. 8 // namesakes within the USB specification.
9 enum Direction {in, out}; 9 enum Direction {in, out};
10 enum Recipient {device, _interface, endpoint, other}; 10 enum Recipient {device, _interface, endpoint, other};
11 enum RequestType {standard, class, vendor, reserved}; 11 enum RequestType {standard, class, vendor, reserved};
12 enum EndpointType {control, interrupt, isochronous, bulk};
13
14 // For isochronous mode, SynchronizationType and UsageType map to their
15 // namesakes within the USB specification.
16 enum SynchronizationType {asynchronous, adaptive, synchronous};
17 enum UsageType {data, feedback, explicitFeedback};
12 18
13 // A Device encapsulates everything that is needed to communicate with a USB 19 // A Device encapsulates everything that is needed to communicate with a USB
14 // device. They are returned by findDevice calls and have all of their 20 // device. They are returned by findDevice calls and have all of their
15 // fields populated before being returned. 21 // fields populated before being returned.
16 dictionary Device { 22 dictionary Device {
17 long handle; 23 long handle;
18 long vendorId; 24 long vendorId;
19 long productId; 25 long productId;
20 }; 26 };
21 27
28 dictionary EndpointDescriptor {
29 long address;
30 EndpointType type;
31 Direction direction;
32 long maximumPacketSize;
33
34 // Used for isochronous mode.
35 SynchronizationType? synchronization;
36 UsageType? usage;
37
38 // If this is an interrupt endpoint, this will be 1-255
39 long? pollingInterval;
40 };
41
42 dictionary InterfaceDescriptor {
43 long interfaceNumber;
44 long alternateSetting;
45 long interfaceClass;
46 long interfaceSubclass;
47 long interfaceProtocol;
48 DOMString? description;
49 EndpointDescriptor[] endpoints;
50 };
51
22 // ControlTransferInfo represents that parameters to a single USB control 52 // ControlTransferInfo represents that parameters to a single USB control
23 // transfer. 53 // transfer.
24 dictionary ControlTransferInfo { 54 dictionary ControlTransferInfo {
25 // The direction of this transfer. 55 // The direction of this transfer.
26 Direction direction; 56 Direction direction;
27 57
28 // The intended recipient for this transfer. 58 // The intended recipient for this transfer.
29 Recipient recipient; 59 Recipient recipient;
30 60
31 // The type of this request. 61 // The type of this request.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 120
91 // FindDevicesOptions describes the properties of devices which are found and 121 // FindDevicesOptions describes the properties of devices which are found and
92 // opened via findDevices. 122 // opened via findDevices.
93 dictionary FindDevicesOptions { 123 dictionary FindDevicesOptions {
94 long vendorId; 124 long vendorId;
95 long productId; 125 long productId;
96 }; 126 };
97 127
98 callback VoidCallback = void (); 128 callback VoidCallback = void ();
99 callback FindDevicesCallback = void (Device[] device); 129 callback FindDevicesCallback = void (Device[] device);
130 callback ListInterfacesCallback = void (InterfaceDescriptor[] descriptors);
100 callback CloseDeviceCallback = void (); 131 callback CloseDeviceCallback = void ();
101 callback TransferCallback = void (TransferResultInfo info); 132 callback TransferCallback = void (TransferResultInfo info);
102 133
103 interface Functions { 134 interface Functions {
104 // Finds the first instance of the USB device specified by the vendorId/ 135 // Finds the first instance of the USB device specified by the vendorId/
105 // productId pair and, if permissions allow, opens it for use. 136 // productId pair and, if permissions allow, opens it for use.
106 // Upon successfully opening a device the callback is invoked with a 137 // Upon successfully opening a device the callback is invoked with a
107 // populated Device object. On failure, the callback is invoked with null. 138 // populated Device object. On failure, the callback is invoked with null.
108 // |options|: The properties to search for on target devices. 139 // |options|: The properties to search for on target devices.
109 // |callback|: Invoked with the opened Device on success. 140 // |callback|: Invoked with the opened Device on success.
110 static void findDevices(FindDevicesOptions options, 141 static void findDevices(FindDevicesOptions options,
111 FindDevicesCallback callback); 142 FindDevicesCallback callback);
112 143
113 // Closes an open device instance. Invoking operations on a device after it 144 // Closes an open device instance. Invoking operations on a device after it
114 // has been closed is a safe operation, but causes no action to be taken. 145 // has been closed is a safe operation, but causes no action to be taken.
115 // |device|: The device to close. 146 // |device|: The device to close.
116 // |callback|: The callback to invoke once the device is closed. 147 // |callback|: The callback to invoke once the device is closed.
117 static void closeDevice(Device device, 148 static void closeDevice(Device device,
118 optional CloseDeviceCallback callback); 149 optional CloseDeviceCallback callback);
119 150
151 // Lists all the interfaces on the USB device.
152 // |device|: The device from which the interfaces should be listed.
153 // |callback|: The callback to invoke when the interfaces are enumerated.
154 static void listInterfaces(Device device,
155 ListInterfacesCallback callback);
156
120 // Claims an interface on the specified USB device. 157 // Claims an interface on the specified USB device.
121 // |device|: The device on which the interface is to be claimed. 158 // |device|: The device on which the interface is to be claimed.
122 // |interface|: The interface number to be claimed. 159 // |interface|: The interface number to be claimed.
123 // |callback|: The callback to invoke once the interface is claimed. 160 // |callback|: The callback to invoke once the interface is claimed.
124 static void claimInterface(Device device, long interfaceNumber, 161 static void claimInterface(Device device, long interfaceNumber,
125 VoidCallback callback); 162 VoidCallback callback);
126 163
127 // Releases a claim to an interface on the provided device. 164 // Releases a claim to an interface on the provided device.
128 // |device|: The device on which the interface is to be released. 165 // |device|: The device on which the interface is to be released.
129 // |interface|: The interface number to be released. 166 // |interface|: The interface number to be released.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 // Performs an isochronous transfer on the specific device. 203 // Performs an isochronous transfer on the specific device.
167 // |device|: An open device to make the transfer on. 204 // |device|: An open device to make the transfer on.
168 // |transferInfo|: The parameters to the transfer. See 205 // |transferInfo|: The parameters to the transfer. See
169 // IsochronousTransferInfo. 206 // IsochronousTransferInfo.
170 // |callback|: Invoked once the transfer has been completed. 207 // |callback|: Invoked once the transfer has been completed.
171 static void isochronousTransfer(Device device, 208 static void isochronousTransfer(Device device,
172 IsochronousTransferInfo transferInfo, 209 IsochronousTransferInfo transferInfo,
173 TransferCallback callback); 210 TransferCallback callback);
174 }; 211 };
175 }; 212 };
OLDNEW
« chrome/browser/usb/usb_interface.h ('K') | « chrome/chrome_browser.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698