OLD | NEW |
| (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 import "device.mojom"; | |
8 | |
9 enum OpenDeviceError { | |
10 // Opening the device succeeded. | |
11 OK, | |
12 | |
13 // The device could not be opened because the request GUID is unknown. | |
14 NOT_FOUND, | |
15 | |
16 // The operating system denied access to the device. | |
17 ACCESS_DENIED, | |
18 }; | |
19 | |
20 struct DeviceFilter { | |
21 bool has_vendor_id; | |
22 uint16 vendor_id; | |
23 | |
24 bool has_product_id; | |
25 uint16 product_id; | |
26 | |
27 bool has_class_code; | |
28 uint8 class_code; | |
29 | |
30 bool has_subclass_code; | |
31 uint8 subclass_code; | |
32 | |
33 bool has_protocol_code; | |
34 uint8 protocol_code; | |
35 }; | |
36 | |
37 struct EnumerationOptions { | |
38 array<DeviceFilter> filters; | |
39 }; | |
40 | |
41 interface DeviceManager { | |
42 // Retrieves information about all devices available to the DeviceManager | |
43 // implementation. | |
44 GetDevices(EnumerationOptions options) => (array<DeviceInfo> results); | |
45 | |
46 // Attempts to open a device given its GUID. | |
47 OpenDevice(string guid, Device& device_request) => (OpenDeviceError error); | |
48 }; | |
OLD | NEW |