usb 1.7.2 → 1.8.1-libusb.4

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 (188) hide show
  1. package/.gitmodules +1 -1
  2. package/Readme.md +2 -2
  3. package/binding.gyp +2 -2
  4. package/libusb/.private/pre-commit.sh +7 -1
  5. package/libusb/.travis.yml +49 -0
  6. package/libusb/AUTHORS +44 -3
  7. package/libusb/Brewfile +4 -0
  8. package/libusb/ChangeLog +74 -2
  9. package/libusb/README.md +32 -0
  10. package/libusb/TODO +1 -1
  11. package/libusb/Xcode/common.xcconfig +12 -0
  12. package/libusb/Xcode/config.h +25 -0
  13. package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +959 -1
  14. package/libusb/android/README +4 -2
  15. package/libusb/android/config.h +75 -0
  16. package/libusb/appveyor.yml +41 -0
  17. package/libusb/appveyor_cygwin.bat +11 -0
  18. package/libusb/appveyor_minGW.bat +19 -0
  19. package/libusb/autogen.sh +1 -1
  20. package/libusb/bootstrap.sh +3 -16
  21. package/libusb/configure.ac +108 -80
  22. package/libusb/doc/doxygen.cfg.in +1785 -739
  23. package/libusb/examples/Makefile.am +1 -1
  24. package/libusb/examples/dpfp.c +3 -1
  25. package/libusb/examples/dpfp_threaded.c +23 -10
  26. package/libusb/examples/ezusb.c +3 -3
  27. package/libusb/examples/ezusb.h +2 -2
  28. package/libusb/examples/fxload.c +31 -9
  29. package/libusb/examples/hotplugtest.c +35 -7
  30. package/libusb/examples/listdevs.c +3 -1
  31. package/libusb/examples/sam3u_benchmark.c +3 -3
  32. package/libusb/examples/testlibusb.c +277 -0
  33. package/libusb/examples/xusb.c +40 -34
  34. package/libusb/libusb/Makefile.am +49 -23
  35. package/libusb/libusb/core.c +855 -457
  36. package/libusb/libusb/descriptor.c +72 -78
  37. package/libusb/libusb/hotplug.c +122 -76
  38. package/libusb/libusb/hotplug.h +42 -25
  39. package/libusb/libusb/io.c +625 -390
  40. package/libusb/libusb/libusb-1.0.def +12 -0
  41. package/libusb/libusb/libusb.h +218 -150
  42. package/libusb/libusb/libusbi.h +346 -176
  43. package/libusb/libusb/os/darwin_usb.c +604 -319
  44. package/libusb/libusb/os/darwin_usb.h +61 -20
  45. package/libusb/libusb/os/haiku_pollfs.cpp +367 -0
  46. package/libusb/libusb/os/haiku_usb.h +113 -0
  47. package/libusb/libusb/os/haiku_usb_backend.cpp +533 -0
  48. package/libusb/libusb/os/haiku_usb_raw.cpp +267 -0
  49. package/libusb/libusb/os/haiku_usb_raw.h +188 -0
  50. package/libusb/libusb/os/linux_netlink.c +186 -146
  51. package/libusb/libusb/os/linux_udev.c +36 -14
  52. package/libusb/libusb/os/linux_usbfs.c +426 -225
  53. package/libusb/libusb/os/linux_usbfs.h +5 -3
  54. package/libusb/libusb/os/netbsd_usb.c +21 -77
  55. package/libusb/libusb/os/openbsd_usb.c +32 -115
  56. package/libusb/libusb/os/poll_posix.c +38 -5
  57. package/libusb/libusb/os/poll_posix.h +3 -0
  58. package/libusb/libusb/os/poll_windows.c +277 -626
  59. package/libusb/libusb/os/poll_windows.h +11 -44
  60. package/libusb/libusb/os/sunos_usb.c +1695 -0
  61. package/libusb/libusb/os/sunos_usb.h +80 -0
  62. package/libusb/libusb/os/threads_posix.c +24 -26
  63. package/libusb/libusb/os/threads_posix.h +73 -21
  64. package/libusb/libusb/os/threads_windows.c +71 -157
  65. package/libusb/libusb/os/threads_windows.h +68 -44
  66. package/libusb/libusb/os/wince_usb.c +276 -420
  67. package/libusb/libusb/os/wince_usb.h +23 -28
  68. package/libusb/libusb/os/windows_common.h +78 -58
  69. package/libusb/libusb/os/windows_nt_common.c +1010 -0
  70. package/libusb/libusb/os/windows_nt_common.h +110 -0
  71. package/libusb/libusb/os/windows_nt_shared_types.h +147 -0
  72. package/libusb/libusb/os/windows_usbdk.c +830 -0
  73. package/libusb/libusb/os/windows_usbdk.h +103 -0
  74. package/libusb/libusb/os/windows_winusb.c +4391 -0
  75. package/libusb/libusb/os/windows_winusb.h +783 -0
  76. package/libusb/libusb/strerror.c +41 -7
  77. package/libusb/libusb/sync.c +41 -13
  78. package/libusb/libusb/version.h +1 -1
  79. package/libusb/libusb/version_nano.h +1 -1
  80. package/libusb/libusb-1.0.pc.in +1 -1
  81. package/libusb/msvc/appveyor.bat +27 -0
  82. package/libusb/msvc/config.h +5 -4
  83. package/libusb/msvc/ddk_build.cmd +87 -43
  84. package/libusb/msvc/fxload_2010.vcxproj +24 -104
  85. package/libusb/msvc/fxload_2012.vcxproj +24 -107
  86. package/libusb/msvc/fxload_2013.vcxproj +24 -107
  87. package/libusb/msvc/fxload_2015.vcxproj +91 -0
  88. package/libusb/msvc/fxload_2017.vcxproj +114 -0
  89. package/libusb/msvc/fxload_sources +1 -1
  90. package/libusb/msvc/getopt_2010.vcxproj +16 -75
  91. package/libusb/msvc/getopt_2012.vcxproj +16 -79
  92. package/libusb/msvc/getopt_2013.vcxproj +16 -79
  93. package/libusb/msvc/getopt_2015.vcxproj +73 -0
  94. package/libusb/msvc/getopt_2017.vcxproj +98 -0
  95. package/libusb/msvc/getopt_sources +6 -2
  96. package/libusb/msvc/hotplugtest_2010.vcxproj +18 -99
  97. package/libusb/msvc/hotplugtest_2012.vcxproj +18 -102
  98. package/libusb/msvc/hotplugtest_2013.vcxproj +18 -102
  99. package/libusb/msvc/hotplugtest_2015.vcxproj +83 -0
  100. package/libusb/msvc/hotplugtest_2017.vcxproj +106 -0
  101. package/libusb/msvc/hotplugtest_sources +1 -1
  102. package/libusb/msvc/libusb_2005.sln +20 -20
  103. package/libusb/msvc/libusb_2010.sln +57 -46
  104. package/libusb/msvc/libusb_2012.sln +57 -46
  105. package/libusb/msvc/libusb_2013.sln +57 -50
  106. package/libusb/msvc/libusb_2015.sln +59 -52
  107. package/libusb/msvc/libusb_2017.sln +186 -0
  108. package/libusb/msvc/libusb_dll.dsp +2 -2
  109. package/libusb/msvc/libusb_dll_2005.vcproj +30 -2
  110. package/libusb/msvc/libusb_dll_2010.vcxproj +26 -90
  111. package/libusb/msvc/libusb_dll_2012.vcxproj +28 -96
  112. package/libusb/msvc/libusb_dll_2013.vcxproj +28 -96
  113. package/libusb/msvc/libusb_dll_2015.vcxproj +107 -0
  114. package/libusb/msvc/libusb_dll_2017.vcxproj +134 -0
  115. package/libusb/msvc/libusb_dll_wince.vcproj +9 -1
  116. package/libusb/msvc/libusb_sources +10 -5
  117. package/libusb/msvc/libusb_static.dsp +2 -2
  118. package/libusb/msvc/libusb_static_2005.vcproj +32 -4
  119. package/libusb/msvc/libusb_static_2010.vcxproj +24 -83
  120. package/libusb/msvc/libusb_static_2012.vcxproj +25 -87
  121. package/libusb/msvc/libusb_static_2013.vcxproj +25 -87
  122. package/libusb/msvc/libusb_static_2015.vcxproj +98 -0
  123. package/libusb/msvc/libusb_static_2017.vcxproj +117 -0
  124. package/libusb/msvc/libusb_static_wince.vcproj +20 -26
  125. package/libusb/msvc/libusb_wince.sln +88 -88
  126. package/libusb/msvc/listdevs_2010.vcxproj +16 -99
  127. package/libusb/msvc/listdevs_2012.vcxproj +16 -102
  128. package/libusb/msvc/listdevs_2013.vcxproj +16 -102
  129. package/libusb/msvc/listdevs_2015.vcxproj +83 -0
  130. package/libusb/msvc/listdevs_2017.vcxproj +106 -0
  131. package/libusb/msvc/listdevs_sources +2 -1
  132. package/libusb/msvc/stress_2010.vcxproj +20 -101
  133. package/libusb/msvc/stress_2012.vcxproj +20 -104
  134. package/libusb/msvc/stress_2013.vcxproj +20 -104
  135. package/libusb/msvc/stress_2015.vcxproj +87 -0
  136. package/libusb/msvc/stress_2017.vcxproj +110 -0
  137. package/libusb/msvc/stress_sources +21 -0
  138. package/libusb/msvc/testlibusb_2010.vcxproj +82 -0
  139. package/libusb/msvc/testlibusb_2012.vcxproj +83 -0
  140. package/libusb/msvc/testlibusb_2013.vcxproj +83 -0
  141. package/libusb/msvc/testlibusb_2015.vcxproj +83 -0
  142. package/libusb/msvc/testlibusb_2017.vcxproj +106 -0
  143. package/libusb/msvc/testlibusb_sources +20 -0
  144. package/libusb/msvc/xusb_2010.vcxproj +17 -98
  145. package/libusb/msvc/xusb_2012.vcxproj +17 -101
  146. package/libusb/msvc/xusb_2013.vcxproj +17 -101
  147. package/libusb/msvc/xusb_2015.vcxproj +83 -0
  148. package/libusb/msvc/xusb_2017.vcxproj +106 -0
  149. package/libusb/msvc/xusb_sources +1 -1
  150. package/libusb/tests/stress.c +2 -2
  151. package/libusb/tests/testlib.c +0 -4
  152. package/libusb/travis-autogen.sh +39 -0
  153. package/libusb.gypi +13 -2
  154. package/package.json +20 -11
  155. package/prebuilds/android-arm/node.napi.armv7.node +0 -0
  156. package/prebuilds/android-arm64/node.napi.armv8.node +0 -0
  157. package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
  158. package/prebuilds/linux-arm/node.napi.armv6.node +0 -0
  159. package/prebuilds/linux-arm/node.napi.armv7.node +0 -0
  160. package/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
  161. package/prebuilds/linux-ia32/node.napi.node +0 -0
  162. package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  163. package/prebuilds/linux-x64/node.napi.musl.node +0 -0
  164. package/prebuilds/win32-ia32/node.napi.node +0 -0
  165. package/prebuilds/win32-x64/node.napi.node +0 -0
  166. package/src/device.cc +1 -1
  167. package/usb.js +51 -5
  168. package/.github/workflows/prebuild.yml +0 -49
  169. package/libusb/INSTALL +0 -234
  170. package/libusb/README +0 -28
  171. package/libusb/libusb/os/windows_usb.c +0 -5347
  172. package/libusb/libusb/os/windows_usb.h +0 -971
  173. package/libusb/msvc/fxload_2010.vcxproj.filters +0 -25
  174. package/libusb/msvc/fxload_2012.vcxproj.filters +0 -25
  175. package/libusb/msvc/getopt_2010.vcxproj.filters +0 -26
  176. package/libusb/msvc/getopt_2012.vcxproj.filters +0 -26
  177. package/libusb/msvc/hotplugtest_2010.vcxproj.filters +0 -14
  178. package/libusb/msvc/hotplugtest_2012.vcxproj.filters +0 -14
  179. package/libusb/msvc/libusb_dll_2010.vcxproj.filters +0 -81
  180. package/libusb/msvc/libusb_dll_2012.vcxproj.filters +0 -84
  181. package/libusb/msvc/libusb_static_2010.vcxproj.filters +0 -74
  182. package/libusb/msvc/libusb_static_2012.vcxproj.filters +0 -74
  183. package/libusb/msvc/listdevs_2010.vcxproj.filters +0 -14
  184. package/libusb/msvc/listdevs_2012.vcxproj.filters +0 -14
  185. package/libusb/msvc/stress_2010.vcxproj.filters +0 -25
  186. package/libusb/msvc/stress_2012.vcxproj.filters +0 -25
  187. package/libusb/msvc/xusb_2010.vcxproj.filters +0 -14
  188. package/libusb/msvc/xusb_2012.vcxproj.filters +0 -14
