libusb 0.4.0 → 0.4.1

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 (118) hide show
  1. data/.travis.yml +2 -2
  2. data/Gemfile +0 -8
  3. data/History.md +5 -0
  4. data/README.md +6 -6
  5. data/Rakefile +9 -9
  6. data/ext/extconf.rb +1 -1
  7. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/AUTHORS +10 -0
  8. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/COPYING +0 -0
  9. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/ChangeLog +17 -9
  10. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/INSTALL +0 -0
  11. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/Makefile.am +0 -0
  12. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/Makefile.in +153 -178
  13. data/ext/libusb-1.0.18/NEWS +2 -0
  14. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/PORTING +13 -13
  15. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/README +9 -11
  16. data/ext/libusb-1.0.18/TODO +2 -0
  17. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/Xcode/common.xcconfig +3 -3
  18. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/Xcode/config.h +0 -0
  19. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/Xcode/debug.xcconfig +2 -2
  20. data/ext/{libusbx-1.0.17/Xcode/libusbx.xcconfig → libusb-1.0.18/Xcode/libusb.xcconfig} +2 -2
  21. data/ext/libusb-1.0.18/Xcode/libusb.xcodeproj/project.pbxproj +1 -0
  22. data/ext/{libusbx-1.0.17/Xcode/libusbx_debug.xcconfig → libusb-1.0.18/Xcode/libusb_debug.xcconfig} +3 -3
  23. data/ext/{libusbx-1.0.17/Xcode/libusbx_release.xcconfig → libusb-1.0.18/Xcode/libusb_release.xcconfig} +3 -3
  24. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/Xcode/release.xcconfig +2 -2
  25. data/ext/{libusbx-1.0.17/m4/libtool.m4 → libusb-1.0.18/aclocal.m4} +1731 -27
  26. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/README +0 -0
  27. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/config.h +1 -10
  28. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/jni/Android.mk +0 -0
  29. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/jni/Application.mk +6 -1
  30. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/jni/examples.mk +0 -0
  31. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/jni/libusb.mk +0 -0
  32. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/android/jni/tests.mk +0 -0
  33. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/compile +3 -7
  34. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/config.guess +19 -24
  35. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/config.h.in +0 -0
  36. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/config.sub +30 -47
  37. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/configure +118 -172
  38. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/configure.ac +24 -2
  39. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/depcomp +186 -268
  40. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/doc/Makefile.am +1 -1
  41. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/doc/Makefile.in +36 -73
  42. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/doc/doxygen.cfg.in +1 -1
  43. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/Makefile.am +0 -0
  44. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/Makefile.in +68 -132
  45. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/dpfp.c +1 -1
  46. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/dpfp_threaded.c +1 -1
  47. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/ezusb.c +57 -26
  48. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/ezusb.h +0 -0
  49. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/fxload.c +3 -3
  50. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/getopt/getopt.c +0 -0
  51. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/getopt/getopt.h +0 -0
  52. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/getopt/getopt1.c +0 -0
  53. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/hotplugtest.c +9 -2
  54. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/listdevs.c +1 -1
  55. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/sam3u_benchmark.c +0 -0
  56. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/examples/xusb.c +20 -4
  57. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/install-sh +7 -7
  58. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb-1.0.pc.in +1 -1
  59. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/Makefile.am +1 -1
  60. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/Makefile.in +94 -134
  61. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/core.c +95 -74
  62. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/descriptor.c +2 -2
  63. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/hotplug.c +3 -3
  64. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/hotplug.h +1 -1
  65. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/io.c +127 -116
  66. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/libusb-1.0.def +0 -0
  67. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/libusb-1.0.rc +1 -1
  68. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/libusb.h +42 -39
  69. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/libusbi.h +20 -11
  70. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/darwin_usb.c +20 -16
  71. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/darwin_usb.h +1 -1
  72. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/linux_netlink.c +0 -0
  73. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/linux_udev.c +0 -0
  74. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/linux_usbfs.c +15 -12
  75. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/linux_usbfs.h +0 -0
  76. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/netbsd_usb.c +2 -4
  77. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/openbsd_usb.c +5 -2
  78. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/poll_posix.c +0 -0
  79. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/poll_posix.h +0 -0
  80. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/poll_windows.c +2 -2
  81. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/poll_windows.h +0 -0
  82. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/threads_posix.c +1 -1
  83. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/threads_posix.h +1 -1
  84. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/threads_windows.c +1 -1
  85. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/threads_windows.h +1 -1
  86. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/wince_usb.c +1 -2
  87. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/wince_usb.h +2 -2
  88. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/windows_common.h +1 -1
  89. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/windows_usb.c +53 -33
  90. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/os/windows_usb.h +6 -1
  91. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/strerror.c +2 -2
  92. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/sync.c +6 -6
  93. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/libusb/version.h +1 -1
  94. data/ext/libusb-1.0.18/libusb/version_nano.h +1 -0
  95. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/ltmain.sh +3 -3
  96. data/ext/libusb-1.0.18/missing +331 -0
  97. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/tests/Makefile.am +1 -1
  98. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/tests/Makefile.in +69 -127
  99. data/ext/{libusbx-1.0.17/tests/libusbx_testlib.h → libusb-1.0.18/tests/libusb_testlib.h} +15 -15
  100. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/tests/stress.c +16 -16
  101. data/ext/{libusbx-1.0.17 → libusb-1.0.18}/tests/testlib.c +21 -20
  102. data/lib/libusb/version_gem.rb +1 -1
  103. data/libusb.gemspec +1 -6
  104. metadata +117 -135
  105. checksums.yaml +0 -7
  106. checksums.yaml.gz.sig +0 -0
  107. data.tar.gz.sig +0 -0
  108. data/ext/libusbx-1.0.17/NEWS +0 -2
  109. data/ext/libusbx-1.0.17/TODO +0 -2
  110. data/ext/libusbx-1.0.17/Xcode/libusbx.xcodeproj/project.pbxproj +0 -864
  111. data/ext/libusbx-1.0.17/aclocal.m4 +0 -1112
  112. data/ext/libusbx-1.0.17/libusb/version_nano.h +0 -1
  113. data/ext/libusbx-1.0.17/m4/ltoptions.m4 +0 -384
  114. data/ext/libusbx-1.0.17/m4/ltsugar.m4 +0 -123
  115. data/ext/libusbx-1.0.17/m4/ltversion.m4 +0 -23
  116. data/ext/libusbx-1.0.17/m4/lt~obsolete.m4 +0 -98
  117. data/ext/libusbx-1.0.17/missing +0 -215
  118. metadata.gz.sig +0 -0
