| 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 |
| 11 <p class="note"> | 11 <p class="note"> |
| 12 <b>Samples:</b> For examples that illustrate how Chrome Apps can connect to hard
ware devices, see the | 12 <b>Samples:</b> For examples that illustrate how Chrome Apps can connect to hard
ware devices, see the |
| 13 <a href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/serial">
serial</a>, | 13 <a href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/
serial">serial</a>, |
| 14 <a href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/servo">s
ervo</a>, | 14 <a href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/
servo">servo</a>, |
| 15 <a href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/usb">usb
</a>, and | 15 <a href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/
usb">usb</a>, and |
| 16 <a href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/zephyr_h
xm">zephyr_hxm | 16 <a href="https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/
zephyr_hxm">zephyr_hxm |
| 17 Bluetooth</a> samples. | 17 Bluetooth</a> samples. |
| 18 </p> | 18 </p> |
| 19 | 19 |
| 20 <p> | 20 <p> |
| 21 For background information about USB, see the official | 21 For background information about USB, see the official |
| 22 <a href="http://www.usb.org/home">USB specifications</a>. <br/> | 22 <a href="http://www.usb.org/home">USB specifications</a>. <br/> |
| 23 <a href="http://www.beyondlogic.org/usbnutshell/usb1.shtml"> | 23 <a href="http://www.beyondlogic.org/usbnutshell/usb1.shtml"> |
| 24 <i>USB in a NutShell</i></a> | 24 <i>USB in a NutShell</i></a> |
| 25 is a reasonable crash course that you may find helpful. | 25 is a reasonable crash course that you may find helpful. |
| 26 </p> | 26 </p> |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 }; | 632 }; |
| 633 chrome.usb.interruptTransfer(connectionHandle, transferInfo, optionalCallback); | 633 chrome.usb.interruptTransfer(connectionHandle, transferInfo, optionalCallback); |
| 634 </pre> | 634 </pre> |
| 635 | 635 |
| 636 <h2 id="caveats">Caveats</h2> | 636 <h2 id="caveats">Caveats</h2> |
| 637 | 637 |
| 638 <p>Not all devices can be accessed through the USB API. In general, devices | 638 <p>Not all devices can be accessed through the USB API. In general, devices |
| 639 are not accessible because either the Operating System's kernel or a native | 639 are not accessible because either the Operating System's kernel or a native |
| 640 driver holds them off from user space code. Some examples are devices with | 640 driver holds them off from user space code. Some examples are devices with |
| 641 HID profiles on OSX systems, and USB pen drives.</p> | 641 HID profiles on OSX systems, and USB pen drives.</p> |
| 642 | 642 |
| 643 <p> | 643 <p> |
| 644 On most Linux systems, USB devices are mapped with read-only permissions by | 644 On most Linux systems, USB devices are mapped with read-only permissions by |
| 645 default. To open a device through this API, your user will need to have | 645 default. To open a device through this API, your user will need to have |
| 646 write access to it too. | 646 write access to it too. |
| 647 A simple solution is to set a udev rule. Create a file | 647 A simple solution is to set a udev rule. Create a file |
| 648 <code>/etc/udev/rules.d/50-yourdevicename.rules</code> | 648 <code>/etc/udev/rules.d/50-yourdevicename.rules</code> |
| 649 with the following content: | 649 with the following content: |
| 650 </p> | 650 </p> |
| 651 | 651 |
| 652 <pre> | 652 <pre> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 665 owned by group "plugdev" and have group write permissions. | 665 owned by group "plugdev" and have group write permissions. |
| 666 </li> | 666 </li> |
| 667 </ul> | 667 </ul> |
| 668 | 668 |
| 669 <p>Your app cannot do this automatically since this this procedure requires root | 669 <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 | 670 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> | 671 <a href="#caveats">Caveats</a> section on this page for an explanation.</p> |
| 672 | 672 |
| 673 <p>On Chrome OS, simply call $(ref:usb.requestAccess). The permission | 673 <p>On Chrome OS, simply call $(ref:usb.requestAccess). The permission |
| 674 broker does this for you.</p> | 674 broker does this for you.</p> |
| OLD | NEW |