@@ -16,13 +16,16 @@
16
16
  * License along with this library; if not, write to the Free Software
17
17
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
  */
19
- #include "config.h"
19
+
20
+ #include <config.h>
20
21
 
21
22
  #include <locale.h>
22
23
  #include <stdlib.h>
23
24
  #include <string.h>
25
+ #if defined(HAVE_STRINGS_H)
26
+ #include <strings.h>
27
+ #endif
24
28
 
25
- #include "libusb.h"
26
29
  #include "libusbi.h"
27
30
 
28
31
  #if defined(_MSC_VER)
@@ -31,11 +34,11 @@
31
34
 
32
35
  static size_t usbi_locale = 0;
33
36
 
34
- /** \ingroup misc
37
+ /** \ingroup libusb_misc
35
38
  * How to add a new \ref libusb_strerror() translation:
36
39
  * <ol>
37
40
  * <li> Download the latest \c strerror.c from:<br>
38
- * https://raw.github.com/libusb/libusb/master/libusb/sterror.c </li>
41
+ * https://raw.github.com/libusb/libusb/master/libusb/strerror.c </li>
39
42
  * <li> Open the file in an UTF-8 capable editor </li>
40
43
  * <li> Add the 2 letter <a href="http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes">ISO 639-1</a>
41
44
  * code for your locale at the end of \c usbi_locale_supported[]<br>
@@ -57,7 +60,7 @@ static size_t usbi_locale = 0;
57
60
  * </ol>
58
61
  */
