usb 2.0.0-alpha.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/.gitmodules +1 -1
  2. package/CHANGELOG.md +100 -0
  3. package/README.md +573 -0
  4. package/binding.gyp +12 -2
  5. package/dist/index.d.ts +4 -4
  6. package/dist/index.js +14 -8
  7. package/dist/index.js.map +1 -1
  8. package/dist/usb/bindings.d.ts +13 -0
  9. package/dist/usb/bindings.js +2 -1
  10. package/dist/usb/bindings.js.map +1 -1
  11. package/dist/usb/index.js +86 -2
  12. package/dist/usb/index.js.map +1 -1
  13. package/dist/usb/interface.js.map +1 -1
  14. package/dist/webusb/index.d.ts +32 -19
  15. package/dist/webusb/index.js +163 -67
  16. package/dist/webusb/index.js.map +1 -1
  17. package/dist/webusb/webusb-device.d.ts +1 -1
  18. package/dist/webusb/webusb-device.js +27 -15
  19. package/dist/webusb/webusb-device.js.map +1 -1
  20. package/libusb/.private/pre-commit.sh +7 -1
  21. package/libusb/.travis.yml +49 -0
  22. package/libusb/AUTHORS +44 -3
  23. package/libusb/Brewfile +4 -0
  24. package/libusb/ChangeLog +74 -2
  25. package/libusb/README.md +32 -0
  26. package/libusb/TODO +1 -1
  27. package/libusb/Xcode/common.xcconfig +12 -0
  28. package/libusb/Xcode/config.h +25 -0
  29. package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +959 -1
  30. package/libusb/android/README +4 -2
  31. package/libusb/android/config.h +75 -0
  32. package/libusb/appveyor.yml +41 -0
  33. package/libusb/appveyor_cygwin.bat +11 -0
  34. package/libusb/appveyor_minGW.bat +19 -0
  35. package/libusb/autogen.sh +1 -1
  36. package/libusb/bootstrap.sh +3 -16
  37. package/libusb/configure.ac +108 -80
  38. package/libusb/doc/doxygen.cfg.in +1785 -739
  39. package/libusb/examples/Makefile.am +1 -1
  40. package/libusb/examples/dpfp.c +3 -1
  41. package/libusb/examples/dpfp_threaded.c +23 -10
  42. package/libusb/examples/ezusb.c +3 -3
  43. package/libusb/examples/ezusb.h +2 -2
  44. package/libusb/examples/fxload.c +31 -9
  45. package/libusb/examples/hotplugtest.c +35 -7
  46. package/libusb/examples/listdevs.c +3 -1
  47. package/libusb/examples/sam3u_benchmark.c +3 -3
  48. package/libusb/examples/testlibusb.c +277 -0
  49. package/libusb/examples/xusb.c +40 -34
  50. package/libusb/libusb/Makefile.am +49 -23
  51. package/libusb/libusb/core.c +855 -457
  52. package/libusb/libusb/descriptor.c +72 -78
  53. package/libusb/libusb/hotplug.c +122 -76
  54. package/libusb/libusb/hotplug.h +42 -25
  55. package/libusb/libusb/io.c +625 -390
  56. package/libusb/libusb/libusb-1.0.def +12 -0
  57. package/libusb/libusb/libusb.h +218 -150
  58. package/libusb/libusb/libusbi.h +346 -176
  59. package/libusb/libusb/os/darwin_usb.c +604 -319
  60. package/libusb/libusb/os/darwin_usb.h +61 -20
  61. package/libusb/libusb/os/haiku_pollfs.cpp +367 -0
  62. package/libusb/libusb/os/haiku_usb.h +113 -0
  63. package/libusb/libusb/os/haiku_usb_backend.cpp +533 -0
  64. package/libusb/libusb/os/haiku_usb_raw.cpp +267 -0
  65. package/libusb/libusb/os/haiku_usb_raw.h +188 -0
  66. package/libusb/libusb/os/linux_netlink.c +186 -146
  67. package/libusb/libusb/os/linux_udev.c +36 -14
  68. package/libusb/libusb/os/linux_usbfs.c +426 -225
  69. package/libusb/libusb/os/linux_usbfs.h +5 -3
  70. package/libusb/libusb/os/netbsd_usb.c +21 -77
  71. package/libusb/libusb/os/openbsd_usb.c +32 -115
  72. package/libusb/libusb/os/poll_posix.c +38 -5
  73. package/libusb/libusb/os/poll_posix.h +3 -0
  74. package/libusb/libusb/os/poll_windows.c +277 -626
  75. package/libusb/libusb/os/poll_windows.h +11 -44
  76. package/libusb/libusb/os/sunos_usb.c +1695 -0
  77. package/libusb/libusb/os/sunos_usb.h +80 -0
  78. package/libusb/libusb/os/threads_posix.c +24 -26
  79. package/libusb/libusb/os/threads_posix.h +73 -21
  80. package/libusb/libusb/os/threads_windows.c +71 -157
  81. package/libusb/libusb/os/threads_windows.h +68 -44
  82. package/libusb/libusb/os/wince_usb.c +276 -420
  83. package/libusb/libusb/os/wince_usb.h +23 -28
  84. package/libusb/libusb/os/windows_common.h +78 -58
  85. package/libusb/libusb/os/windows_nt_common.c +1010 -0
  86. package/libusb/libusb/os/windows_nt_common.h +110 -0
  87. package/libusb/libusb/os/windows_nt_shared_types.h +147 -0
  88. package/libusb/libusb/os/windows_usbdk.c +830 -0
  89. package/libusb/libusb/os/windows_usbdk.h +103 -0
  90. package/libusb/libusb/os/windows_winusb.c +4391 -0
  91. package/libusb/libusb/os/windows_winusb.h +783 -0
  92. package/libusb/libusb/strerror.c +41 -7
  93. package/libusb/libusb/sync.c +41 -13
  94. package/libusb/libusb/version.h +1 -1
  95. package/libusb/libusb/version_nano.h +1 -1
  96. package/libusb/libusb-1.0.pc.in +1 -1
  97. package/libusb/msvc/appveyor.bat +27 -0
  98. package/libusb/msvc/config.h +5 -4
  99. package/libusb/msvc/ddk_build.cmd +87 -43
  100. package/libusb/msvc/fxload_2010.vcxproj +24 -104
  101. package/libusb/msvc/fxload_2012.vcxproj +24 -107
  102. package/libusb/msvc/fxload_2013.vcxproj +24 -107
  103. package/libusb/msvc/fxload_2015.vcxproj +91 -0
  104. package/libusb/msvc/fxload_2017.vcxproj +114 -0
  105. package/libusb/msvc/fxload_sources +1 -1
  106. package/libusb/msvc/getopt_2010.vcxproj +16 -75
  107. package/libusb/msvc/getopt_2012.vcxproj +16 -79
  108. package/libusb/msvc/getopt_2013.vcxproj +16 -79
  109. package/libusb/msvc/getopt_2015.vcxproj +73 -0
  110. package/libusb/msvc/getopt_2017.vcxproj +98 -0
  111. package/libusb/msvc/getopt_sources +6 -2
  112. package/libusb/msvc/hotplugtest_2010.vcxproj +18 -99
  113. package/libusb/msvc/hotplugtest_2012.vcxproj +18 -102
  114. package/libusb/msvc/hotplugtest_2013.vcxproj +18 -102
  115. package/libusb/msvc/hotplugtest_2015.vcxproj +83 -0
  116. package/libusb/msvc/hotplugtest_2017.vcxproj +106 -0
  117. package/libusb/msvc/hotplugtest_sources +1 -1
  118. package/libusb/msvc/libusb_2005.sln +20 -20
  119. package/libusb/msvc/libusb_2010.sln +57 -46
  120. package/libusb/msvc/libusb_2012.sln +57 -46
  121. package/libusb/msvc/libusb_2013.sln +57 -50
  122. package/libusb/msvc/libusb_2015.sln +59 -52
  123. package/libusb/msvc/libusb_2017.sln +186 -0
  124. package/libusb/msvc/libusb_dll.dsp +2 -2
  125. package/libusb/msvc/libusb_dll_2005.vcproj +30 -2
  126. package/libusb/msvc/libusb_dll_2010.vcxproj +26 -90
  127. package/libusb/msvc/libusb_dll_2012.vcxproj +28 -96
  128. package/libusb/msvc/libusb_dll_2013.vcxproj +28 -96
  129. package/libusb/msvc/libusb_dll_2015.vcxproj +107 -0
  130. package/libusb/msvc/libusb_dll_2017.vcxproj +134 -0
  131. package/libusb/msvc/libusb_dll_wince.vcproj +9 -1
  132. package/libusb/msvc/libusb_sources +10 -5
  133. package/libusb/msvc/libusb_static.dsp +2 -2
  134. package/libusb/msvc/libusb_static_2005.vcproj +32 -4
  135. package/libusb/msvc/libusb_static_2010.vcxproj +24 -83
  136. package/libusb/msvc/libusb_static_2012.vcxproj +25 -87
  137. package/libusb/msvc/libusb_static_2013.vcxproj +25 -87
  138. package/libusb/msvc/libusb_static_2015.vcxproj +98 -0
  139. package/libusb/msvc/libusb_static_2017.vcxproj +117 -0
  140. package/libusb/msvc/libusb_static_wince.vcproj +20 -26
  141. package/libusb/msvc/libusb_wince.sln +88 -88
  142. package/libusb/msvc/listdevs_2010.vcxproj +16 -99
  143. package/libusb/msvc/listdevs_2012.vcxproj +16 -102
  144. package/libusb/msvc/listdevs_2013.vcxproj +16 -102
  145. package/libusb/msvc/listdevs_2015.vcxproj +83 -0
  146. package/libusb/msvc/listdevs_2017.vcxproj +106 -0
  147. package/libusb/msvc/listdevs_sources +2 -1
  148. package/libusb/msvc/stress_2010.vcxproj +20 -101
  149. package/libusb/msvc/stress_2012.vcxproj +20 -104
  150. package/libusb/msvc/stress_2013.vcxproj +20 -104
  151. package/libusb/msvc/stress_2015.vcxproj +87 -0
  152. package/libusb/msvc/stress_2017.vcxproj +110 -0
  153. package/libusb/msvc/stress_sources +21 -0
  154. package/libusb/msvc/testlibusb_2010.vcxproj +82 -0
  155. package/libusb/msvc/testlibusb_2012.vcxproj +83 -0
  156. package/libusb/msvc/testlibusb_2013.vcxproj +83 -0
  157. package/libusb/msvc/testlibusb_2015.vcxproj +83 -0
  158. package/libusb/msvc/testlibusb_2017.vcxproj +106 -0
  159. package/libusb/msvc/testlibusb_sources +20 -0
  160. package/libusb/msvc/xusb_2010.vcxproj +17 -98
  161. package/libusb/msvc/xusb_2012.vcxproj +17 -101
  162. package/libusb/msvc/xusb_2013.vcxproj +17 -101
  163. package/libusb/msvc/xusb_2015.vcxproj +83 -0
  164. package/libusb/msvc/xusb_2017.vcxproj +106 -0
  165. package/libusb/msvc/xusb_sources +1 -1
  166. package/libusb/tests/stress.c +2 -2
  167. package/libusb/tests/testlib.c +0 -4
  168. package/libusb/travis-autogen.sh +39 -0
  169. package/libusb.gypi +21 -2
  170. package/package.json +18 -13
  171. package/prebuilds/android-arm/node.napi.node +0 -0
  172. package/prebuilds/android-arm64/node.napi.node +0 -0
  173. package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
  174. package/prebuilds/linux-arm/node.napi.node +0 -0
  175. package/prebuilds/linux-arm64/node.napi.node +0 -0
  176. package/prebuilds/linux-ia32/node.napi.node +0 -0
  177. package/prebuilds/linux-x64/node.napi.node +0 -0
  178. package/prebuilds/win32-ia32/node.napi.node +0 -0
  179. package/prebuilds/win32-x64/node.napi.node +0 -0
  180. package/src/device.cc +7 -7
  181. package/src/node_usb.cc +43 -1
  182. package/src/node_usb.h +1 -0
  183. package/src/uv_async_queue.h +33 -25
  184. package/test/usb.coffee +6 -0
  185. package/tsc/index.ts +13 -7
  186. package/tsc/usb/bindings.ts +19 -1
  187. package/tsc/usb/index.ts +67 -19
  188. package/tsc/usb/interface.ts +2 -2
  189. package/tsc/webusb/index.ts +197 -74
  190. package/tsc/webusb/webusb-device.ts +30 -17
  191. package/.github/workflows/prebuild.yml +0 -48
  192. package/Readme.md +0 -339
  193. package/dist/webusb/typed-event-target.d.ts +0 -11
  194. package/dist/webusb/typed-event-target.js +0 -21
  195. package/dist/webusb/typed-event-target.js.map +0 -1
  196. package/docs/assets/css/main.css +0 -2660
  197. package/docs/assets/images/icons.png +0 -0
  198. package/docs/assets/images/icons@2x.png +0 -0
  199. package/docs/assets/images/widgets.png +0 -0
  200. package/docs/assets/images/widgets@2x.png +0 -0
  201. package/docs/assets/js/main.js +0 -248
  202. package/docs/assets/js/search.js +0 -1
  203. package/docs/classes/usb_bindings.device.html +0 -1338
  204. package/docs/classes/usb_bindings.libusbexception.html +0 -234
  205. package/docs/classes/usb_bindings.transfer.html +0 -344
  206. package/docs/classes/usb_capability.capability.html +0 -297
  207. package/docs/classes/usb_device.extendeddevice.html +0 -766
  208. package/docs/classes/usb_endpoint.endpoint.html +0 -472
  209. package/docs/classes/usb_endpoint.inendpoint.html +0 -766
  210. package/docs/classes/usb_endpoint.outendpoint.html +0 -582
  211. package/docs/classes/usb_interface.interface.html +0 -648
  212. package/docs/classes/webusb.webusb-1.html +0 -615
  213. package/docs/classes/webusb_mutex.mutex.html +0 -270
  214. package/docs/classes/webusb_typed_event_target.typedeventtarget.html +0 -443
  215. package/docs/classes/webusb_webusb_device.webusbdevice.html +0 -904
  216. package/docs/index.html +0 -500
  217. package/docs/interfaces/usb.deviceevents.html +0 -242
  218. package/docs/interfaces/usb_descriptors.bosdescriptor.html +0 -293
  219. package/docs/interfaces/usb_descriptors.capabilitydescriptor.html +0 -274
  220. package/docs/interfaces/usb_descriptors.configdescriptor.html +0 -388
  221. package/docs/interfaces/usb_descriptors.devicedescriptor.html +0 -464
  222. package/docs/interfaces/usb_descriptors.endpointdescriptor.html +0 -370
  223. package/docs/interfaces/usb_descriptors.interfacedescriptor.html +0 -407
  224. package/docs/interfaces/webusb.usboptions.html +0 -226
  225. package/docs/modules/index.html +0 -304
  226. package/docs/modules/usb.html +0 -173
  227. package/docs/modules/usb_bindings.html +0 -2248
  228. package/docs/modules/usb_capability.html +0 -156
  229. package/docs/modules/usb_descriptors.html +0 -176
  230. package/docs/modules/usb_device.html +0 -156
  231. package/docs/modules/usb_endpoint.html +0 -164
  232. package/docs/modules/usb_interface.html +0 -156
  233. package/docs/modules/webusb.html +0 -165
  234. package/docs/modules/webusb_mutex.html +0 -156
  235. package/docs/modules/webusb_typed_event_target.html +0 -156
  236. package/docs/modules/webusb_webusb_device.html +0 -156
  237. package/docs/modules.html +0 -156
  238. package/libusb/INSTALL +0 -234
  239. package/libusb/README +0 -28
  240. package/libusb/libusb/os/windows_usb.c +0 -5347
  241. package/libusb/libusb/os/windows_usb.h +0 -971
  242. package/libusb/msvc/fxload_2010.vcxproj.filters +0 -25
  243. package/libusb/msvc/fxload_2012.vcxproj.filters +0 -25
  244. package/libusb/msvc/getopt_2010.vcxproj.filters +0 -26
  245. package/libusb/msvc/getopt_2012.vcxproj.filters +0 -26
  246. package/libusb/msvc/hotplugtest_2010.vcxproj.filters +0 -14
  247. package/libusb/msvc/hotplugtest_2012.vcxproj.filters +0 -14
  248. package/libusb/msvc/libusb_dll_2010.vcxproj.filters +0 -81
  249. package/libusb/msvc/libusb_dll_2012.vcxproj.filters +0 -84
  250. package/libusb/msvc/libusb_static_2010.vcxproj.filters +0 -74
  251. package/libusb/msvc/libusb_static_2012.vcxproj.filters +0 -74
  252. package/libusb/msvc/listdevs_2010.vcxproj.filters +0 -14
  253. package/libusb/msvc/listdevs_2012.vcxproj.filters +0 -14
  254. package/libusb/msvc/stress_2010.vcxproj.filters +0 -25
  255. package/libusb/msvc/stress_2012.vcxproj.filters +0 -25
  256. package/libusb/msvc/xusb_2010.vcxproj.filters +0 -14
  257. package/libusb/msvc/xusb_2012.vcxproj.filters +0 -14
  258. package/tsc/webusb/typed-event-target.ts +0 -23