@@ -1,6 +1,6 @@
1
1
  /* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
2
2
  /*
3
- * USB descriptor handling functions for libusbx
3
+ * USB descriptor handling functions for libusb
4
4
  * Copyright © 2007 Daniel Drake <dsd@gentoo.org>
5
5
  * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
6
6
  *
@@ -541,7 +541,7 @@ int usbi_device_cache_descriptor(libusb_device *dev)
541
541
  *
542
542
  * This is a non-blocking function; the device descriptor is cached in memory.
543
543
  *
544
- * Note since libusbx-1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102, this
544
+ * Note since libusb-1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102, this
545
545
  * function always succeeds.
546
546
  *
547
547
  * \param dev the device
@@ -1,6 +1,6 @@
1
1
  /* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
2
2
  /*
3
- * Hotplug functions for libusbx
3
+ * Hotplug functions for libusb
4
4
  * Copyright © 2012-2013 Nathan Hjelm <hjelmn@mac.com>
5
5
  * Copyright © 2012-2013 Peter Stuge <peter@stuge.se>
6
6
  *
@@ -45,7 +45,7 @@
45
45
  *
46
46
  * \section intro Introduction
47
47
  *
48
- * Version 1.0.16, \ref LIBUSBX_API_VERSION >= 0x01000102, has added support
48
+ * Version 1.0.16, \ref LIBUSB_API_VERSION >= 0x01000102, has added support
49
49
  * for hotplug events on <b>some</b> platforms (you should test if your platform
50
50
  * supports hotplug notification by calling \ref libusb_has_capability() with
51
51
  * parameter \ref LIBUSB_CAP_HAS_HOTPLUG).
@@ -80,7 +80,7 @@
80
80
  * are invalid and will remain so even if the device comes back.
81
81
  *
82
82
  * When handling a LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED event it is considered
83
- * safe to call any libusbx function that takes a libusb_device. On the other hand,
83
+ * safe to call any libusb function that takes a libusb_device. On the other hand,
84
84
  * when handling a LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT event the only safe function
85
85
  * is libusb_get_device_descriptor().
86
86
  *
@@ -1,6 +1,6 @@
1
1
  /* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
2
2
  /*
3
- * Hotplug support for libusbx
3
+ * Hotplug support for libusb
4
4
  * Copyright © 2012-2013 Nathan Hjelm <hjelmn@mac.com>
5
5
  * Copyright © 2012-2013 Peter Stuge <peter@stuge.se>
6
6
  *
@@ -1,6 +1,6 @@
1
1
  /* -*- Mode: C; indent-tabs-mode:t ; c-basic-offset:8 -*- */