59
62
 
60
- static const char* usbi_locale_supported[] = { "en", "nl", "fr", "ru" };
63
+ static const char* usbi_locale_supported[] = { "en", "nl", "fr", "ru", "de", "hu" };
61
64
  static const char* usbi_localized_errors[ARRAYSIZE(usbi_locale_supported)][LIBUSB_ERROR_COUNT] = {
62
65
  { /* English (en) */
63
66
  "Success",
@@ -119,10 +122,41 @@ static const char* usbi_localized_errors[ARRAYSIZE(usbi_locale_supported)][LIBUS
119
122
  "Память исчерпана",
120
123
  "Операция не поддерживается данной платформой",
121
124
  "Неизвестная ошибка"
125
+
126
+ }, { /* German (de) */
127
+ "Erfolgreich",
128
+ "Eingabe-/Ausgabefehler",
129
+ "Ungültiger Parameter",
130
+ "Keine Berechtigung (Zugriffsrechte fehlen)",
131
+ "Kein passendes Gerät gefunden (es könnte entfernt worden sein)",
132
+ "Entität nicht gefunden",
133
+ "Die Ressource ist belegt",
134
+ "Die Wartezeit für die Operation ist abgelaufen",
135
+ "Mehr Daten empfangen als erwartet",
136
+ "Datenübergabe unterbrochen (broken pipe)",
137
+ "Unterbrechung während des Betriebssystemaufrufs",
138
+ "Nicht genügend Hauptspeicher verfügbar",
139
+ "Die Operation wird nicht unterstützt oder ist auf dieser Platform nicht implementiert",
140
+ "Allgemeiner Fehler",
141
+ }, { /* Hungarian (hu) */
142
+ "Sikeres",
143
+ "Be-/kimeneti hiba",
144
+ "Érvénytelen paraméter",
145
+ "Hozzáférés megtagadva",
146
+ "Az eszköz nem található (eltávolították?)",
147
+ "Nem található",
148
+ "Az erőforrás foglalt",
149
+ "Időtúllépés",
150
+ "Túlcsordulás",
151
+ "Törött adatcsatorna",
152
+ "Rendszerhívás megszakítva",
153
+ "Nincs elég memória",
154
+ "A művelet nem támogatott ezen a rendszeren",
155
+ "Általános hiba",
122
156
  }
123
157
  };
124
158
 
125
- /** \ingroup misc
159
+ /** \ingroup libusb_misc
126
160
  * Set the language, and only the language, not the encoding! used for
127
161
  * translatable libusb messages.
128
162
  *
@@ -173,7 +207,7 @@ int API_EXPORTED libusb_setlocale(const char *locale)
173
207
  return LIBUSB_SUCCESS;
174
208
  }
175
209
 
176
- /** \ingroup misc
210
+ /** \ingroup libusb_misc
177
211
  * Returns a constant string with a short description of the given error code,
178
212
  * this description is intended for displaying to the end user and will be in
179
213
  * the language set by libusb_setlocale().
@@ -1,6 +1,9 @@
1
+ /* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
1
2
  /*
2
3
  * Synchronous I/O functions for libusb
3
4
  * Copyright © 2007-2008 Daniel Drake <dsd@gentoo.org>
5
+ * Copyright © 2019 Nathan Hjelm <hjelmn@cs.unm.edu>
6
+ * Copyright © 2019 Google LLC. All rights reserved.
4
7
  *
5
8
  * This library is free software; you can redistribute it and/or
6
9
  * modify it under the terms of the GNU Lesser General Public
@@ -17,7 +20,8 @@
17
20
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
21
  */
19
22
 
20
- #include "config.h"
23
+ #include <config.h>
24
+
21
25
  #include <errno.h>
22
26
  #include <stdint.h>
23
27
  #include <stdlib.h>
@@ -26,11 +30,11 @@
26
30
  #include "libusbi.h"
27
31
 
28
32
  /**
29
- * @defgroup syncio Synchronous device I/O
33
+ * @defgroup libusb_syncio Synchronous device I/O
30
34
  *
31
35
  * This page documents libusb's synchronous (blocking) API for USB device I/O.
32
36
  * This interface is easy to use but has some limitations. More advanced users
33
- * may wish to consider using the \ref asyncio "asynchronous I/O API" instead.
37
+ * may wish to consider using the \ref libusb_asyncio "asynchronous I/O API" instead.
34
38
  */
35
39
 
36
40
  static void LIBUSB_CALL sync_transfer_cb(struct libusb_transfer *transfer)
@@ -56,10 +60,15 @@ static void sync_transfer_wait_for_completion(struct libusb_transfer *transfer)
56
60
  libusb_cancel_transfer(transfer);
57
61
  continue;
58
62
  }
