| OLD | NEW |
| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 // Opens a USB device returned by $(ref:getDevices). | 207 // Opens a USB device returned by $(ref:getDevices). |
| 208 // |device|: The $(ref:Device) to open. | 208 // |device|: The $(ref:Device) to open. |
| 209 static void openDevice(Device device, OpenDeviceCallback callback); | 209 static void openDevice(Device device, OpenDeviceCallback callback); |
| 210 | 210 |
| 211 // Finds USB devices specified by the vendor, product and (optionally) | 211 // Finds USB devices specified by the vendor, product and (optionally) |
| 212 // interface IDs and if permissions allow opens them for use. | 212 // interface IDs and if permissions allow opens them for use. |
| 213 // | 213 // |
| 214 // On Chrome OS, you can specify the interface ID. In that case the method | 214 // On Chrome OS, you can specify the interface ID. In that case the method |
| 215 // will request access from permission broker in the same way as | 215 // will request access from permission broker in the same way as |
| 216 // $(ref:requestUsbAccess). | 216 // $(ref:requestAccess). |
| 217 // | 217 // |
| 218 // If the access request is rejected or the device fails to be opened a | 218 // If the access request is rejected or the device fails to be opened a |
| 219 // connection handle will not be created or returned. | 219 // connection handle will not be created or returned. |
| 220 // | 220 // |
| 221 // Calling this method is equivalent to calling $(ref:getDevices followed by | 221 // Calling this method is equivalent to calling $(ref:getDevices followed by |
| 222 // $(ref:requestAccess) (if it is on ChromeOS) and $(ref:openDevice) for | 222 // $(ref:requestAccess) (if it is on ChromeOS) and $(ref:openDevice) for |
| 223 // each device. | 223 // each device. |
| 224 // | 224 // |
| 225 // |options|: The properties to search for on target devices. | 225 // |options|: The properties to search for on target devices. |
| 226 static void findDevices(EnumerateDevicesAndRequestAccessOptions options, | 226 static void findDevices(EnumerateDevicesAndRequestAccessOptions options, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 // If the reset fails, the given connection handle will be closed and the | 302 // If the reset fails, the given connection handle will be closed and the |
| 303 // USB device will appear to be disconnected then reconnected. | 303 // USB device will appear to be disconnected then reconnected. |
| 304 // In this case $(ref:getDevices) or $(ref:findDevices) must be called again | 304 // In this case $(ref:getDevices) or $(ref:findDevices) must be called again |
| 305 // to acquire the device. | 305 // to acquire the device. |
| 306 // | 306 // |
| 307 // |handle|: A connection handle to reset. | 307 // |handle|: A connection handle to reset. |
| 308 static void resetDevice(ConnectionHandle handle, | 308 static void resetDevice(ConnectionHandle handle, |
| 309 ResetDeviceCallback callback); | 309 ResetDeviceCallback callback); |
| 310 }; | 310 }; |
| 311 }; | 311 }; |
| OLD | NEW |