package/docs/index.html DELETED
@@ -1,500 +0,0 @@
1
- <!doctype html>
2
- <html class="default no-js">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
- <title>Node USB</title>
7
- <meta name="description" content="Documentation for Node USB">
8
- <meta name="viewport" content="width=device-width, initial-scale=1">
9
- <link rel="stylesheet" href="assets/css/main.css">
10
- <script async src="assets/js/search.js" id="search-script"></script>
11
- </head>
12
- <body>
13
- <header>
14
- <div class="tsd-page-toolbar">
15
- <div class="container">
16
- <div class="table-wrap">
17
- <div class="table-cell" id="tsd-search" data-index="assets/js/search.json" data-base=".">
18
- <div class="field">
19
- <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
20
- <input id="tsd-search-field" type="text" />
21
- </div>
22
- <ul class="results">
23
- <li class="state loading">Preparing search index...</li>
24
- <li class="state failure">The search index is not available</li>
25
- </ul>
26
- <a href="index.html" class="title">Node USB</a>
27
- </div>
28
- <div class="table-cell" id="tsd-widgets">
29
- <div id="tsd-filter">
30
- <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
31
- <div class="tsd-filter-group">
32
- <div class="tsd-select" id="tsd-filter-visibility">
33
- <span class="tsd-select-label">All</span>
34
- <ul class="tsd-select-list">
35
- <li data-value="public">Public</li>
36
- <li data-value="protected">Public/Protected</li>
37
- <li data-value="private" class="selected">All</li>
38
- </ul>
39
- </div>
40
- <input type="checkbox" id="tsd-filter-inherited" checked />
41
- <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
42
- </div>
43
- </div>
44
- <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
45
- </div>
46
- </div>
47
- </div>
48
- </div>
49
- <div class="tsd-page-title">
50
- <div class="container">
51
- <h1>Node USB</h1>
52
- </div>
53
- </div>
54
- </header>
55
- <div class="container container-main">
56
- <div class="row">
57
- <div class="col-8 col-content">
58
- <div class="tsd-panel tsd-typography">
59
- <a href="#usb-library-for-nodejs" id="usb-library-for-nodejs" style="color: inherit; text-decoration: none;">
60
- <h1>USB Library for Node.JS</h1>
61
- </a>
62
- <p><a href="https://github.com/tessel/node-usb/actions"><img src="https://github.com/tessel/node-usb/workflows/prebuild/badge.svg" alt="Build Status"></a></p>
63
- <p>Node.JS library for communicating with USB devices in JavaScript / CoffeeScript.</p>
64
- <p>This is a refactoring / rewrite of Christopher Klein&#39;s <a href="https://github.com/schakko/node-usb">node-usb</a>. The API is not compatible (hopefully you find it an improvement).</p>
65
- <p>It&#39;s based entirely on libusb&#39;s asynchronous API for better efficiency, and provides a stream API for continuously streaming data or events.</p>
66
- <a href="#installation" id="installation" style="color: inherit; text-decoration: none;">
67
- <h1>Installation</h1>
68
- </a>
69
- <p>Libusb is included as a submodule. On Linux, you&#39;ll need libudev to build libusb. On Ubuntu/Debian: <code>sudo apt-get install build-essential libudev-dev</code></p>
70
- <p>Then, just run</p>
71
- <pre><code><span style="color: #001080">npm</span><span style="color: #000000"> </span><span style="color: #001080">install</span><span style="color: #000000"> </span><span style="color: #001080">usb</span>
72
- </code></pre>
73
- <p>to install from npm. See the bottom of this page for instructions for building from a git checkout.</p>
74
- <a href="#windows" id="windows" style="color: inherit; text-decoration: none;">
75
- <h3>Windows</h3>
76
- </a>
77
- <p>Use <a href="http://zadig.akeo.ie/">Zadig</a> to install the WinUSB driver for your USB device. Otherwise you will get <code>LIBUSB_ERROR_NOT_SUPPORTED</code> when attempting to open devices.</p>
78
- <a href="#api" id="api" style="color: inherit; text-decoration: none;">
79
- <h1>API</h1>
80
- </a>
81
- <pre><code><span style="color: #0000FF">var</span><span style="color: #000000"> </span><span style="color: #001080">usb</span><span style="color: #000000"> = </span><span style="color: #795E26">require</span><span style="color: #000000">(</span><span style="color: #A31515">&#039;usb&#039;</span><span style="color: #000000">)</span>
82
- </code></pre>
83
- <a href="#usb" id="usb" style="color: inherit; text-decoration: none;">
84
- <h2>usb</h2>
85
- </a>
86
- <p>Top-level object.</p>
87
- <a href="#usbgetdevicelist" id="usbgetdevicelist" style="color: inherit; text-decoration: none;">
88
- <h3>usb.getDeviceList()</h3>
89
- </a>
90
- <p>Return a list of <code>Device</code> objects for the USB devices attached to the system.</p>
91
- <a href="#usbfindbyidsvid-pid" id="usbfindbyidsvid-pid" style="color: inherit; text-decoration: none;">
92
- <h3>usb.findByIds(vid, pid)</h3>
93
- </a>
94
- <p>Convenience method to get the first device with the specified VID and PID, or <code>undefined</code> if no such device is present.</p>
95
- <a href="#usblibusb_" id="usblibusb_" style="color: inherit; text-decoration: none;">
96
- <h3>usb.LIBUSB_*</h3>
97
- </a>
98
- <p>Constant properties from libusb</p>
99
- <a href="#usbsetdebuglevellevel--int" id="usbsetdebuglevellevel--int" style="color: inherit; text-decoration: none;">
100
- <h3>usb.setDebugLevel(level : int)</h3>
101
- </a>
102
- <p>Set the libusb debug level (between 0 and 4)</p>
103
- <a href="#device" id="device" style="color: inherit; text-decoration: none;">
104
- <h2>Device</h2>
105
- </a>
106
- <p>Represents a USB device.</p>
107
- <a href="#busnumber" id="busnumber" style="color: inherit; text-decoration: none;">
108
- <h3>.busNumber</h3>
109
- </a>
110
- <p>Integer USB device number</p>
111
- <a href="#deviceaddress" id="deviceaddress" style="color: inherit; text-decoration: none;">
112
- <h3>.deviceAddress</h3>
113
- </a>
114
- <p>Integer USB device address</p>
115
- <a href="#portnumbers" id="portnumbers" style="color: inherit; text-decoration: none;">
116
- <h3>.portNumbers</h3>
117
- </a>
118
- <p>Array containing the USB device port numbers, or <code>undefined</code> if not supported on this platform.</p>
119
- <a href="#devicedescriptor" id="devicedescriptor" style="color: inherit; text-decoration: none;">
120
- <h3>.deviceDescriptor</h3>
121
- </a>
122
- <p>Object with properties for the fields of the device descriptor:</p>
123
- <ul>
124
- <li>bLength</li>
125
- <li>bDescriptorType</li>
126
- <li>bcdUSB</li>
127
- <li>bDeviceClass</li>
128
- <li>bDeviceSubClass</li>
129
- <li>bDeviceProtocol</li>
130
- <li>bMaxPacketSize0</li>
131
- <li>idVendor</li>
132
- <li>idProduct</li>
133
- <li>bcdDevice</li>
134
- <li>iManufacturer</li>
135
- <li>iProduct</li>
136
- <li>iSerialNumber</li>
137
- <li>bNumConfigurations</li>
138
- </ul>
139
- <a href="#configdescriptor" id="configdescriptor" style="color: inherit; text-decoration: none;">
140
- <h3>.configDescriptor</h3>
141
- </a>
142
- <p>Object with properties for the fields of the configuration descriptor:</p>
143
- <ul>
144
- <li>bLength</li>
145
- <li>bDescriptorType</li>
146
- <li>wTotalLength</li>
147
- <li>bNumInterfaces</li>
148
- <li>bConfigurationValue</li>
149
- <li>iConfiguration</li>
150
- <li>bmAttributes</li>
151
- <li>bMaxPower</li>
152
- <li>extra (Buffer containing any extra data or additional descriptors)</li>
153
- </ul>
154
- <a href="#allconfigdescriptors" id="allconfigdescriptors" style="color: inherit; text-decoration: none;">
155
- <h3>.allConfigDescriptors</h3>
156
- </a>
157
- <pre><code><span style="color: #001080">Contains</span><span style="color: #000000"> </span><span style="color: #001080">all</span><span style="color: #000000"> </span><span style="color: #001080">config</span><span style="color: #000000"> </span><span style="color: #001080">descriptors</span><span style="color: #000000"> </span><span style="color: #0000FF">of</span><span style="color: #000000"> </span><span style="color: #001080">the</span><span style="color: #000000"> </span><span style="color: #795E26">device</span><span style="color: #000000"> (</span><span style="color: #001080">same</span><span style="color: #000000"> </span><span style="color: #001080">structure</span><span style="color: #000000"> </span><span style="color: #AF00DB">as</span><span style="color: #000000"> .</span><span style="color: #267F99">configDescriptor</span><span style="color: #000000"> </span><span style="color: #267F99">above</span><span style="color: #000000">)</span>
158
- </code></pre>
159
- <a href="#parent" id="parent" style="color: inherit; text-decoration: none;">
160
- <h3>.parent</h3>
161
- </a>
162
- <pre><code><span style="color: #001080">Contains</span><span style="color: #000000"> </span><span style="color: #001080">the</span><span style="color: #000000"> </span><span style="color: #001080">parent</span><span style="color: #000000"> </span><span style="color: #0000FF">of</span><span style="color: #000000"> </span><span style="color: #001080">the</span><span style="color: #000000"> </span><span style="color: #001080">device</span><span style="color: #000000">, </span><span style="color: #001080">such</span><span style="color: #000000"> </span><span style="color: #AF00DB">as</span><span style="color: #000000"> </span><span style="color: #267F99">a</span><span style="color: #000000"> </span><span style="color: #267F99">hub</span><span style="color: #000000">. </span><span style="color: #267F99">If</span><span style="color: #000000"> </span><span style="color: #267F99">there</span><span style="color: #000000"> </span><span style="color: #267F99">is</span><span style="color: #000000"> </span><span style="color: #267F99">no</span><span style="color: #000000"> </span><span style="color: #267F99">parent</span><span style="color: #000000"> </span><span style="color: #267F99">this</span><span style="color: #000000"> </span><span style="color: #267F99">property</span><span style="color: #000000"> </span><span style="color: #267F99">is</span><span style="color: #000000"> </span><span style="color: #267F99">set</span><span style="color: #000000"> </span><span style="color: #267F99">to</span><span style="color: #000000"> </span><span style="color: #A31515">`null`</span><span style="color: #000000">.</span>
163
- </code></pre>
164
- <a href="#open" id="open" style="color: inherit; text-decoration: none;">
165
- <h3>.open()</h3>
166
- </a>
167
- <p>Open the device. All methods below require the device to be open before use.</p>
168
- <a href="#close" id="close" style="color: inherit; text-decoration: none;">
169
- <h3>.close()</h3>
170
- </a>
171
- <p>Close the device.</p>
172
- <a href="#controltransferbmrequesttype-brequest-wvalue-windex-data_or_length-callbackerror-data" id="controltransferbmrequesttype-brequest-wvalue-windex-data_or_length-callbackerror-data" style="color: inherit; text-decoration: none;">
173
- <h3>.controlTransfer(bmRequestType, bRequest, wValue, wIndex, data_or_length, callback(error, data))</h3>
174
- </a>
175
- <p>Perform a control transfer with <code>libusb_control_transfer</code>.</p>
176
- <p>Parameter <code>data_or_length</code> can be a integer length for an IN transfer, or a Buffer for an out transfer. The type must match the direction specified in the MSB of bmRequestType.</p>
177
- <p>The <code>data</code> parameter of the callback is always undefined for OUT transfers, or will be passed a Buffer for IN transfers.</p>
178
- <p>A <a href="https://www.npmjs.com/package/bmrequesttype">package is available to calculate bmRequestType</a> if needed.</p>
179
- <a href="#setconfigurationid-callbackerror" id="setconfigurationid-callbackerror" style="color: inherit; text-decoration: none;">
180
- <h3>.setConfiguration(id, callback(error))</h3>
181
- </a>
182
- <p>Set the device configuration to something other than the default (0). To use this, first call <code>.open(false)</code> (which tells it not to auto configure), then before claiming an interface, call this method.</p>
183
- <a href="#getstringdescriptorindex-callbackerror-data" id="getstringdescriptorindex-callbackerror-data" style="color: inherit; text-decoration: none;">
184
- <h3>.getStringDescriptor(index, callback(error, data))</h3>
185
- </a>
186
- <p>Perform a control transfer to retrieve a string descriptor</p>
187
- <a href="#getbosdescriptorcallbackerror-bosdescriptor" id="getbosdescriptorcallbackerror-bosdescriptor" style="color: inherit; text-decoration: none;">
188
- <h3>.getBosDescriptor(callback(error, bosDescriptor))</h3>
189
- </a>
190
- <p>Perform a control transfer to retrieve an object with properties for the fields of the Binary Object Store descriptor:</p>
191
- <ul>
192
- <li>bLength</li>
193
- <li>bDescriptorType</li>
194
- <li>wTotalLength</li>
195
- <li>bNumDeviceCaps</li>
196
- </ul>
197
- <a href="#getcapabilitiescallbackerror-capabilities" id="getcapabilitiescallbackerror-capabilities" style="color: inherit; text-decoration: none;">
198
- <h3>.getCapabilities(callback(error, capabilities))</h3>
199
- </a>
200
- <p>Retrieve a list of Capability objects for the Binary Object Store capabilities of the device.</p>
201
- <a href="#interfaceinterface" id="interfaceinterface" style="color: inherit; text-decoration: none;">
202
- <h3>.interface(interface)</h3>
203
- </a>
204
- <p>Return the interface with the specified interface number.</p>
205
- <a href="#interfaces" id="interfaces" style="color: inherit; text-decoration: none;">
206
- <h3>.interfaces</h3>
207
- </a>
208
- <p>List of Interface objects for the interfaces of the default configuration of the device.</p>
209
- <a href="#timeout" id="timeout" style="color: inherit; text-decoration: none;">
210
- <h3>.timeout</h3>
211
- </a>
212
- <p>Timeout in milliseconds to use for control transfers.</p>
213
- <a href="#resetcallbackerror" id="resetcallbackerror" style="color: inherit; text-decoration: none;">
214
- <h3>.reset(callback(error))</h3>
215
- </a>
216
- <p>Performs a reset of the device. Callback is called when complete.</p>
217
- <a href="#interface" id="interface" style="color: inherit; text-decoration: none;">
218
- <h2>Interface</h2>
219
- </a>
220
- <a href="#endpointaddress" id="endpointaddress" style="color: inherit; text-decoration: none;">
221
- <h3>.endpoint(address)</h3>
222
- </a>
223
- <p>Return the InEndpoint or OutEndpoint with the specified address.</p>
224
- <a href="#endpoints" id="endpoints" style="color: inherit; text-decoration: none;">
225
- <h3>.endpoints</h3>
226
- </a>
227
- <p>List of endpoints on this interface: InEndpoint and OutEndpoint objects.</p>
228
- <a href="#interface-1" id="interface-1" style="color: inherit; text-decoration: none;">
229
- <h3>.interface</h3>
230
- </a>
231
- <p>Integer interface number.</p>
232
- <a href="#altsetting" id="altsetting" style="color: inherit; text-decoration: none;">
233
- <h3>.altSetting</h3>
234
- </a>
235
- <p>Integer alternate setting number.</p>
236
- <a href="#setaltsettingaltsetting-callbackerror" id="setaltsettingaltsetting-callbackerror" style="color: inherit; text-decoration: none;">
237
- <h3>.setAltSetting(altSetting, callback(error))</h3>
238
- </a>
239
- <p>Sets the alternate setting. It updates the <code>interface.endpoints</code> array to reflect the endpoints found in the alternate setting.</p>
240
- <a href="#claim" id="claim" style="color: inherit; text-decoration: none;">
241
- <h3>.claim()</h3>
242
- </a>
243
- <p>Claims the interface. This method must be called before using any endpoints of this interface.</p>
244
- <a href="#releasecloseendpoints-callbackerror" id="releasecloseendpoints-callbackerror" style="color: inherit; text-decoration: none;">
245
- <h3>.release([closeEndpoints], callback(error))</h3>
246
- </a>
247
- <p>Releases the interface and resets the alternate setting. Calls callback when complete.</p>
248
- <p>It is an error to release an interface with pending transfers. If the optional closeEndpoints parameter is true, any active endpoint streams are stopped (see <code>Endpoint.stopStream</code>), and the interface is released after the stream transfers are cancelled. Transfers submitted individually with <code>Endpoint.transfer</code> are not affected by this parameter.</p>
249
- <a href="#iskerneldriveractive" id="iskerneldriveractive" style="color: inherit; text-decoration: none;">
250
- <h3>.isKernelDriverActive()</h3>
251
- </a>
252
- <p>Returns <code>false</code> if a kernel driver is not active; <code>true</code> if active.</p>
253
- <a href="#detachkerneldriver" id="detachkerneldriver" style="color: inherit; text-decoration: none;">
254
- <h3>.detachKernelDriver()</h3>
255
- </a>
256
- <p>Detaches the kernel driver from the interface.</p>
257
- <a href="#attachkerneldriver" id="attachkerneldriver" style="color: inherit; text-decoration: none;">
258
- <h3>.attachKernelDriver()</h3>
259
- </a>
260
- <p>Re-attaches the kernel driver for the interface.</p>
261
- <a href="#descriptor" id="descriptor" style="color: inherit; text-decoration: none;">
262
- <h3>.descriptor</h3>
263
- </a>
264
- <p>Object with fields from the interface descriptor -- see libusb documentation or USB spec.</p>
265
- <ul>
266
- <li>bLength</li>
267
- <li>bDescriptorType</li>
268
- <li>bInterfaceNumber</li>
269
- <li>bAlternateSetting</li>
270
- <li>bNumEndpoints</li>
271
- <li>bInterfaceClass</li>
272
- <li>bInterfaceSubClass</li>
273
- <li>bInterfaceProtocol</li>
274
- <li>iInterface</li>
275
- <li>extra (Buffer containing any extra data or additional descriptors)</li>
276
- </ul>
277
- <a href="#capability" id="capability" style="color: inherit; text-decoration: none;">
278
- <h2>Capability</h2>
279
- </a>
280
- <a href="#type" id="type" style="color: inherit; text-decoration: none;">
281
- <h3>.type</h3>
282
- </a>
283
- <p>Integer capability type.</p>
284
- <a href="#data" id="data" style="color: inherit; text-decoration: none;">
285
- <h3>.data</h3>
286
- </a>
287
- <p>Buffer capability data.</p>
288
- <a href="#descriptor-1" id="descriptor-1" style="color: inherit; text-decoration: none;">
289
- <h3>.descriptor</h3>
290
- </a>
291
- <p>Object with fields from the capability descriptor -- see libusb documentation or USB spec.</p>
292
- <ul>
293
- <li>bLength</li>
294
- <li>bDescriptorType</li>
295
- <li>bDevCapabilityType</li>
296
- </ul>
297
- <a href="#endpoint" id="endpoint" style="color: inherit; text-decoration: none;">
298
- <h2>Endpoint</h2>
299
- </a>
300
- <p>Common base for InEndpoint and OutEndpoint, see below.</p>
301
- <a href="#direction" id="direction" style="color: inherit; text-decoration: none;">
302
- <h3>.direction</h3>
303
- </a>
304
- <p>Endpoint direction: <code>&quot;in&quot;</code> or <code>&quot;out&quot;</code>.</p>
305
- <a href="#transfertype" id="transfertype" style="color: inherit; text-decoration: none;">
306
- <h3>.transferType</h3>
307
- </a>
308
- <p>Endpoint type: <code>usb.LIBUSB_TRANSFER_TYPE_BULK</code>, <code>usb.LIBUSB_TRANSFER_TYPE_INTERRUPT</code>, or <code>usb.LIBUSB_TRANSFER_TYPE_ISOCHRONOUS</code>.</p>
309
- <a href="#descriptor-2" id="descriptor-2" style="color: inherit; text-decoration: none;">
310
- <h3>.descriptor</h3>
311
- </a>
312
- <p>Object with fields from the endpoint descriptor -- see libusb documentation or USB spec.</p>
313
- <ul>
314
- <li>bLength</li>
315
- <li>bDescriptorType</li>
316
- <li>bEndpointAddress</li>
317
- <li>bmAttributes</li>
318
- <li>wMaxPacketSize</li>
319
- <li>bInterval</li>
320
- <li>bRefresh</li>
321
- <li>bSynchAddress</li>
322
- <li>extra (Buffer containing any extra data or additional descriptors)</li>
323
- </ul>
324
- <a href="#timeout-1" id="timeout-1" style="color: inherit; text-decoration: none;">
325
- <h3>.timeout</h3>
326
- </a>
327
- <p>Sets the timeout in milliseconds for transfers on this endpoint. The default, <code>0</code>, is infinite timeout.</p>
328
- <a href="#clearhaltcallbackerror" id="clearhaltcallbackerror" style="color: inherit; text-decoration: none;">
329
- <h3>.clearHalt(callback(error))</h3>
330
- </a>
331
- <p>Clear the halt/stall condition for this endpoint.</p>
332
- <a href="#inendpoint" id="inendpoint" style="color: inherit; text-decoration: none;">
333
- <h2>InEndpoint</h2>
334
- </a>
335
- <p>Endpoints in the IN direction (device-&gt;PC) have this type.</p>
336
- <a href="#transferlength-callbackerror-data" id="transferlength-callbackerror-data" style="color: inherit; text-decoration: none;">
337
- <h3>.transfer(length, callback(error, data))</h3>
338
- </a>
339
- <p>Perform a transfer to read data from the endpoint.</p>
340
- <p>If length is greater than maxPacketSize, libusb will automatically split the transfer in multiple packets, and you will receive one callback with all data once all packets are complete.</p>
341
- <p><code>this</code> in the callback is the InEndpoint object.</p>
342
- <a href="#startpollntransfers3-transfersizemaxpacketsize" id="startpollntransfers3-transfersizemaxpacketsize" style="color: inherit; text-decoration: none;">
343
- <h3>.startPoll(nTransfers=3, transferSize=maxPacketSize)</h3>
344
- </a>
345
- <p>Start polling the endpoint.</p>
346
- <p>The library will keep <code>nTransfers</code> transfers of size <code>transferSize</code> pending in
347
- the kernel at all times to ensure continuous data flow. This is handled by the
348
- libusb event thread, so it continues even if the Node v8 thread is busy. The
349
- <code>data</code> and <code>error</code> events are emitted as transfers complete.</p>
350
- <a href="#stoppollcb" id="stoppollcb" style="color: inherit; text-decoration: none;">
351
- <h3>.stopPoll(cb)</h3>
352
- </a>
353
- <p>Stop polling.</p>
354
- <p>Further data may still be received. The <code>end</code> event is emitted and the callback
355
- is called once all transfers have completed or canceled.</p>
356
- <a href="#event-datadata--buffer" id="event-datadata--buffer" style="color: inherit; text-decoration: none;">
357
- <h3>Event: data(data : Buffer)</h3>
358
- </a>
359
- <p>Emitted with data received by the polling transfers</p>
360
- <a href="#event-errorerror" id="event-errorerror" style="color: inherit; text-decoration: none;">
361
- <h3>Event: error(error)</h3>
362
- </a>
363
- <p>Emitted when polling encounters an error. All in flight transfers will be automatically canceled and no further polling will be done. You have to wait for the <code>end</code> event before you can start polling again.</p>
364
- <a href="#event-end" id="event-end" style="color: inherit; text-decoration: none;">
365
- <h3>Event: end</h3>
366
- </a>
367
- <p>Emitted when polling has been canceled</p>
368
- <a href="#outendpoint" id="outendpoint" style="color: inherit; text-decoration: none;">
369
- <h2>OutEndpoint</h2>
370
- </a>
371
- <p>Endpoints in the OUT direction (PC-&gt;device) have this type.</p>
372
- <a href="#transferdata-callbackerror" id="transferdata-callbackerror" style="color: inherit; text-decoration: none;">
373
- <h3>.transfer(data, callback(error))</h3>
374
- </a>
375
- <p>Perform a transfer to write <code>data</code> to the endpoint.</p>
376
- <p>If length is greater than maxPacketSize, libusb will automatically split the transfer in multiple packets, and you will receive one callback once all packets are complete.</p>
377
- <p><code>this</code> in the callback is the OutEndpoint object.</p>
378
- <a href="#event-errorerror-1" id="event-errorerror-1" style="color: inherit; text-decoration: none;">
379
- <h3>Event: error(error)</h3>
380
- </a>
381
- <p>Emitted when the stream encounters an error.</p>
382
- <a href="#event-end-1" id="event-end-1" style="color: inherit; text-decoration: none;">
383
- <h3>Event: end</h3>
384
- </a>
385
- <p>Emitted when the stream has been stopped and all pending requests have been completed.</p>
386
- <a href="#usbdetection" id="usbdetection" style="color: inherit; text-decoration: none;">
387
- <h2>UsbDetection</h2>
388
- </a>
389
- <a href="#usbon39attach39-functiondevice---" id="usbon39attach39-functiondevice---" style="color: inherit; text-decoration: none;">
390
- <h3>usb.on(&#39;attach&#39;, function(device) { ... });</h3>
391
- </a>
392
- <p>Attaches a callback to plugging in a <code>device</code>.</p>
393
- <a href="#usbon39detach39-functiondevice---" id="usbon39detach39-functiondevice---" style="color: inherit; text-decoration: none;">
394
- <h3>usb.on(&#39;detach&#39;, function(device) { ... });</h3>
395
- </a>
396
- <p>Attaches a callback to unplugging a <code>device</code>.</p>
397
- <a href="#development-and-testing" id="development-and-testing" style="color: inherit; text-decoration: none;">
398
- <h1>Development and testing</h1>
399
- </a>
400
- <p>To build from git:</p>
401
- <pre><code><span style="color: #001080">git</span><span style="color: #000000"> </span><span style="color: #001080">clone</span><span style="color: #000000"> --</span><span style="color: #001080">recursive</span><span style="color: #000000"> https:</span><span style="color: #008000">//github.com/tessel/node-usb.git</span>
402
- <span style="color: #001080">cd</span><span style="color: #000000"> </span><span style="color: #001080">node</span><span style="color: #000000">-</span><span style="color: #001080">usb</span>
403
- <span style="color: #001080">npm</span><span style="color: #000000"> </span><span style="color: #001080">install</span>
404
- </code></pre>
405
- <p>To execute the unit tests, <a href="http://coffeescript.org">CoffeeScript</a> is required. Run</p>
406
- <pre><code><span style="color: #001080">npm</span><span style="color: #000000"> </span><span style="color: #001080">test</span>
407
- </code></pre>
408
- <p>Some tests require an <a href="https://github.com/thegecko/node-usb-test-firmware">attached STM32F103 Microprocessor USB device with specific firmware</a>.</p>
409
- <pre><code><span style="color: #001080">npm</span><span style="color: #000000"> </span><span style="color: #001080">run</span><span style="color: #000000"> --</span><span style="color: #001080">silent</span><span style="color: #000000"> </span><span style="color: #001080">full</span><span style="color: #000000">-</span><span style="color: #001080">test</span>
410
- <span style="color: #001080">npm</span><span style="color: #000000"> </span><span style="color: #001080">run</span><span style="color: #000000"> --</span><span style="color: #001080">silent</span><span style="color: #000000"> </span><span style="color: #001080">valgrind</span>
411
- </code></pre>
412
- <a href="#limitations" id="limitations" style="color: inherit; text-decoration: none;">
413
- <h1>Limitations</h1>
414
- </a>
415
- <p>Does not support:</p>
416
- <ul>
417
- <li>Configurations other than the default one</li>
418
- <li>Isochronous transfers</li>
419
- </ul>
420
- <a href="#license" id="license" style="color: inherit; text-decoration: none;">
421
- <h1>License</h1>
422
- </a>
423
- <p>MIT</p>
424
- <p>Note that the compiled Node extension includes Libusb, and is thus subject to the LGPL.</p>
425
- </div>
426
- </div>
427
- <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
428
- <nav class="tsd-navigation primary">
429
- <ul>
430
- <li class=" ">
431
- <a href="modules.html">Exports</a>
432
- </li>
433
- <li class=" tsd-kind-module">
434
- <a href="modules/index.html">index</a>
435
- </li>
436
- <li class=" tsd-kind-module">
437
- <a href="modules/usb.html">usb</a>
438
- </li>
439
- <li class=" tsd-kind-module">
440
- <a href="modules/usb_bindings.html">usb/bindings</a>
441
- </li>
442
- <li class=" tsd-kind-module">
443
- <a href="modules/usb_capability.html">usb/capability</a>
444
- </li>
445
- <li class=" tsd-kind-module">
446
- <a href="modules/usb_descriptors.html">usb/descriptors</a>
447
- </li>
448
- <li class=" tsd-kind-module">
449
- <a href="modules/usb_device.html">usb/device</a>
450
- </li>
451
- <li class=" tsd-kind-module">
452
- <a href="modules/usb_endpoint.html">usb/endpoint</a>
453
- </li>
454
- <li class=" tsd-kind-module">
455
- <a href="modules/usb_interface.html">usb/interface</a>
456
- </li>
457
- <li class=" tsd-kind-module">
458
- <a href="modules/webusb.html">webusb</a>
459
- </li>
460
- <li class=" tsd-kind-module">
461
- <a href="modules/webusb_mutex.html">webusb/mutex</a>
462
- </li>
463
- <li class=" tsd-kind-module">
464
- <a href="modules/webusb_typed_event_target.html">webusb/typed-<wbr>event-<wbr>target</a>
465
- </li>
466
- <li class=" tsd-kind-module">
467
- <a href="modules/webusb_webusb_device.html">webusb/webusb-<wbr>device</a>
468
- </li>
469
- </ul>
470
- </nav>
471
- <nav class="tsd-navigation secondary menu-sticky">
472
- <ul class="before-current">
473
- </ul>
474
- </nav>
475
- </div>
476
- </div>
477
- </div>
478
- <footer>
479
- <div class="container">
480
- <h2>Legend</h2>
481
- <div class="tsd-legend-group">
482
- <ul class="tsd-legend">
483
- <li class="tsd-kind-variable"><span class="tsd-kind-icon">Variable</span></li>
484
- <li class="tsd-kind-function"><span class="tsd-kind-icon">Function</span></li>
485
- <li class="tsd-kind-function tsd-has-type-parameter"><span class="tsd-kind-icon">Function with type parameter</span></li>
486
- </ul>
487
- <ul class="tsd-legend">
488
- <li class="tsd-kind-class"><span class="tsd-kind-icon">Class</span></li>
489
- <li class="tsd-kind-class tsd-has-type-parameter"><span class="tsd-kind-icon">Class with type parameter</span></li>
490
- </ul>
491
- <ul class="tsd-legend">
492
- <li class="tsd-kind-interface"><span class="tsd-kind-icon">Interface</span></li>
493
- </ul>
494
- </div>
495
- </div>
496
- </footer>
497
- <div class="overlay"></div>
498
- <script src="assets/js/main.js"></script>
499
- </body>
500
- </html>