63
+ if (NULL == transfer->dev_handle) {
64
+ /* transfer completion after libusb_close() */
65
+ transfer->status = LIBUSB_ERROR_NO_DEVICE;
66
+ *completed = 1;
67
+ }
59
68
  }
60
69
  }
61
70
 
62
- /** \ingroup syncio
71
+ /** \ingroup libusb_syncio
63
72
  * Perform a USB control transfer.
64
73
  *
65
74
  * The direction of the transfer is inferred from the bmRequestType field of
@@ -85,17 +94,24 @@ static void sync_transfer_wait_for_completion(struct libusb_transfer *transfer)
85
94
  * \returns LIBUSB_ERROR_PIPE if the control request was not supported by the
86
95
  * device
87
96
  * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
97
+ * \returns LIBUSB_ERROR_BUSY if called from event handling context
98
+ * \returns LIBUSB_ERROR_INVALID_PARAM if the transfer size is larger than
99
+ * the operating system and/or hardware can support
88
100
  * \returns another LIBUSB_ERROR code on other failures
89
101
  */
90
102
  int API_EXPORTED libusb_control_transfer(libusb_device_handle *dev_handle,
91
103
  uint8_t bmRequestType, uint8_t bRequest, uint16_t wValue, uint16_t wIndex,
92
104
  unsigned char *data, uint16_t wLength, unsigned int timeout)
