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

Side by Side Diff: device/usb/public/interfaces/device.mojom

Issue 1183443002: Reland: Introduce the devices Mojo app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gn check... Created 5 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 module device.usb;
6
7 enum TransferDirection {
8 IN,
9 OUT,
10 };
11
12 enum ControlTransferType {
13 STANDARD,
14 CLASS,
15 VENDOR,
16 RESERVED
17 };
18
19 enum ControlTransferRecipient {
20 DEVICE,
21 INTERFACE,
22 ENDPOINT,
23 OTHER
24 };
25
26 enum EndpointType {
27 BULK,
28 INTERRUPT,
29 ISOCHRONOUS,
30 };
31
32 struct EndpointInfo {
33 uint8 endpoint_number;
34 TransferDirection direction;
35 EndpointType type;
36 uint32 packet_size;
37 };
38
39 struct AlternateInterfaceInfo {
40 uint8 alternate_setting;
41 uint8 class_code;
42 uint8 subclass_code;
43 uint8 protocol_code;
44 string? interface_name;
45 array<EndpointInfo> endpoints;
46 };
47
48 struct InterfaceInfo {
49 uint8 interface_number;
50 array<AlternateInterfaceInfo> alternates;
51 };
52
53 struct ConfigurationInfo {
54 uint8 configuration_value;
55 string? configuration;
56 array<InterfaceInfo> interfaces;
57 };
58
59 struct DeviceInfo {
60 string guid;
61 uint16 usb_version;
62 uint8 class_code;
63 uint8 subclass_code;
64 uint8 protocol_code;
65 uint16 vendor_id;
66 uint16 product_id;
67 uint16 device_version;
68 string? manufacturer;
69 string? product;
70 string? serial_number;
71 array<ConfigurationInfo> configurations;
72 };
73
74 struct ControlTransferParams {
75 ControlTransferType type;
76 ControlTransferRecipient recipient;
77 uint8 request;
78 uint16 value;
79 uint16 index;
80 };
81
82 enum TransferStatus {
83 // The transfer completed successfully.
84 COMPLETED,
85
86 // The transfer failed due to a non-specific error.
87 ERROR,
88
89 // The transfer timed out.
90 TIMEOUT,
91
92 // The transfer was cancelled.
93 CANCELLED,
94
95 // The transfer stalled.
96 STALLED,
97
98 // The transfer failed because the device was disconnected from the host.
99 DISCONNECT,
100
101 // The transfer succeeded, but the device sent more data than was requested.
102 // This applies only to inbound transfers.
103 BABBLE,
104
105 // The transfer succeeded, but the device sent less data than was requested.
106 // This applies only to inbound transfers.
107 SHORT_PACKET,
108 };
109
110 interface Device {
111 // Closes the device. Calling this effectively invalidates the Device object.
112 Close() => ();
113
114 // Retrieve a DeviceInfo struct containing metadata about the device,
115 // including the set of all available device configurations. May return null
116 // if the device has been closed.
117 GetDeviceInfo() => (DeviceInfo? info);
118
119 // Initiates a device control transfer to set the device's configuration to
120 // one with the configuration value |value|.
121 SetConfiguration(uint8 value) => (bool success);
122
123 // Claims a single interface in the current device configuration.
124 ClaimInterface(uint8 interface_number) => (bool success);
125
126 // Releases a claimed interface in the current device configuration.
127 ReleaseInterface(uint8 interface_number) => (bool success);
128
129 // Selects an alternate setting for a given claimed interface.
130 SetInterfaceAlternateSetting(uint8 interface_number, uint8 alternate_setting)
131 => (bool success);
132
133 // Resets the device.
134 Reset() => (bool success);
135
136 // Initiates an inbound control transfer request. |params| determine the
137 // details of the request. Transfers to recipients other than DEVICE require a
138 // corresponding interface to be claimed.
139 //
140 // |length| specifies the expected number of bytes to receive for this
141 // transfer. The size of |data| will never exceed |length|, and |data| will be
142 // null if |status| is neither COMPLETED, BABBLE, or SHORT_PACKET.
143 //
144 // |timeout| specifies the request timeout in milliseconds. A timeout of 0
145 // indicates no timeout: the request will remain pending indefinitely until
146 // completed or otherwise terminated.
147 ControlTransferIn(ControlTransferParams params, uint32 length, uint32 timeout)
148 => (TransferStatus status, array<uint8>? data);
149
150 // Initiates an inbound control transfer request. |params| determine the
151 // details of the request. Transfers to recipients other than DEVICE require a
152 // corresponding interface to be claimed.
153 //
154 // |data| specifies the bytes to send the device in the body of the request.
155 //
156 // |timeout| specifies the request timeout in milliseconds. A timeout of 0
157 // indicates no timeout: the request will remain pending indefinitely until
158 // completed or otherwise terminated.
159 ControlTransferOut(ControlTransferParams params,
160 array<uint8> data,
161 uint32 timeout)
162 => (TransferStatus status);
163
164 // Initiates an inbound bulk transfer request on a specific endpoint. The
165 // interface to which |endpoint_number| belongs must be claimed, and the
166 // appropriate alternate setting must be set on that interface before
167 // transfers can be initiated on the endpoint. The endpoint must be of type
168 // BULK.
169 //
170 // |length| specifies the expected number of bytes to receive for this
171 // transfer. The size of |data| will never exceed |length|, and |data| will be
172 // null if |status| is neither COMPLETED, BABBLE, or SHORT_PACKET.
173 //
174 // |timeout| specifies the request timeout in milliseconds. A timeout of 0
175 // indicates no timeout: the request will remain pending indefinitely until
176 // completed or otherwise terminated.
177 BulkTransferIn(uint8 endpoint_number, uint32 length, uint32 timeout)
178 => (TransferStatus status, array<uint8>? data);
179
180 // Initiates an outbound bulk transfer request on a specific endpoint. The
181 // interface to which |endpoint_number| belongs must be claimed, and the
182 // appropriate alternate setting must be set on that interface before
183 // transfers can be initiated on the endpoint. The endpoint must be of type
184 // BULK.
185 //
186 // |data| specifies the bytes to send the device in the body of the request.
187 //
188 // |timeout| specifies the request timeout in milliseconds. A timeout of 0
189 // indicates no timeout: the request will remain pending indefinitely until
190 // completed or otherwise terminated.
191 BulkTransferOut(uint8 endpoint_number, array<uint8> data, uint32 timeout)
192 => (TransferStatus status);
193
194 // Initiates an inbound interrupt transfer request on a specific endpoint. The
195 // interface to which |endpoint_number| belongs must be claimed, and the
196 // appropriate alternate setting must be set on that interface before
197 // transfers can be initiated on the endpoint. The endpoint must be of type
198 // INTERRUPT.
199 //
200 // |length| specifies the expected number of bytes to receive for this
201 // transfer. The size of |data| will never exceed |length|, and |data| will be
202 // null if |status| is neither COMPLETED, BABBLE, or SHORT_PACKET.
203 //
204 // |timeout| specifies the request timeout in milliseconds. A timeout of 0
205 // indicates no timeout: the request will remain pending indefinitely until
206 // completed or otherwise terminated.
207 InterruptTransferIn(uint8 endpoint_number, uint32 length, uint32 timeout)
208 => (TransferStatus status, array<uint8>? data);
209
210 // Initiates an outbound interrupt transfer request on a specific endpoint.
211 // The interface to which |endpoint_number| belongs must be claimed, and the
212 // appropriate alternate setting must be set on that interface before
213 // transfers can be initiated on the endpoint. The endpoint must be of type
214 // INTERRUPT.
215 //
216 // |data| specifies the bytes to send the device in the body of the request.
217 //
218 // |timeout| specifies the request timeout in milliseconds. A timeout of 0
219 // indicates no timeout: the request will remain pending indefinitely until
220 // completed or otherwise terminated.
221 InterruptTransferOut(uint8 endpoint_number, array<uint8> data, uint32 timeout)
222 => (TransferStatus status);
223
224 // Initiates an inbound isochronous transfer request on a specific endpoint.
225 // The interface to which |endpoint_number| belongs must be claimed, and the
226 // appropriate alternate setting must be set on that interface before
227 // transfers can be initiated on the endpoint. The endpoint must be of type
228 // ISOCHRONOUS.
229 //
230 // |packet_length| specifies the maximum expected number of bytes to receive
231 // for each packet in this transfer. |num_packets| specifies the maximum total
232 // number of packets to receive.
233 //
234 // |timeout| specifies the request timeout in milliseconds. A timeout of 0
235 // indicates no timeout: the request will remain pending indefinitely until
236 // completed or otherwise terminated.
237 //
238 // |packets| contains the set of packets received from the device, in order.
239 // No received packet's size will exceed |packet_length|, and will be null
240 // if |status| is neither COMPLETED, BABBLE, or SHORT_PACKET.
241 IsochronousTransferIn(uint8 endpoint_number,
242 uint32 num_packets,
243 uint32 packet_length,
244 uint32 timeout)
245 => (TransferStatus status, array<array<uint8>>? packets);
246
247 // Initiates an outbound isochronous transfer request on a specific endpoint.
248 // The interface to which |endpoint_number| belongs must be claimed, and the
249 // appropriate alternate setting must be set on that interface before
250 // transfers can be initiated on the endpoint. The endpoint must be of type
251 // ISOCHRONOUS.
252 //
253 // |packets| specifies the series of data packets to send to the device for
254 // this transfer.
255 //
256 // |timeout| specifies the request timeout in milliseconds. A timeout of 0
257 // indicates no timeout: the request will remain pending indefinitely until
258 // completed or otherwise terminated.
259 IsochronousTransferOut(uint8 endpoint_number,
260 array<array<uint8>> packets,
261 uint32 timeout)
262 => (TransferStatus status);
263 };
OLDNEW
« no previous file with comments | « device/usb/public/interfaces/BUILD.gn ('k') | device/usb/public/interfaces/device_manager.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698