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

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

Issue 826283002: Add support for sending a USB SET_CONFIGURATION request. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 // Use the <code>chrome.usb</code> API to interact with connected USB 5 // Use the <code>chrome.usb</code> API to interact with connected USB
6 // devices. This API provides access to USB operations from within the context 6 // devices. This API provides access to USB operations from within the context
7 // of an app. Using this API, apps can function as drivers for hardware devices. 7 // of an app. Using this API, apps can function as drivers for hardware devices.
8 // 8 //
9 // Errors generated by this API are reported by setting 9 // Errors generated by this API are reported by setting
10 // $(ref:runtime.lastError) and executing the function's regular callback. The 10 // $(ref:runtime.lastError) and executing the function's regular callback. The
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 // Filter the list of devices presented to the user. If multiple filters are 203 // Filter the list of devices presented to the user. If multiple filters are
204 // provided devices matching any filter will be displayed. 204 // provided devices matching any filter will be displayed.
205 DeviceFilter[]? filters; 205 DeviceFilter[]? filters;
206 }; 206 };
207 207
208 callback VoidCallback = void (); 208 callback VoidCallback = void ();
209 callback GetDevicesCallback = void (Device[] devices); 209 callback GetDevicesCallback = void (Device[] devices);
210 callback RequestAccessCallback = void (boolean success); 210 callback RequestAccessCallback = void (boolean success);
211 callback OpenDeviceCallback = void (ConnectionHandle handle); 211 callback OpenDeviceCallback = void (ConnectionHandle handle);
212 callback FindDevicesCallback = void (ConnectionHandle[] handles); 212 callback FindDevicesCallback = void (ConnectionHandle[] handles);
213 callback SetConfigurationCallback = void (boolean success);
213 callback GetConfigurationCallback = void (ConfigDescriptor config); 214 callback GetConfigurationCallback = void (ConfigDescriptor config);
214 callback ListInterfacesCallback = void (InterfaceDescriptor[] descriptors); 215 callback ListInterfacesCallback = void (InterfaceDescriptor[] descriptors);
215 callback CloseDeviceCallback = void (); 216 callback CloseDeviceCallback = void ();
216 callback TransferCallback = void (TransferResultInfo info); 217 callback TransferCallback = void (TransferResultInfo info);
217 callback ResetDeviceCallback = void(boolean success); 218 callback ResetDeviceCallback = void(boolean success);
218 219
219 interface Functions { 220 interface Functions {
220 // Enumerates connected USB devices. 221 // Enumerates connected USB devices.
221 // |options|: The properties to search for on target devices. 222 // |options|: The properties to search for on target devices.
222 static void getDevices(EnumerateDevicesOptions options, 223 static void getDevices(EnumerateDevicesOptions options,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // |options|: The properties to search for on target devices. 262 // |options|: The properties to search for on target devices.
262 static void findDevices(EnumerateDevicesAndRequestAccessOptions options, 263 static void findDevices(EnumerateDevicesAndRequestAccessOptions options,
263 FindDevicesCallback callback); 264 FindDevicesCallback callback);
264 265
265 // Closes a connection handle. Invoking operations on a handle after it 266 // Closes a connection handle. Invoking operations on a handle after it
266 // has been closed is a safe operation but causes no action to be taken. 267 // has been closed is a safe operation but causes no action to be taken.
267 // |handle|: The $(ref:ConnectionHandle) to close. 268 // |handle|: The $(ref:ConnectionHandle) to close.
268 static void closeDevice(ConnectionHandle handle, 269 static void closeDevice(ConnectionHandle handle,
269 optional CloseDeviceCallback callback); 270 optional CloseDeviceCallback callback);
270 271
272 // Select a device configuration.
273 //
274 // This function effectively resets the device by selecting one of the
275 // device's available configurations. Only configuration values greater
276 // than <code>0</code> are valid however some buggy devices have a working
277 // configuration <code>0</code> and so this value is allowed.
278 // |handle|: An open connection to the device.
279 static void setConfiguration(ConnectionHandle handle,
280 long configurationValue,
281 SetConfigurationCallback callback);
282
271 // Gets the configuration descriptor for the currently selected 283 // Gets the configuration descriptor for the currently selected
272 // configuration. 284 // configuration.
273 // |handle|: An open connection to the device. 285 // |handle|: An open connection to the device.
274 static void getConfiguration(ConnectionHandle handle, 286 static void getConfiguration(ConnectionHandle handle,
275 GetConfigurationCallback callback); 287 GetConfigurationCallback callback);
276 288
277 // Lists all interfaces on a USB device. 289 // Lists all interfaces on a USB device.
278 // |handle|: An open connection to the device. 290 // |handle|: An open connection to the device.
279 static void listInterfaces(ConnectionHandle handle, 291 static void listInterfaces(ConnectionHandle handle,
280 ListInterfacesCallback callback); 292 ListInterfacesCallback callback);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 // device. Permission may have been granted at install time, when the user 369 // device. Permission may have been granted at install time, when the user
358 // accepted an optional permission (see $(ref:permissions.request)), or 370 // accepted an optional permission (see $(ref:permissions.request)), or
359 // through $(ref:getUserSelectedDevices). 371 // through $(ref:getUserSelectedDevices).
360 static void onDeviceAdded(Device device); 372 static void onDeviceAdded(Device device);
361 373
362 // Event generated when a device is removed from the system. See 374 // Event generated when a device is removed from the system. See
363 // $(ref:onDeviceAdded) for which events are delivered. 375 // $(ref:onDeviceAdded) for which events are delivered.
364 static void onDeviceRemoved(Device device); 376 static void onDeviceRemoved(Device device);
365 }; 377 };
366 }; 378 };
OLDNEW
« no previous file with comments | « extensions/common/api/_api_features.json ('k') | extensions/test/data/api_test/usb/list_interfaces/test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698