2
2
  /*
3
- * I/O functions for libusbx
3
+ * I/O functions for libusb
4
4
  * Copyright © 2007-2009 Daniel Drake <dsd@gentoo.org>
5
5
  * Copyright © 2001 Johannes Erdfelt <johannes@erdfelt.com>
6
6
  *
@@ -43,10 +43,10 @@
43
43
  *
44
44
  * \section intro Introduction
45
45
  *
46
- * If you're using libusbx in your application, you're probably wanting to
46
+ * If you're using libusb in your application, you're probably wanting to
47
47
  * perform I/O with devices - you want to perform USB data transfers.
48
48
  *
49
- * libusbx offers two separate interfaces for device I/O. This page aims to
49
+ * libusb offers two separate interfaces for device I/O. This page aims to
50
50
  * introduce the two in order to help you decide which one is more suitable
51
51
  * for your application. You can also choose to use both interfaces in your
52
52
  * application by considering each transfer on a case-by-case basis.
@@ -76,7 +76,7 @@
76
76
  * Data will arrive when the button is pressed by the user, which is
77
77
  * potentially hours later.
78
78
  *
79
- * libusbx offers both a synchronous and an asynchronous interface to performing
79
+ * libusb offers both a synchronous and an asynchronous interface to performing
80
80
  * USB transfers. The main difference is that the synchronous interface
81
81
  * combines both steps indicated above into a single function call, whereas
82
82
  * the asynchronous interface separates them.
@@ -131,9 +131,9 @@ if (r == 0 && actual_length == sizeof(data)) {
131
131
  * above.
132
132
  *
133
133
  * Instead of providing which functions that block until the I/O has complete,
134
- * libusbx's asynchronous interface presents non-blocking functions which
134
+ * libusb's asynchronous interface presents non-blocking functions which
135
135
  * begin a transfer and then return immediately. Your application passes a
136
- * callback function pointer to this non-blocking function, which libusbx will
136
+ * callback function pointer to this non-blocking function, which libusb will
137
137
  * call with the results of the transaction when it has completed.
138
138
  *
139
139
  * Transfers which have been submitted through the non-blocking functions
@@ -144,12 +144,12 @@ if (r == 0 && actual_length == sizeof(data)) {
144
144
  * to use threads.
145
145
  *
146
146
  * This added flexibility does come with some complications though:
147
- * - In the interest of being a lightweight library, libusbx does not create
147
+ * - In the interest of being a lightweight library, libusb does not create
148
148
  * threads and can only operate when your application is calling into it. Your
149
- * application must call into libusbx from it's main loop when events are ready
150
- * to be handled, or you must use some other scheme to allow libusbx to
149
+ * application must call into libusb from it's main loop when events are ready
150
+ * to be handled, or you must use some other scheme to allow libusb to
151
151
  * undertake whatever work needs to be done.
152
- * - libusbx also needs to be called into at certain fixed points in time in
152
+ * - libusb also needs to be called into at certain fixed points in time in
153
153
  * order to accurately handle transfer timeouts.
154
154
  * - Memory handling becomes more complex. You cannot use stack memory unless
155
155
  * the function with that stack is guaranteed not to return until the transfer
@@ -159,7 +159,7 @@ if (r == 0 && actual_length == sizeof(data)) {
159
159
  * results are handled. This becomes particularly obvious when you want to
160
160
  * submit a second transfer based on the results of an earlier transfer.
161
161
  *
162
- * Internally, libusbx's synchronous interface is expressed in terms of function
162
+ * Internally, libusb's synchronous interface is expressed in terms of function
163
163
  * calls to the asynchronous interface.
164
164
  *
165
165
  * For details on how to use the asynchronous API, see the
@@ -176,25 +176,25 @@ if (r == 0 && actual_length == sizeof(data)) {
176
176
  * constraints on packet size defined by endpoint descriptors. The host must
177
177
  * not send data payloads larger than the endpoint's maximum packet size.
178
178
  *
179
- * libusbx and the underlying OS abstract out the packet concept, allowing you
179
+ * libusb and the underlying OS abstract out the packet concept, allowing you
180
180
  * to request transfers of any size. Internally, the request will be divided
181
181
  * up into correctly-sized packets. You do not have to be concerned with
182
182
  * packet sizes, but there is one exception when considering overflows.
183
183
  *
184
184
  * \section overflow Bulk/interrupt transfer overflows
185
185
  *
186
- * When requesting data on a bulk endpoint, libusbx requires you to supply a
187
- * buffer and the maximum number of bytes of data that libusbx can put in that
186
+ * When requesting data on a bulk endpoint, libusb requires you to supply a
187
+ * buffer and the maximum number of bytes of data that libusb can put in that
188
188
  * buffer. However, the size of the buffer is not communicated to the device -
189
189
  * the device is just asked to send any amount of data.
190
190
  *
191
191
  * There is no problem if the device sends an amount of data that is less than
192
- * or equal to the buffer size. libusbx reports this condition to you through
192
+ * or equal to the buffer size. libusb reports this condition to you through
193
193
  * the \ref libusb_transfer::actual_length "libusb_transfer.actual_length"
194
194
  * field.
195
195
  *
196
196
  * Problems may occur if the device attempts to send more data than can fit in
197
- * the buffer. libusbx reports LIBUSB_TRANSFER_OVERFLOW for this condition but
197
+ * the buffer. libusb reports LIBUSB_TRANSFER_OVERFLOW for this condition but
198
198
  * other behaviour is largely undefined: actual_length may or may not be
199
199
  * accurate, the chunk of data that can fit in the buffer (before overflow)
200
200
  * may or may not have been transferred.
@@ -212,7 +212,7 @@ if (r == 0 && actual_length == sizeof(data)) {
212
212
  /**
213
213
  * @defgroup asyncio Asynchronous device I/O
214
214
  *
215
- * This page details libusbx's asynchronous (non-blocking) API for USB device
215
+ * This page details libusb's asynchronous (non-blocking) API for USB device
216
216
  * I/O. This interface is very powerful but is also quite complex - you will
217
217
  * need to read this page carefully to understand the necessary considerations
218
218
  * and issues surrounding use of this interface. Simplistic applications
@@ -227,7 +227,7 @@ if (r == 0 && actual_length == sizeof(data)) {
227
227
  *
228
228
  * \section asyncabstraction Transfer abstraction
229
229
  *
230
- * For the asynchronous I/O, libusbx implements the concept of a generic
230
+ * For the asynchronous I/O, libusb implements the concept of a generic
231
231
  * transfer entity for all types of I/O (control, bulk, interrupt,
232
232
  * isochronous). The generic transfer object must be treated slightly
233
233
  * differently depending on which type of I/O you are performing with it.
@@ -240,7 +240,7 @@ if (r == 0 && actual_length == sizeof(data)) {
240
240
  * -# <b>Allocation</b>: allocate a libusb_transfer
241
241
  * -# <b>Filling</b>: populate the libusb_transfer instance with information
242
242
  * about the transfer you wish to perform
243
- * -# <b>Submission</b>: ask libusbx to submit the transfer
243
+ * -# <b>Submission</b>: ask libusb to submit the transfer
244
244
  * -# <b>Completion handling</b>: examine transfer results in the
245
245
  * libusb_transfer structure
246
246
  * -# <b>Deallocation</b>: clean up resources
@@ -287,7 +287,7 @@ if (r == 0 && actual_length == sizeof(data)) {
287
287
  *
288
288
  * The user-specified callback is passed a pointer to the libusb_transfer
289
289
  * structure which was used to setup and submit the transfer. At completion
290
- * time, libusbx has populated this structure with results of the transfer:
290
+ * time, libusb has populated this structure with results of the transfer:
291
291
  * success or failure reason, number of bytes of data transferred, etc. See
292
292
  * the libusb_transfer structure documentation for more information.
293
293
  *
@@ -326,7 +326,7 @@ if (r == 0 && actual_length == sizeof(data)) {
326
326
  * has completed will result in undefined behaviour.
327
327
  *
328
328
  * When a transfer is cancelled, some of the data may have been transferred.
329
- * libusbx will communicate this to you in the transfer callback. Do not assume
329
+ * libusb will communicate this to you in the transfer callback. Do not assume
330
330
  * that no data was transferred.
331
331
  *
332
332
  * \section bulk_overflows Overflows on device-to-host bulk/interrupt endpoints
@@ -468,7 +468,7 @@ if (r == 0 && actual_length == sizeof(data)) {
468
468
  *
469
469
  * In most circumstances, it is not safe to use stack memory for transfer
470
470
  * buffers. This is because the function that fired off the asynchronous
471
- * transfer may return before libusbx has finished using the buffer, and when
471
+ * transfer may return before libusb has finished using the buffer, and when
472
472
  * the function returns it's stack gets destroyed. This is true for both
473
473
  * host-to-device and device-to-host transfers.
474
474
  *
@@ -488,43 +488,43 @@ if (r == 0 && actual_length == sizeof(data)) {
488
488
  * \ref libusb_transfer_status::LIBUSB_TRANSFER_ERROR "LIBUSB_TRANSFER_ERROR"
489
489
  * (they would normally be regarded as COMPLETED)
490
490
  * - \ref libusb_transfer_flags::LIBUSB_TRANSFER_FREE_BUFFER
491
- * "LIBUSB_TRANSFER_FREE_BUFFER" allows you to ask libusbx to free the transfer
491
+ * "LIBUSB_TRANSFER_FREE_BUFFER" allows you to ask libusb to free the transfer
492
492
  * buffer when freeing the transfer.
493
493
  * - \ref libusb_transfer_flags::LIBUSB_TRANSFER_FREE_TRANSFER
494
- * "LIBUSB_TRANSFER_FREE_TRANSFER" causes libusbx to automatically free the
494
+ * "LIBUSB_TRANSFER_FREE_TRANSFER" causes libusb to automatically free the
495
495
  * transfer after the transfer callback returns.
496
496
  *
497
497
  * \section asyncevent Event handling
498
498
  *
499
- * An asynchronous model requires that libusbx perform work at various
499
+ * An asynchronous model requires that libusb perform work at various
500
500
  * points in time - namely processing the results of previously-submitted
501
501
  * transfers and invoking the user-supplied callback function.
502
502
  *
503
503
  * This gives rise to the libusb_handle_events() function which your
504
- * application must call into when libusbx has work do to. This gives libusbx
504
+ * application must call into when libusb has work do to. This gives libusb
505
505
  * the opportunity to reap pending transfers, invoke callbacks, etc.
506
506
  *
507
507
  * There are 2 different approaches to dealing with libusb_handle_events:
508
508
  *
509
509
  * -# Repeatedly call libusb_handle_events() in blocking mode from a dedicated
510
510
  * thread.
511
- * -# Integrate libusbx with your application's main event loop. libusbx
511
+ * -# Integrate libusb with your application's main event loop. libusb
512
512
  * exposes a set of file descriptors which allow you to do this.
513
513
  *
514
514
  * The first approach has the big advantage that it will also work on Windows
515
- * were libusbx' poll API for select / poll integration is not available. So
515
+ * were libusb' poll API for select / poll integration is not available. So
516
516
  * if you want to support Windows and use the async API, you must use this
517
517
  * approach, see the \ref eventthread "Using an event handling thread" section
518
518
  * below for details.
519
519
  *
520
520
  * If you prefer a single threaded approach with a single central event loop,
521
- * see the \ref poll "polling and timing" section for how to integrate libusbx
521
+ * see the \ref poll "polling and timing" section for how to integrate libusb
522
522
  * into your application's main event loop.
523
523
  *
524
524
  * \section eventthread Using an event handling thread
525
525
  *
526
526
  * Lets begin with stating the obvious: If you're going to use a separate
527
- * thread for libusbx event handling, your callback functions MUST be
527
+ * thread for libusb event handling, your callback functions MUST be
528
528
  * threadsafe.
529
529
  *
530
530
  * Other then that doing event handling from a separate thread, is mostly
@@ -545,7 +545,7 @@ void *event_thread_func(void *ctx)
545
545
  * libusb_handle_events() will not return.
546
546
  *
547
547
  * There are 2 different ways of dealing with this, depending on if your
548
- * application uses libusbx' \ref hotplug "hotplug" support or not.
548
+ * application uses libusb' \ref hotplug "hotplug" support or not.
549
549
  *
550
550
  * Applications which do not use hotplug support, should not start the event
551
551
  * thread until after their first call to libusb_open(), and should stop the
@@ -582,7 +582,7 @@ void my_libusb_exit(void)
582
582
  /**
583
583
  * @defgroup poll Polling and timing
584
584
  *
585
- * This page documents libusbx's functions for polling events and timing.
585
+ * This page documents libusb's functions for polling events and timing.
586
586
  * These functions are only necessary for users of the
587
587
  * \ref asyncio "asynchronous API". If you are only using the simpler
588
588
  * \ref syncio "synchronous API" then you do not need to ever call these
@@ -590,28 +590,28 @@ void my_libusb_exit(void)
590
590
  *
591
591
  * The justification for the functionality described here has already been
592
592
  * discussed in the \ref asyncevent "event handling" section of the
593
- * asynchronous API documentation. In summary, libusbx does not create internal
593
+ * asynchronous API documentation. In summary, libusb does not create internal
594
594
  * threads for event processing and hence relies on your application calling
595
- * into libusbx at certain points in time so that pending events can be handled.
595
+ * into libusb at certain points in time so that pending events can be handled.
596
596
  *
597
597
  * Your main loop is probably already calling poll() or select() or a
598
598
  * variant on a set of file descriptors for other event sources (e.g. keyboard
599
599
  * button presses, mouse movements, network sockets, etc). You then add
600
- * libusbx's file descriptors to your poll()/select() calls, and when activity
600
+ * libusb's file descriptors to your poll()/select() calls, and when activity
601
601
  * is detected on such descriptors you know it is time to call
602
602
  * libusb_handle_events().
603
603
  *
604
- * There is one final event handling complication. libusbx supports
604
+ * There is one final event handling complication. libusb supports
605
605
  * asynchronous transfers which time out after a specified time period.
606
606
  *
607
607
  * On some platforms a timerfd is used, so the timeout handling is just another
608
- * fd, on other platforms this requires that libusbx is called into at or after
609
- * the timeout to handle it. So, in addition to considering libusbx's file
610
- * descriptors in your main event loop, you must also consider that libusbx
608
+ * fd, on other platforms this requires that libusb is called into at or after
609
+ * the timeout to handle it. So, in addition to considering libusb's file
610
+ * descriptors in your main event loop, you must also consider that libusb
611
611
  * sometimes needs to be called into at fixed points in time even when there
612
612
  * is no file descriptor activity, see \ref polltime details.
613
613
  *
614
- * In order to know precisely when libusbx needs to be called into, libusbx
614
+ * In order to know precisely when libusb needs to be called into, libusb
615
615
  * offers you a set of pollable file descriptors and information about when
616
616
  * the next timeout expires.
617
617
  *
@@ -620,10 +620,10 @@ void my_libusb_exit(void)
620
620
  *
621
621
  * \section pollsimple The simple option
622
622
  *
623
- * If your application revolves solely around libusbx and does not need to
623
+ * If your application revolves solely around libusb and does not need to
624
624
  * handle other event sources, you can have a program structure as follows:
625
625
  \code
626
- // initialize libusbx
626
+ // initialize libusb
627
627
  // find and open device
628
628
  // maybe fire off some initial async I/O
629
629
 
@@ -646,15 +646,15 @@ while (user_has_not_requested_exit)
646
646
  *
647
647
  * In more advanced applications, you will already have a main loop which
648
648
  * is monitoring other event sources: network sockets, X11 events, mouse
649
- * movements, etc. Through exposing a set of file descriptors, libusbx is
649
+ * movements, etc. Through exposing a set of file descriptors, libusb is
650
650
  * designed to cleanly integrate into such main loops.
651
651
  *
652
652
  * In addition to polling file descriptors for the other event sources, you
653
- * take a set of file descriptors from libusbx and monitor those too. When you
654
- * detect activity on libusbx's file descriptors, you call
653
+ * take a set of file descriptors from libusb and monitor those too. When you
654
+ * detect activity on libusb's file descriptors, you call
655
655
  * libusb_handle_events_timeout() in non-blocking mode.
656
656
  *
657
- * What's more, libusbx may also need to handle events at specific moments in
657
+ * What's more, libusb may also need to handle events at specific moments in
658
658
  * time. No file descriptor activity is generated at these times, so your
659
659
  * own application needs to be continually aware of when the next one of these
660
660
  * moments occurs (through calling libusb_get_next_timeout()), and then it
@@ -662,25 +662,25 @@ while (user_has_not_requested_exit)
662
662
  * these moments occur. This means that you need to adjust your
663
663
  * poll()/select() timeout accordingly.
664
664
  *
665
- * libusbx provides you with a set of file descriptors to poll and expects you
665
+ * libusb provides you with a set of file descriptors to poll and expects you
666
666
  * to poll all of them, treating them as a single entity. The meaning of each
667
667
  * file descriptor in the set is an internal implementation detail,
668
668
  * platform-dependent and may vary from release to release. Don't try and
669
- * interpret the meaning of the file descriptors, just do as libusbx indicates,
669
+ * interpret the meaning of the file descriptors, just do as libusb indicates,
670
670
  * polling all of them at once.
671
671
  *
672
672
  * In pseudo-code, you want something that looks like:
673
673
  \code
674
- // initialise libusbx
674
+ // initialise libusb
675
675
 
676
676
  libusb_get_pollfds(ctx)
677
677
  while (user has not requested application exit) {
678
678
  libusb_get_next_timeout(ctx);
679
- poll(on libusbx file descriptors plus any other event sources of interest,
680
- using a timeout no larger than the value libusbx just suggested)
681
- if (poll() indicated activity on libusbx file descriptors)
679
+ poll(on libusb file descriptors plus any other event sources of interest,
680
+ using a timeout no larger than the value libusb just suggested)
681
+ if (poll() indicated activity on libusb file descriptors)
682
682
  libusb_handle_events_timeout(ctx, &zero_tv);
683
- if (time has elapsed to or beyond the libusbx timeout)
683
+ if (time has elapsed to or beyond the libusb timeout)
684
684
  libusb_handle_events_timeout(ctx, &zero_tv);
685
685
  // handle events from other sources here
686
686
  }
@@ -690,7 +690,7 @@ while (user has not requested application exit) {
690
690
  *
691
691
  * \subsection polltime Notes on time-based events
692
692
  *
693
- * The above complication with having to track time and call into libusbx at
693
+ * The above complication with having to track time and call into libusb at
694
694
  * specific moments is a bit of a headache. For maximum compatibility, you do
695
695
  * need to write your main loop as above, but you may decide that you can
696
696
  * restrict the supported platforms of your application and get away with
@@ -702,18 +702,18 @@ while (user has not requested application exit) {
702
702
  * - Linux, provided that the following version requirements are satisfied:
703
703
  * - Linux v2.6.27 or newer, compiled with timerfd support
704
704
  * - glibc v2.9 or newer
705
- * - libusbx v1.0.5 or newer
705
+ * - libusb v1.0.5 or newer
706
706
  *
707
707
  * Under these configurations, libusb_get_next_timeout() will \em always return
708
708
  * 0, so your main loop can be simplified to:
709
709
  \code
710
- // initialise libusbx
710
+ // initialise libusb
711
711
 
712
712
  libusb_get_pollfds(ctx)
713
713
  while (user has not requested application exit) {
714
- poll(on libusbx file descriptors plus any other event sources of interest,
714
+ poll(on libusb file descriptors plus any other event sources of interest,
715
715
  using any timeout that you like)
716
- if (poll() indicated activity on libusbx file descriptors)
716
+ if (poll() indicated activity on libusb file descriptors)
717
717
  libusb_handle_events_timeout(ctx, &zero_tv);
718
718
  // handle events from other sources here
719
719
  }
@@ -723,20 +723,20 @@ while (user has not requested application exit) {
723
723
  *
724
724
  * Do remember that if you simplify your main loop to the above, you will
725
725
  * lose compatibility with some platforms (including legacy Linux platforms,
726
- * and <em>any future platforms supported by libusbx which may have time-based
726
+ * and <em>any future platforms supported by libusb which may have time-based
727
727
  * event requirements</em>). The resultant problems will likely appear as
728
728
  * strange bugs in your application.
729
729
  *
730
730
  * You can use the libusb_pollfds_handle_timeouts() function to do a runtime
731
731
  * check to see if it is safe to ignore the time-based event complications.
732
- * If your application has taken the shortcut of ignoring libusbx's next timeout
732
+ * If your application has taken the shortcut of ignoring libusb's next timeout
733
733
  * in your main loop, then you are advised to check the return value of
734
734
  * libusb_pollfds_handle_timeouts() during application startup, and to abort
735
735
  * if the platform does suffer from these timing complications.
736
736
  *
737
737
  * \subsection fdsetchange Changes in the file descriptor set
738
738
  *
739
- * The set of file descriptors that libusbx uses as event sources may change
739
+ * The set of file descriptors that libusb uses as event sources may change
740
740
  * during the life of your application. Rather than having to repeatedly
741
741
  * call libusb_get_pollfds(), you can set up notification functions for when
742
742
  * the file descriptor set changes using libusb_set_pollfd_notifiers().
@@ -757,10 +757,10 @@ while (user has not requested application exit) {
757
757
 
758
758
  /** \page mtasync Multi-threaded applications and asynchronous I/O
759
759
  *
760
- * libusbx is a thread-safe library, but extra considerations must be applied
761
- * to applications which interact with libusbx from multiple threads.
760
+ * libusb is a thread-safe library, but extra considerations must be applied
761
+ * to applications which interact with libusb from multiple threads.
762
762
  *
763
- * The underlying issue that must be addressed is that all libusbx I/O
763
+ * The underlying issue that must be addressed is that all libusb I/O
764
764
  * revolves around monitoring file descriptors through the poll()/select()
765
765
  * system calls. This is directly exposed at the
766
766
  * \ref asyncio "asynchronous interface" but it is important to note that the
@@ -768,13 +768,13 @@ while (user has not requested application exit) {
768
768
  * asynchonrous interface, therefore the same considerations apply.
769
769
  *
770
770
  * The issue is that if two or more threads are concurrently calling poll()
771
- * or select() on libusbx's file descriptors then only one of those threads
771
+ * or select() on libusb's file descriptors then only one of those threads
772
772
  * will be woken up when an event arrives. The others will be completely
773
773
  * oblivious that anything has happened.
774
774
  *
775
775
  * Consider the following pseudo-code, which submits an asynchronous transfer
776
776
  * then waits for its completion. This style is one way you could implement a
777
- * synchronous interface on top of the asynchronous interface (and libusbx
777
+ * synchronous interface on top of the asynchronous interface (and libusb
778
778
  * does something similar, albeit more advanced due to the complications
779
779
  * explained on this page).
780
780
  *
@@ -797,7 +797,7 @@ void myfunc() {
797
797
  libusb_submit_transfer(transfer);
798
798
 
799
799
  while (!completed) {
800
- poll(libusbx file descriptors, 120*1000);
800
+ poll(libusb file descriptors, 120*1000);
801
801
  if (poll indicates activity)
802
802
  libusb_handle_events_timeout(ctx, &zero_tv);
803
803
  }
@@ -811,7 +811,7 @@ void myfunc() {
811
811
  * The poll() loop has a long timeout to minimize CPU usage during situations
812
812
  * when nothing is happening (it could reasonably be unlimited).
813
813
  *
814
- * If this is the only thread that is polling libusbx's file descriptors, there
814
+ * If this is the only thread that is polling libusb's file descriptors, there
815
815
  * is no problem: there is no danger that another thread will swallow up the
816
816
  * event that we are interested in. On the other hand, if there is another
817
817
  * thread polling the same descriptors, there is a chance that it will receive
@@ -823,13 +823,13 @@ void myfunc() {
823
823
  *
824
824
  * The solution here is to ensure that no two threads are ever polling the
825
825
  * file descriptors at the same time. A naive implementation of this would
826
- * impact the capabilities of the library, so libusbx offers the scheme
826
+ * impact the capabilities of the library, so libusb offers the scheme
827
827
  * documented below to ensure no loss of functionality.
828
828
  *
829
829
  * Before we go any further, it is worth mentioning that all libusb-wrapped
830
830
  * event handling procedures fully adhere to the scheme documented below.
831
831
  * This includes libusb_handle_events() and its variants, and all the
832
- * synchronous I/O functions - libusbx hides this headache from you.
832
+ * synchronous I/O functions - libusb hides this headache from you.
833
833
  *
834
834
  * \section Using libusb_handle_events() from multiple threads
835
835
  *
@@ -875,17 +875,17 @@ void myfunc() {
875
875
  *
876
876
  * \section eventlock The events lock
877
877
  *
878
- * The problem is when we consider the fact that libusbx exposes file
878
+ * The problem is when we consider the fact that libusb exposes file
879
879
  * descriptors to allow for you to integrate asynchronous USB I/O into
880
880
  * existing main loops, effectively allowing you to do some work behind
881
- * libusbx's back. If you do take libusbx's file descriptors and pass them to
881
+ * libusb's back. If you do take libusb's file descriptors and pass them to
882
882
  * poll()/select() yourself, you need to be aware of the associated issues.
883
883
  *
884
884
  * The first concept to be introduced is the events lock. The events lock
885
885
  * is used to serialize threads that want to handle events, such that only
886
886
  * one thread is handling events at any one time.
887
887
  *
888
- * You must take the events lock before polling libusbx file descriptors,
888
+ * You must take the events lock before polling libusb file descriptors,
889
889
  * using libusb_lock_events(). You must release the lock as soon as you have
890
890
  * aborted your poll()/select() loop, using libusb_unlock_events().
891
891
  *
@@ -896,7 +896,7 @@ void myfunc() {
896
896
  \code
897
897
  libusb_lock_events(ctx);
898
898
  while (!completed) {
899
- poll(libusbx file descriptors, 120*1000);
899
+ poll(libusb file descriptors, 120*1000);
900
900
  if (poll indicates activity)
901
901
  libusb_handle_events_timeout(ctx, &zero_tv);
902
902
  }
@@ -912,7 +912,7 @@ void myfunc() {
912
912
  * status of its transfer until the code above has finished (30 seconds later)
913
913
  * due to contention on the lock.
914
914
  *
915
- * To solve this, libusbx offers you a mechanism to determine when another
915
+ * To solve this, libusb offers you a mechanism to determine when another
916
916
  * thread is handling events. It also offers a mechanism to block your thread
917
917
  * until the event handling thread has completed an event (and this mechanism
918
918
  * does not involve polling of file descriptors).
@@ -938,7 +938,7 @@ if (libusb_try_lock_events(ctx) == 0) {
938
938
  libusb_unlock_events(ctx);
939
939
  goto retry;
940
940
  }
941
- poll(libusbx file descriptors, 120*1000);
941
+ poll(libusb file descriptors, 120*1000);
942
942
  if (poll indicates activity)
943
943
  libusb_handle_events_locked(ctx, 0);
944
944
  }
@@ -984,8 +984,8 @@ printf("completed!\n");
984
984
  * should be apparent from the code shown above.
985
985
  * -# libusb_try_lock_events() is a non-blocking function which attempts
986
986
  * to acquire the events lock but returns a failure code if it is contended.
987
- * -# libusb_event_handling_ok() checks that libusbx is still happy for your
988
- * thread to be performing event handling. Sometimes, libusbx needs to
987
+ * -# libusb_event_handling_ok() checks that libusb is still happy for your
988
+ * thread to be performing event handling. Sometimes, libusb needs to
989
989
  * interrupt the event handler, and this is how you can check if you have
990
990
  * been interrupted. If this function returns 0, the correct behaviour is
991
991
  * for you to give up the event handling lock, and then to repeat the cycle.
@@ -995,12 +995,12 @@ printf("completed!\n");
995
995
  * libusb_handle_events_timeout() that you can call while holding the
996
996
  * events lock. libusb_handle_events_timeout() itself implements similar
997
997
  * logic to the above, so be sure not to call it when you are
998
- * "working behind libusbx's back", as is the case here.
998
+ * "working behind libusb's back", as is the case here.
999
999
  * -# libusb_event_handler_active() determines if someone is currently
1000
1000
  * holding the events lock
1001
1001
  *
1002
1002
  * You might be wondering why there is no function to wake up all threads
1003
- * blocked on libusb_wait_for_event(). This is because libusbx can do this
1003
+ * blocked on libusb_wait_for_event(). This is because libusb can do this
1004
1004
  * internally: it will wake up all such threads when someone calls
1005
1005
  * libusb_unlock_events() or when a transfer completes (at the point after its
1006
1006
  * callback has returned).
@@ -1009,7 +1009,7 @@ printf("completed!\n");
1009
1009
  *
1010
1010
  * The above explanation should be enough to get you going, but if you're
1011
1011
  * really thinking through the issues then you may be left with some more
1012
- * questions regarding libusbx's internals. If you're curious, read on, and if
1012
+ * questions regarding libusb's internals. If you're curious, read on, and if
1013
1013
  * not, skip to the next section to avoid confusing yourself!
1014
1014
  *
1015
1015
  * The immediate question that may spring to mind is: what if one thread
@@ -1024,14 +1024,14 @@ printf("completed!\n");
1024
1024
  * are all kinds of race conditions that could arise here, so it is
1025
1025
  * important that nobody is doing event handling at this time.
1026
1026
  *
1027
- * libusbx handles these issues internally, so application developers do not
1027
+ * libusb handles these issues internally, so application developers do not
1028
1028
  * have to stop their event handlers while opening/closing devices. Here's how
1029
1029
  * it works, focusing on the libusb_close() situation first:
1030
1030
  *
1031
- * -# During initialization, libusbx opens an internal pipe, and it adds the read
1031
+ * -# During initialization, libusb opens an internal pipe, and it adds the read
1032
1032
  * end of this pipe to the set of file descriptors to be polled.
1033
- * -# During libusb_close(), libusbx writes some dummy data on this control pipe.
1034
- * This immediately interrupts the event handler. libusbx also records
1033
+ * -# During libusb_close(), libusb writes some dummy data on this control pipe.
1034
+ * This immediately interrupts the event handler. libusb also records
1035
1035
  * internally that it is trying to interrupt event handlers for this
1036
1036
  * high-priority event.
1037
1037
  * -# At this point, some of the functions described above start behaving
@@ -1046,7 +1046,7 @@ printf("completed!\n");
1046
1046
  * giving up the events lock very quickly, giving the high-priority
1047
1047
  * libusb_close() operation a "free ride" to acquire the events lock. All
1048
1048
  * threads that are competing to do event handling become event waiters.
1049
- * -# With the events lock held inside libusb_close(), libusbx can safely remove
1049
+ * -# With the events lock held inside libusb_close(), libusb can safely remove
1050
1050
  * a file descriptor from the poll set, in the safety of knowledge that
1051
1051
  * nobody is polling those descriptors or trying to access the poll set.
1052
1052
  * -# After obtaining the events lock, the close operation completes very
@@ -1063,7 +1063,7 @@ printf("completed!\n");
1063
1063
  * call to libusb_open():
1064
1064
  *
1065
1065
  * -# The device is opened and a file descriptor is added to the poll set.
1066
- * -# libusbx sends some dummy data on the control pipe, and records that it
1066
+ * -# libusb sends some dummy data on the control pipe, and records that it
1067
1067
  * is trying to modify the poll descriptor set.
1068
1068
  * -# The event handler is interrupted, and the same behaviour change as for
1069
1069
  * libusb_close() takes effect, causing all event handling threads to become
@@ -1079,7 +1079,7 @@ printf("completed!\n");
1079
1079
  *
1080
1080
  * The above may seem a little complicated, but hopefully I have made it clear
1081
1081
  * why such complications are necessary. Also, do not forget that this only
1082
- * applies to applications that take libusbx's file descriptors and integrate
1082
+ * applies to applications that take libusb's file descriptors and integrate
1083
1083
  * them into their own polling loops.
1084
1084
  *
1085
1085
  * You may decide that it is OK for your multi-threaded application to ignore
@@ -1291,7 +1291,7 @@ out:
1291
1291
  }
1292
1292
 
1293
1293
  /** \ingroup asyncio
1294
- * Allocate a libusbx transfer with a specified number of isochronous packet
1294
+ * Allocate a libusb transfer with a specified number of isochronous packet
1295
1295
  * descriptors. The returned transfer is pre-initialized for you. When the new
1296
1296
  * transfer is no longer needed, it should be freed with
1297
1297
  * libusb_free_transfer().
@@ -1589,11 +1589,11 @@ int usbi_handle_transfer_cancellation(struct usbi_transfer *transfer)
1589
1589
 
1590
1590
  /** \ingroup poll
1591
1591
  * Attempt to acquire the event handling lock. This lock is used to ensure that
1592
- * only one thread is monitoring libusbx event sources at any one time.
1592
+ * only one thread is monitoring libusb event sources at any one time.
1593
1593
  *
1594
1594
  * You only need to use this lock if you are developing an application
1595
- * which calls poll() or select() on libusbx's file descriptors directly.
1596
- * If you stick to libusbx's event handling loop functions (e.g.
1595
+ * which calls poll() or select() on libusb's file descriptors directly.
1596
+ * If you stick to libusb's event handling loop functions (e.g.
1597
1597
  * libusb_handle_events()) then you do not need to be concerned with this
1598
1598
  * locking.
1599
1599
  *
@@ -1633,11 +1633,11 @@ int API_EXPORTED libusb_try_lock_events(libusb_context *ctx)
1633
1633
  /** \ingroup poll
1634
1634
  * Acquire the event handling lock, blocking until successful acquisition if
1635
1635
  * it is contended. This lock is used to ensure that only one thread is
1636
- * monitoring libusbx event sources at any one time.
1636
+ * monitoring libusb event sources at any one time.
1637
1637
  *
1638
1638
  * You only need to use this lock if you are developing an application
1639
- * which calls poll() or select() on libusbx's file descriptors directly.
1640
- * If you stick to libusbx's event handling loop functions (e.g.
1639
+ * which calls poll() or select() on libusb's file descriptors directly.
1640
+ * If you stick to libusb's event handling loop functions (e.g.
1641
1641
  * libusb_handle_events()) then you do not need to be concerned with this
1642
1642
  * locking.
1643
1643
  *
@@ -1680,7 +1680,7 @@ void API_EXPORTED libusb_unlock_events(libusb_context *ctx)
1680
1680
  /** \ingroup poll
1681
1681
  * Determine if it is still OK for this thread to be doing event handling.
1682
1682
  *
1683
- * Sometimes, libusbx needs to temporarily pause all event handlers, and this
1683
+ * Sometimes, libusb needs to temporarily pause all event handlers, and this
1684
1684
  * is the function you should use before polling file descriptors to see if
1685
1685
  * this is the case.
1686
1686
  *
@@ -1754,9 +1754,9 @@ int API_EXPORTED libusb_event_handler_active(libusb_context *ctx)
1754
1754
  * events, then call libusb_wait_for_event().
1755
1755
  *
1756
1756
  * You only need to use this lock if you are developing an application
1757
- * which calls poll() or select() on libusbx's file descriptors directly,
1757
+ * which calls poll() or select() on libusb's file descriptors directly,
1758
1758
  * <b>and</b> may potentially be handling events from 2 threads simultaenously.
1759
- * If you stick to libusbx's event handling loop functions (e.g.
1759
+ * If you stick to libusb's event handling loop functions (e.g.
1760
1760
  * libusb_handle_events()) then you do not need to be concerned with this
1761
1761
  * locking.
1762
1762
  *
@@ -1930,6 +1930,7 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
1930
1930
  struct pollfd *fds = NULL;
1931
1931
  int i = -1;
1932
1932
  int timeout_ms;
1933
+ int special_event;
1933
1934
 
1934
1935
  usbi_mutex_lock(&ctx->pollfds_lock);
1935
1936
  list_for_each_entry(ipollfd, &ctx->pollfds, list, struct usbi_pollfd)
@@ -1959,6 +1960,7 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
1959
1960
  if (tv->tv_usec % 1000)
1960
1961
  timeout_ms++;
1961
1962
 
1963
+ redo_poll:
1962
1964
  usbi_dbg("poll() %d fds with timeout in %dms", nfds, timeout_ms);
1963
1965
  r = usbi_poll(fds, nfds, timeout_ms);
1964
1966
  usbi_dbg("poll() returned %d", r);
@@ -1974,6 +1976,8 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
1974
1976
  return LIBUSB_ERROR_IO;
1975
1977
  }
1976
1978
 
1979
+ special_event = 0;
1980
+
1977
1981
  /* fd[0] is always the ctrl pipe */
