OLD | NEW |
1 <h1>USB Devices</h1> | 1 <h1>USB Devices</h1> |
2 | 2 |
3 <p> | 3 <p> |
4 This document describes how to use the <a href="usb">USB API</a> to communicate | 4 This document describes how to use the <a href="usb">USB API</a> to communicate |
5 with USB devices. Some devices are not accessible through the USB API | 5 with USB devices. Some devices are not accessible through the USB API |
6 (see the <a href="#caveats">Caveats</a> section below for details). | 6 (see the <a href="#caveats">Caveats</a> section below for details). |
7 Chrome Apps can also connect to <a href="serial">serial</a> and | 7 Chrome Apps can also connect to <a href="serial">serial</a> and |
8 <a href="bluetooth">Bluetooth</a> devices. | 8 <a href="bluetooth">Bluetooth</a> devices. |
9 </p> | 9 </p> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 You can use $(ref:usb.getDevices) to enumerate devices by their VID/PID | 42 You can use $(ref:usb.getDevices) to enumerate devices by their VID/PID |
43 pair. | 43 pair. |
44 </p> | 44 </p> |
45 <p> | 45 <p> |
46 You must declare the VID/PID pairs for each type of device you want to use | 46 You must declare the VID/PID pairs for each type of device you want to use |
47 under the "usbDevices" permission in your app's manifest file, as shown in the | 47 under the "usbDevices" permission in your app's manifest file, as shown in the |
48 example below:</p> | 48 example below:</p> |
49 | 49 |
50 <pre data-filename="manifest.json"> | 50 <pre data-filename="manifest.json"> |
51 "permissions": [ | 51 "permissions": [ |
52 "usbDevices": [ | 52 { |
53 { | 53 "usbDevices": [ |
54 "vendorId": 123, | 54 { |
55 "productId": 456 | 55 "vendorId": 123, |
56 } | 56 "productId": 456 |
57 ] | 57 } |
| 58 ] |
| 59 } |
58 ] | 60 ] |
59 </pre> | 61 </pre> |
60 | 62 |
61 <p class="note">Note that only decimal numbers are allowed in JSON format. | 63 <p class="note">Note that only decimal numbers are allowed in JSON format. |
62 You cannot use hexadecimal numbers in these fields.</p> | 64 You cannot use hexadecimal numbers in these fields.</p> |
63 | 65 |
64 <h2 id="finding_device">Finding a device</h2> | 66 <h2 id="finding_device">Finding a device</h2> |
65 | 67 |
66 <p> | 68 <p> |
67 To determine whether one or more specific devices are connected to a user's | 69 To determine whether one or more specific devices are connected to a user's |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 owned by group "plugdev" and have group write permissions. | 667 owned by group "plugdev" and have group write permissions. |
666 </li> | 668 </li> |
667 </ul> | 669 </ul> |
668 | 670 |
669 <p>Your app cannot do this automatically since this this procedure requires root | 671 <p>Your app cannot do this automatically since this this procedure requires root |
670 access. We recommend that you provide instructions to end-users and link to the | 672 access. We recommend that you provide instructions to end-users and link to the |
671 <a href="#caveats">Caveats</a> section on this page for an explanation.</p> | 673 <a href="#caveats">Caveats</a> section on this page for an explanation.</p> |
672 | 674 |
673 <p>On Chrome OS, simply call $(ref:usb.requestAccess). The permission | 675 <p>On Chrome OS, simply call $(ref:usb.requestAccess). The permission |
674 broker does this for you.</p> | 676 broker does this for you.</p> |
OLD | NEW |