93
105
  {
94
- struct libusb_transfer *transfer = libusb_alloc_transfer(0);
106
+ struct libusb_transfer *transfer;
95
107
  unsigned char *buffer;
96
108
  int completed = 0;
97
109
  int r;
98
110
 
111
+ if (usbi_handling_events(HANDLE_CTX(dev_handle)))
112
+ return LIBUSB_ERROR_BUSY;
113
+
114
+ transfer = libusb_alloc_transfer(0);
99
115
  if (!transfer)
100
116
  return LIBUSB_ERROR_NO_MEM;
101
117
 
@@ -159,10 +175,14 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
159
175
  unsigned char endpoint, unsigned char *buffer, int length,
160
176
  int *transferred, unsigned int timeout, unsigned char type)
161
177
  {
162
- struct libusb_transfer *transfer = libusb_alloc_transfer(0);
178
+ struct libusb_transfer *transfer;
163
179
  int completed = 0;
164
180
  int r;
165
181
 
182
+ if (usbi_handling_events(HANDLE_CTX(dev_handle)))
183
+ return LIBUSB_ERROR_BUSY;
184
+
185
+ transfer = libusb_alloc_transfer(0);
166
186
  if (!transfer)
167
187
  return LIBUSB_ERROR_NO_MEM;
168
188
 
@@ -178,7 +198,9 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
178
198
 
179
199
  sync_transfer_wait_for_completion(transfer);
180
200
 
181
- *transferred = transfer->actual_length;
201
+ if (transferred)
202
+ *transferred = transfer->actual_length;
203
+
182
204
  switch (transfer->status) {
183
205
  case LIBUSB_TRANSFER_COMPLETED:
184
206
  r = 0;
@@ -209,7 +231,7 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
209
231
  return r;
210
232
  }
211
233
 
212
- /** \ingroup syncio
234
+ /** \ingroup libusb_syncio
213
235
  * Perform a USB bulk transfer. The direction of the transfer is inferred from
214
236
  * the direction bits of the endpoint address.
215
237
  *
@@ -235,7 +257,9 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
235
257
  * \param length for bulk writes, the number of bytes from data to be sent. for
236
258
  * bulk reads, the maximum number of bytes to receive into the data buffer.
237
259
  * \param transferred output location for the number of bytes actually
238
- * transferred.
260
+ * transferred. Since version 1.0.21 (\ref LIBUSB_API_VERSION >= 0x01000105),
261
+ * it is legal to pass a NULL pointer if you do not wish to receive this
262
+ * information.
239
263
  * \param timeout timeout (in millseconds) that this function should wait
240
264
  * before giving up due to no response being received. For an unlimited
241
265
  * timeout, use value 0.
@@ -245,8 +269,9 @@ static int do_sync_bulk_transfer(struct libusb_device_handle *dev_handle,
245
269
  * <tt>transferred</tt>)
246
270
  * \returns LIBUSB_ERROR_PIPE if the endpoint halted
247
271
  * \returns LIBUSB_ERROR_OVERFLOW if the device offered more data, see
248
- * \ref packetoverflow
272
+ * \ref libusb_packetoverflow
249
273
  * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
274
+ * \returns LIBUSB_ERROR_BUSY if called from event handling context
250
275
  * \returns another LIBUSB_ERROR code on other failures
251
276
  */
252
277
  int API_EXPORTED libusb_bulk_transfer(struct libusb_device_handle *dev_handle,
@@ -257,7 +282,7 @@ int API_EXPORTED libusb_bulk_transfer(struct libusb_device_handle *dev_handle,
257
282
  transferred, timeout, LIBUSB_TRANSFER_TYPE_BULK);
258
283
  }
259
284
 
260
- /** \ingroup syncio
285
+ /** \ingroup libusb_syncio
261
286
  * Perform a USB interrupt transfer. The direction of the transfer is inferred
262
287
  * from the direction bits of the endpoint address.
263
288
  *
@@ -285,7 +310,9 @@ int API_EXPORTED libusb_bulk_transfer(struct libusb_device_handle *dev_handle,
285
310
  * \param length for bulk writes, the number of bytes from data to be sent. for
286
311
  * bulk reads, the maximum number of bytes to receive into the data buffer.
287
312
  * \param transferred output location for the number of bytes actually
288
- * transferred.
313
+ * transferred. Since version 1.0.21 (\ref LIBUSB_API_VERSION >= 0x01000105),
314
+ * it is legal to pass a NULL pointer if you do not wish to receive this
315
+ * information.
289
316
  * \param timeout timeout (in millseconds) that this function should wait
290
317
  * before giving up due to no response being received. For an unlimited
291
318
  * timeout, use value 0.
@@ -294,8 +321,9 @@ int API_EXPORTED libusb_bulk_transfer(struct libusb_device_handle *dev_handle,
294
321
  * \returns LIBUSB_ERROR_TIMEOUT if the transfer timed out
295
322
  * \returns LIBUSB_ERROR_PIPE if the endpoint halted
296
323
  * \returns LIBUSB_ERROR_OVERFLOW if the device offered more data, see
297
- * \ref packetoverflow
324
+ * \ref libusb_packetoverflow
298
325
  * \returns LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
326
+ * \returns LIBUSB_ERROR_BUSY if called from event handling context
299
327
  * \returns another LIBUSB_ERROR code on other error
300
328
  */
301
329
  int API_EXPORTED libusb_interrupt_transfer(
@@ -7,7 +7,7 @@
7
7
  #define LIBUSB_MINOR 0
8
8
  #endif
9
9
  #ifndef LIBUSB_MICRO
10
- #define LIBUSB_MICRO 19
10
+ #define LIBUSB_MICRO 23
11
11
  #endif
12
12
  #ifndef LIBUSB_NANO
13
13
  #define LIBUSB_NANO 0
@@ -1 +1 @@
1
- #define LIBUSB_NANO 10914
1
+ #define LIBUSB_NANO 11397
@@ -4,7 +4,7 @@ libdir=@libdir@
4
4
  includedir=@includedir@
5
5
 
6
6
  Name: libusb-1.0
7
- Description: C API for USB device access from Linux, Mac OS X, Windows and OpenBSD/NetBSD userspace
7
+ Description: C API for USB device access from Linux, Mac OS X, Windows, OpenBSD/NetBSD and Solaris userspace
8
8
  Version: @VERSION@
9
9
  Libs: -L${libdir} -lusb-1.0
10
10
  Libs.private: @LIBS@
@@ -0,0 +1,27 @@
1
+ echo on
2
+ SetLocal EnableDelayedExpansion
3
+
4
+ if [%Configuration%] NEQ [Debug] goto releasex64
5
+ if [%Configuration%] NEQ [Release] goto debugx64
6
+
7
+ :debugx64
8
+ if [%Platform%] NEQ [x64] goto debugWin32
9
+ if [%Configuration%] NEQ [Debug] exit 0
10
+ call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /Debug /x64 || exit /B
11
+ msbuild %libusb_2010% /p:Configuration=Debug,Platform=x64 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" || exit /B
12
+
13
+ :releasex64
14
+ if [%Platform%] NEQ [x64] goto releaseWin32
15
+ if [%Configuration%] NEQ [Release] exit 0
16
+ call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /Release /x64 || exit /B
17
+ msbuild %libusb_2010% /p:Configuration=Release,Platform=x64 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" || exit /B
18
+
19
+ :debugWin32
20
+ if [%Platform%] NEQ [Win32] exit 0
21
+ if [%Configuration%] NEQ [Debug] exit 0
22
+ msbuild %libusb_2010% /p:Configuration=Debug,Platform=Win32 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" || exit /B
23
+
24
+ :releaseWin32
25
+ if [%Platform%] NEQ [Win32] exit 0
26
+ if [%Configuration%] NEQ [Release] exit 0
27
+ msbuild %libusb_2010% /p:Configuration=Release,Platform=Win32 /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" || exit /B
@@ -6,16 +6,18 @@
6
6
  #endif
7
7
 
8
8
  /* Visual Studio 2015 and later defines timespec */
9
- #if defined(_MSC_VER) && (_MSC_VER >= 1900)
9
+ #if (_MSC_VER >= 1900)
10
10
  #define _TIMESPEC_DEFINED 1
11
11
  #endif
12
12
 
13
13
  /* Disable: warning C4200: nonstandard extension used : zero-sized array in struct/union */
14
14
  #pragma warning(disable:4200)
15
+ /* Disable: warning C4324: structure was padded due to __declspec(align()) */
16
+ #pragma warning(disable:4324)
15
17
  /* Disable: warning C6258: Using TerminateThread does not allow proper thread clean up */
16
- #pragma warning(disable: 6258)
18
+ #pragma warning(disable:6258)
17
19
  /* Disable: warning C4996: 'GetVersionA': was declared deprecated */
18
- #pragma warning(disable: 4996)
20
+ #pragma warning(disable:4996)
19
21
 
20
22
  #if defined(_PREFAST_)
21
23
  /* Disable "Banned API" errors when using the MS's WDK OACR/Prefast */
@@ -45,6 +47,5 @@
45
47
  #define HAVE_MISSING_H
46
48
  #else
47
49
  #define OS_WINDOWS 1
48
- #define HAVE_SIGNAL_H 1
49
50
  #define HAVE_SYS_TYPES_H 1
50
51
  #endif
@@ -11,12 +11,13 @@ set TARGET=LIBRARY
11
11
  set STATIC_LIBC=
12
12
  set version=1.0
13
13
  set PWD=%~dp0
14
- set BUILD_CMD=build -bcwgZ -M2
14
+ set BUILD_CMD=build /bcwgZ /M2
15
15
 
16
16
  if "%1" == "" goto no_more_args
17
17
  ::# /I for case insensitive
18
18
  if /I Test%1==TestDLL set TARGET=DYNLINK
19
19
  if /I Test%1==Test/MT set STATIC_LIBC=1
20
+
20
21
  :no_more_args
21
22
 
22
23
  cd ..\libusb\os
@@ -44,13 +45,13 @@ set dstPath=%destType%\Release
44
45
  :isDebug
45
46
 
46
47
  if exist %destType% goto md2
47
- mkdir %destType%
48
+ md %destType%
48
49
  :md2
49
50
  if exist %dstPath% goto md3
50
- mkdir %dstPath%
51
+ md %dstPath%
51
52
  :md3
52
53
  if exist %dstPath%\dll goto md4
53
- mkdir %dstPath%\dll
54
+ md %dstPath%\dll
54
55
  :md4
55
56
  if exist %dstPath%\lib goto md5
56
57
  md %dstPath%\lib
@@ -58,9 +59,12 @@ md %dstPath%\lib
58
59
  if exist %dstPath%\examples goto md6
59
60
  md %dstPath%\examples
60
61
  :md6
62
+ if exist %dstPath%\tests goto md7
63
+ md %dstPath%\tests
64
+ :md7
61
65
  @echo on
62
66
 
63
- @if /I NOT Test%1==TestDLL goto copylib
67
+ if %TARGET%==LIBRARY goto copylib
64
68
  copy %srcPath%\libusb-%version%.dll %dstPath%\dll
65
69
  copy %srcPath%\libusb-%version%.pdb %dstPath%\dll
66
70
  :copylib
@@ -68,95 +72,135 @@ copy %srcPath%\libusb-%version%.lib %dstPath%\lib
68
72
 
69
73
  @echo off
70
74
 
71
- if exist examples\listdevs_ddkbuild goto md7
72
- md examples\listdevs_ddkbuild
73
- :md7
75
+ if exist examples\getopt\getopt_ddkbuild goto md8
76
+ md examples\getopt\getopt_ddkbuild
77
+ :md8
74
78
 
75
- cd examples\listdevs_ddkbuild
76
- copy ..\..\msvc\listdevs_sources sources >NUL 2>&1
79
+ cd examples\getopt\getopt_ddkbuild
80
+ copy ..\..\..\msvc\getopt_sources sources >NUL 2>&1
81
+ @echo on
82
+ %BUILD_CMD%
83
+ @echo off
84
+ if errorlevel 1 goto builderror
85
+ cd ..\..\..
86
+
87
+ if exist examples\fxload_ddkbuild goto md9
88
+ md examples\fxload_ddkbuild
89
+ :md9
90
+
91
+ cd examples\fxload_ddkbuild
92
+ copy ..\..\msvc\fxload_sources sources >NUL 2>&1
77
93
  @echo on
78
94
  %BUILD_CMD%
79
95
  @echo off
80
96
  if errorlevel 1 goto builderror
81
97
  cd ..\..
82
98
 
83
- set srcPath=examples\listdevs_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
99
+ set srcPath=examples\fxload_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
84
100
  @echo on
85
101
 
86
- copy %srcPath%\listdevs.exe %dstPath%\examples
87
- copy %srcPath%\listdevs.pdb %dstPath%\examples
102
+ copy %srcPath%\fxload.exe %dstPath%\examples
103
+ copy %srcPath%\fxload.pdb %dstPath%\examples
88
104
 
89
105
  @echo off
90
106
 
91
- if exist examples\xusb_ddkbuild goto md8
92
- md examples\xusb_ddkbuild
93
- :md8
107
+ if exist examples\hotplugtest_ddkbuild goto md10
108
+ md examples\hotplugtest_ddkbuild
109
+ :md10
94
110
 
95
- cd examples\xusb_ddkbuild
96
- copy ..\..\msvc\xusb_sources sources >NUL 2>&1
111
+ cd examples\hotplugtest_ddkbuild
112
+ copy ..\..\msvc\hotplugtest_sources sources >NUL 2>&1
97
113
  @echo on
98
114
  %BUILD_CMD%
99
115
  @echo off
100
116
  if errorlevel 1 goto builderror
101
117
  cd ..\..
102
118
 
103
- set srcPath=examples\xusb_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
119
+ set srcPath=examples\hotplugtest_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
104
120
  @echo on
105
121
 
106
- copy %srcPath%\xusb.exe %dstPath%\examples
107
- copy %srcPath%\xusb.pdb %dstPath%\examples
122
+ copy %srcPath%\hotplugtest.exe %dstPath%\examples
123
+ copy %srcPath%\hotplugtest.pdb %dstPath%\examples
108
124
 
109
125
  @echo off
110
126
 
111
- if exist examples\getopt\getopt_ddkbuild goto md9
112
- md examples\getopt\getopt_ddkbuild
113
- :md9
127
+ if exist examples\listdevs_ddkbuild goto md11
128
+ md examples\listdevs_ddkbuild
129
+ :md11
114
130
 
115
- cd examples\getopt\getopt_ddkbuild
116
- copy ..\..\..\msvc\getopt_sources sources >NUL 2>&1
131
+ cd examples\listdevs_ddkbuild
132
+ copy ..\..\msvc\listdevs_sources sources >NUL 2>&1
117
133
  @echo on
118
134
  %BUILD_CMD%
119
135
  @echo off
120
136
  if errorlevel 1 goto builderror
121
- cd ..\..\..
137
+ cd ..\..
122
138
 
123
- if exist examples\fxload_ddkbuild goto md10
124
- md examples\fxload_ddkbuild
125
- :md10
139
+ set srcPath=examples\listdevs_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
140
+ @echo on
126
141
 
127
- cd examples\fxload_ddkbuild
128
- copy ..\..\msvc\fxload_sources sources >NUL 2>&1
142
+ copy %srcPath%\listdevs.exe %dstPath%\examples
143
+ copy %srcPath%\listdevs.pdb %dstPath%\examples
144
+
145
+ @echo off
146
+
147
+ if exist examples\testlibusb_ddkbuild goto md12
148
+ md examples\testlibusb_ddkbuild
149
+ :md12
150
+
151
+ cd examples\testlibusb_ddkbuild
152
+ copy ..\..\msvc\testlibusb_sources sources >NUL 2>&1
129
153
  @echo on
130
154
  %BUILD_CMD%
131
155
  @echo off
132
156
  if errorlevel 1 goto builderror
133
157
  cd ..\..
134
158
 
135
- set srcPath=examples\fxload_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
159
+ set srcPath=examples\testlibusb_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
136
160
  @echo on
137
161
 
138
- copy %srcPath%\fxload.exe %dstPath%\examples
139
- copy %srcPath%\fxload.pdb %dstPath%\examples
162
+ copy %srcPath%\testlibusb.exe %dstPath%\examples
163
+ copy %srcPath%\testlibusb.pdb %dstPath%\examples
140
164
 
141
165
  @echo off
142
166
 
143
- if exist examples\hotplugtest_ddkbuild goto md11
144
- md examples\hotplugtest_ddkbuild
145
- :md11
167
+ if exist examples\xusb_ddkbuild goto md13
168
+ md examples\xusb_ddkbuild
169
+ :md13
146
170
 
147
- cd examples\hotplugtest_ddkbuild
148
- copy ..\..\msvc\hotplugtest_sources sources >NUL 2>&1
171
+ cd examples\xusb_ddkbuild
172
+ copy ..\..\msvc\xusb_sources sources >NUL 2>&1
149
173
  @echo on
150
174
  %BUILD_CMD%
151
175
  @echo off
152
176
  if errorlevel 1 goto builderror
153
177
  cd ..\..
154
178
 
155
- set srcPath=examples\hotplugtest_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
179
+ set srcPath=examples\xusb_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
156
180
  @echo on
157
181
 
158
- copy %srcPath%\hotplugtest.exe %dstPath%\examples
159
- copy %srcPath%\hotplugtest.pdb %dstPath%\examples
182
+ copy %srcPath%\xusb.exe %dstPath%\examples
183
+ copy %srcPath%\xusb.pdb %dstPath%\examples
184
+
185
+ @echo off
186
+
187
+ if exist tests\stress_ddkbuild goto md14
188
+ md tests\stress_ddkbuild
189
+ :md14
190
+
191
+ cd tests\stress_ddkbuild
192
+ copy ..\..\msvc\stress_sources sources >NUL 2>&1
193
+ @echo on
194
+ %BUILD_CMD%
195
+ @echo off
196
+ if errorlevel 1 goto builderror
197
+ cd ..\..
198
+
199
+ set srcPath=tests\stress_ddkbuild\obj%BUILD_ALT_DIR%\%cpudir%
200
+ @echo on
201
+
202
+ copy %srcPath%\stress.exe %dstPath%\tests
203
+ copy %srcPath%\stress.pdb %dstPath%\tests
160
204
 
161
205
  @echo off
162
206