| 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 { | 7 enum OpenDeviceError { |
| 8 // Opening the device succeeded. | 8 // Opening the device succeeded. |
| 9 OK, | 9 OK, |
| 10 | 10 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 uint8 subclass_code; | 92 uint8 subclass_code; |
| 93 uint8 protocol_code; | 93 uint8 protocol_code; |
| 94 uint16 vendor_id; | 94 uint16 vendor_id; |
| 95 uint16 product_id; | 95 uint16 product_id; |
| 96 uint8 device_version_major; | 96 uint8 device_version_major; |
| 97 uint8 device_version_minor; | 97 uint8 device_version_minor; |
| 98 uint8 device_version_subminor; | 98 uint8 device_version_subminor; |
| 99 string? manufacturer_name; | 99 string? manufacturer_name; |
| 100 string? product_name; | 100 string? product_name; |
| 101 string? serial_number; | 101 string? serial_number; |
| 102 uint8 active_configuration; |
| 102 array<ConfigurationInfo> configurations; | 103 array<ConfigurationInfo> configurations; |
| 103 WebUsbDescriptorSet? webusb_allowed_origins; | 104 WebUsbDescriptorSet? webusb_allowed_origins; |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 struct ControlTransferParams { | 107 struct ControlTransferParams { |
| 107 ControlTransferType type; | 108 ControlTransferType type; |
| 108 ControlTransferRecipient recipient; | 109 ControlTransferRecipient recipient; |
| 109 uint8 request; | 110 uint8 request; |
| 110 uint16 value; | 111 uint16 value; |
| 111 uint16 index; | 112 uint16 index; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 uint32 length; | 147 uint32 length; |
| 147 uint32 transferred_length; | 148 uint32 transferred_length; |
| 148 TransferStatus status; | 149 TransferStatus status; |
| 149 }; | 150 }; |
| 150 | 151 |
| 151 interface Device { | 152 interface Device { |
| 152 // Retrieve a DeviceInfo struct containing metadata about the device, | 153 // Retrieve a DeviceInfo struct containing metadata about the device, |
| 153 // including the set of all available device configurations. | 154 // including the set of all available device configurations. |
| 154 GetDeviceInfo() => (DeviceInfo? info); | 155 GetDeviceInfo() => (DeviceInfo? info); |
| 155 | 156 |
| 156 // Retrieves the |configuration_value| of the device's currently active | |
| 157 // configuration. Will return 0 if the device is unconfigured. | |
| 158 GetConfiguration() => (uint8 value); | |
| 159 | |
| 160 // Opens the device. Methods below require the device be opened first. | 157 // Opens the device. Methods below require the device be opened first. |
| 161 Open() => (OpenDeviceError error); | 158 Open() => (OpenDeviceError error); |
| 162 | 159 |
| 163 // Closes the device. | 160 // Closes the device. |
| 164 Close() => (); | 161 Close() => (); |
| 165 | 162 |
| 166 // Initiates a device control transfer to set the device's configuration to | 163 // Initiates a device control transfer to set the device's configuration to |
| 167 // one with the configuration value |value|. | 164 // one with the configuration value |value|. |
| 168 SetConfiguration(uint8 value) => (bool success); | 165 SetConfiguration(uint8 value) => (bool success); |
| 169 | 166 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // indicates no timeout: the request will remain pending indefinitely until | 276 // indicates no timeout: the request will remain pending indefinitely until |
| 280 // completed or otherwise terminated. | 277 // completed or otherwise terminated. |
| 281 | 278 |
| 282 // |packets| contains the status of each packet sent to the device, in order. | 279 // |packets| contains the status of each packet sent to the device, in order. |
| 283 IsochronousTransferOut(uint8 endpoint_number, | 280 IsochronousTransferOut(uint8 endpoint_number, |
| 284 array<uint8> data, | 281 array<uint8> data, |
| 285 array<uint32> packet_lengths, | 282 array<uint32> packet_lengths, |
| 286 uint32 timeout) | 283 uint32 timeout) |
| 287 => (array<IsochronousPacket> packets); | 284 => (array<IsochronousPacket> packets); |
| 288 }; | 285 }; |
| OLD | NEW |