1978
1982
  if (fds[0].revents) {
1979
1983
  /* another thread wanted to interrupt event handling, and it succeeded!
@@ -1997,6 +2001,7 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
1997
2001
  ssize_t ret;
1998
2002
 
1999
2003
  usbi_dbg("caught a fish on the hotplug pipe");
2004
+ special_event = 1;
2000
2005
 
2001
2006
  /* read the message from the hotplug thread */
2002
2007
  ret = usbi_read(ctx->hotplug_pipe[0], &message, sizeof (message));
@@ -2024,6 +2029,7 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
2024
2029
  /* timerfd indicates that a timeout has expired */
2025
2030
  int ret;
2026
2031
  usbi_dbg("timerfd triggered");
2032
+ special_event = 1;
2027
2033
 
2028
2034
  ret = handle_timerfd_trigger(ctx);
2029
2035
  if (ret < 0) {
@@ -2048,6 +2054,11 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
2048
2054
  usbi_err(ctx, "backend handle_events failed with error %d", r);
2049
2055
 
2050
2056
  handled:
2057
+ if (r == 0 && special_event) {
2058
+ timeout_ms = 0;
2059
+ goto redo_poll;
2060
+ }
2061
+
2051
2062
  free(fds);
2052
2063
  return r;
2053
2064
  }
@@ -2082,7 +2093,7 @@ static int get_next_timeout(libusb_context *ctx, struct timeval *tv,
2082
2093
  /** \ingroup poll
2083
2094
  * Handle any pending events.
2084
2095
  *
2085
- * libusbx determines "pending events" by checking if any timeouts have expired
2096
+ * libusb determines "pending events" by checking if any timeouts have expired
2086
2097
  * and by checking the set of file descriptors for activity.
2087
2098
  *
2088
2099
  * If a zero timeval is passed, this function will handle any already-pending
@@ -2231,9 +2242,9 @@ int API_EXPORTED libusb_handle_events_completed(libusb_context *ctx,
2231
2242
  * held, see libusb_lock_events().
2232
2243
  *
2233
2244
  * This function is designed to be called under the situation where you have
2234
- * taken the event lock and are calling poll()/select() directly on libusbx's
2245
+ * taken the event lock and are calling poll()/select() directly on libusb's
2235
2246
  * file descriptors (as opposed to using libusb_handle_events() or similar).
2236
- * You detect events on libusbx's descriptors, so you then call this function
2247
+ * You detect events on libusb's descriptors, so you then call this function
2237
2248
  * with a zero timeout value (while still holding the event lock).
2238
2249
  *
2239
2250
  * \param ctx the context to operate on, or NULL for the default context
@@ -2260,19 +2271,19 @@ int API_EXPORTED libusb_handle_events_locked(libusb_context *ctx,
2260
2271
 
2261
2272
  /** \ingroup poll
2262
2273
  * Determines whether your application must apply special timing considerations
2263
- * when monitoring libusbx's file descriptors.
2274
+ * when monitoring libusb's file descriptors.
2264
2275
  *
2265
2276
  * This function is only useful for applications which retrieve and poll
2266
- * libusbx's file descriptors in their own main loop (\ref pollmain).
2277
+ * libusb's file descriptors in their own main loop (\ref pollmain).
2267
2278
  *
2268
- * Ordinarily, libusbx's event handler needs to be called into at specific
2279
+ * Ordinarily, libusb's event handler needs to be called into at specific
2269
2280
  * moments in time (in addition to times when there is activity on the file
2270
2281
  * descriptor set). The usual approach is to use libusb_get_next_timeout()
2271
2282
  * to learn about when the next timeout occurs, and to adjust your
2272
2283
  * poll()/select() timeout accordingly so that you can make a call into the
2273
2284
  * library at that time.
2274
2285
  *
2275
- * Some platforms supported by libusbx do not come with this baggage - any
2286
+ * Some platforms supported by libusb do not come with this baggage - any
2276
2287
  * events relevant to timing will be represented by activity on the file
2277
2288
  * descriptor set, and libusb_get_next_timeout() will always return 0.
2278
2289
  * This function allows you to detect whether you are running on such a
@@ -2281,10 +2292,10 @@ int API_EXPORTED libusb_handle_events_locked(libusb_context *ctx,
2281
2292
  * Since v1.0.5.
2282
2293
  *
2283
2294
  * \param ctx the context to operate on, or NULL for the default context
2284
- * \returns 0 if you must call into libusbx at times determined by
2295
+ * \returns 0 if you must call into libusb at times determined by
2285
2296
  * libusb_get_next_timeout(), or 1 if all timeout events are handled internally
2286
2297
  * or through regular activity on the file descriptors.
2287
- * \see \ref pollmain "Polling libusbx file descriptors for event handling"
2298
+ * \see \ref pollmain "Polling libusb file descriptors for event handling"
2288
2299
  */
2289
2300
  int API_EXPORTED libusb_pollfds_handle_timeouts(libusb_context *ctx)
2290
2301
  {
@@ -2298,21 +2309,21 @@ int API_EXPORTED libusb_pollfds_handle_timeouts(libusb_context *ctx)
2298
2309
  }
2299
2310
 
2300
2311
  /** \ingroup poll
2301
- * Determine the next internal timeout that libusbx needs to handle. You only
2312
+ * Determine the next internal timeout that libusb needs to handle. You only
2302
2313
  * need to use this function if you are calling poll() or select() or similar
2303
- * on libusbx's file descriptors yourself - you do not need to use it if you
2314
+ * on libusb's file descriptors yourself - you do not need to use it if you
2304
2315
  * are calling libusb_handle_events() or a variant directly.
2305
2316
  *
2306
2317
  * You should call this function in your main loop in order to determine how
2307
- * long to wait for select() or poll() to return results. libusbx needs to be
2318
+ * long to wait for select() or poll() to return results. libusb needs to be
2308
2319
  * called into at this timeout, so you should use it as an upper bound on
2309
2320
  * your select() or poll() call.
2310
2321
  *
2311
2322
  * When the timeout has expired, call into libusb_handle_events_timeout()
2312
- * (perhaps in non-blocking mode) so that libusbx can handle the timeout.
2323
+ * (perhaps in non-blocking mode) so that libusb can handle the timeout.
2313
2324
  *
2314
2325
  * This function may return 1 (success) and an all-zero timeval. If this is
2315
- * the case, it indicates that libusbx has a timeout that has already expired
2326
+ * the case, it indicates that libusb has a timeout that has already expired
2316
2327
  * so you should call libusb_handle_events_timeout() or similar immediately.
2317
2328
  * A return code of 0 indicates that there are no pending timeouts.
2318
2329
  *
@@ -2321,7 +2332,7 @@ int API_EXPORTED libusb_pollfds_handle_timeouts(libusb_context *ctx)
2321
2332
  *
2322
2333
  * \param ctx the context to operate on, or NULL for the default context
2323
2334
  * \param tv output location for a relative time against the current
2324
- * clock in which libusbx must be called into in order to process timeout events
2335
+ * clock in which libusb must be called into in order to process timeout events
2325
2336
  * \returns 0 if there are no pending timeouts, 1 if a timeout was returned,
2326
2337
  * or LIBUSB_ERROR_OTHER on failure
2327
2338
  */
@@ -2388,7 +2399,7 @@ int API_EXPORTED libusb_get_next_timeout(libusb_context *ctx,
2388
2399
  /** \ingroup poll
2389
2400
  * Register notification functions for file descriptor additions/removals.
2390
2401
  * These functions will be invoked for every new or removed file descriptor
2391
- * that libusbx uses as an event source.
2402
+ * that libusb uses as an event source.
2392
2403
  *
2393
2404
  * To remove notifiers, pass NULL values for the function pointers.
2394
2405
  *
@@ -2466,7 +2477,7 @@ void usbi_remove_pollfd(struct libusb_context *ctx, int fd)
2466
2477
 
2467
2478
  /** \ingroup poll
2468
2479
  * Retrieve a list of file descriptors that should be polled by your main loop
2469
- * as libusbx event sources.
2480
+ * as libusb event sources.
2470
2481
  *
2471
2482
  * The returned list is NULL-terminated and should be freed with free() when
2472
2483
  * done. The actual list contents must not be touched.
@@ -2506,7 +2517,7 @@ out:
2506
2517
  usbi_mutex_unlock(&ctx->pollfds_lock);
2507
2518
  return (const struct libusb_pollfd **) ret;
2508
2519
  #else
2509
- usbi_err(ctx, "external polling of libusbx's internal descriptors "\
2520
+ usbi_err(ctx, "external polling of libusb's internal descriptors "\
2510
2521
  "is not yet supported on Windows platforms");
2511
2522
  return NULL;
2512
2523
  #endif