| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 module device.usb; | 5 module device.usb; |
| 6 | 6 |
| 7 enum OpenDeviceError { |
| 8 // Opening the device succeeded. |
| 9 OK, |
| 10 |
| 11 // The operating system denied access to the device. |
| 12 ACCESS_DENIED, |
| 13 }; |
| 14 |
| 7 enum TransferDirection { | 15 enum TransferDirection { |
| 8 IN, | 16 IN, |
| 9 OUT, | 17 OUT, |
| 10 }; | 18 }; |
| 11 | 19 |
| 12 enum ControlTransferType { | 20 enum ControlTransferType { |
| 13 STANDARD, | 21 STANDARD, |
| 14 CLASS, | 22 CLASS, |
| 15 VENDOR, | 23 VENDOR, |
| 16 RESERVED | 24 RESERVED |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // The transfer succeeded, but the device sent more data than was requested. | 130 // The transfer succeeded, but the device sent more data than was requested. |
| 123 // This applies only to inbound transfers. | 131 // This applies only to inbound transfers. |
| 124 BABBLE, | 132 BABBLE, |
| 125 | 133 |
| 126 // The transfer succeeded, but the device sent less data than was requested. | 134 // The transfer succeeded, but the device sent less data than was requested. |
| 127 // This applies only to inbound transfers. | 135 // This applies only to inbound transfers. |
| 128 SHORT_PACKET, | 136 SHORT_PACKET, |
| 129 }; | 137 }; |
| 130 | 138 |
| 131 interface Device { | 139 interface Device { |
| 132 // Closes the device. Calling this effectively invalidates the Device object. | 140 // Retrieve a DeviceInfo struct containing metadata about the device, |
| 141 // including the set of all available device configurations. |
| 142 GetDeviceInfo() => (DeviceInfo? info); |
| 143 |
| 144 // Retrieves the device's currently active configuration. May return null if |
| 145 // the device is unconfigured. |
| 146 GetConfiguration() => (ConfigurationInfo? info); |
| 147 |
| 148 // Opens the device. Methods below require the device be opened first. |
| 149 Open() => (OpenDeviceError error); |
| 150 |
| 151 // Closes the device. |
| 133 Close() => (); | 152 Close() => (); |
| 134 | 153 |
| 135 // Retrieve a DeviceInfo struct containing metadata about the device, | |
| 136 // including the set of all available device configurations. May return null | |
| 137 // if the device has been closed. | |
| 138 GetDeviceInfo() => (DeviceInfo? info); | |
| 139 | |
| 140 // Initiates a device control transfer to set the device's configuration to | 154 // Initiates a device control transfer to set the device's configuration to |
| 141 // one with the configuration value |value|. | 155 // one with the configuration value |value|. |
| 142 SetConfiguration(uint8 value) => (bool success); | 156 SetConfiguration(uint8 value) => (bool success); |
| 143 | 157 |
| 144 // Claims a single interface in the current device configuration. | 158 // Claims a single interface in the current device configuration. |
| 145 ClaimInterface(uint8 interface_number) => (bool success); | 159 ClaimInterface(uint8 interface_number) => (bool success); |
| 146 | 160 |
| 147 // Releases a claimed interface in the current device configuration. | 161 // Releases a claimed interface in the current device configuration. |
| 148 ReleaseInterface(uint8 interface_number) => (bool success); | 162 ReleaseInterface(uint8 interface_number) => (bool success); |
| 149 | 163 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 // this transfer. | 262 // this transfer. |
| 249 // | 263 // |
| 250 // |timeout| specifies the request timeout in milliseconds. A timeout of 0 | 264 // |timeout| specifies the request timeout in milliseconds. A timeout of 0 |
| 251 // indicates no timeout: the request will remain pending indefinitely until | 265 // indicates no timeout: the request will remain pending indefinitely until |
| 252 // completed or otherwise terminated. | 266 // completed or otherwise terminated. |
| 253 IsochronousTransferOut(uint8 endpoint_number, | 267 IsochronousTransferOut(uint8 endpoint_number, |
| 254 array<array<uint8>> packets, | 268 array<array<uint8>> packets, |
| 255 uint32 timeout) | 269 uint32 timeout) |
| 256 => (TransferStatus status); | 270 => (TransferStatus status); |
| 257 }; | 271 }; |
| OLD | NEW |