View | Details | Raw Unified | Return to bug 159898
Collapse All | Expand All

(-)libusb.3 (-64 / +70 lines)
Lines 33-39 Link Here
33
.Nm libusb
33
.Nm libusb
34
.Nd "USB access library"
34
.Nd "USB access library"
35
.Sh LIBRARY
35
.Sh LIBRARY
36
USB access library (libusb -lusb)
36
USB access library
37
.Pq libusb, -lusb
37
.Sh SYNOPSIS
38
.Sh SYNOPSIS
38
.In libusb.h
39
.In libusb.h
39
.Sh DESCRIPTION
40
.Sh DESCRIPTION
Lines 46-53 Link Here
46
.Ft int
47
.Ft int
47
.Fn libusb_init libusb_context **ctx
48
.Fn libusb_init libusb_context **ctx
48
This function initialises libusb.
49
This function initialises libusb.
49
Must be called at the beginning
50
It must be called at the beginning
50
of the program.
51
of the program, before other libusb routines are used.
51
This function returns 0 on success or LIBUSB_ERROR on
52
This function returns 0 on success or LIBUSB_ERROR on
52
failure.
53
failure.
53
.Pp
54
.Pp
Lines 55-89 Link Here
55
.Fn libusb_exit "libusb_context *ctx"
56
.Fn libusb_exit "libusb_context *ctx"
56
Deinitialise libusb.
57
Deinitialise libusb.
57
Must be called at the end of the application.
58
Must be called at the end of the application.
59
Other libusb routines may not be called after this function.
58
.Pp
60
.Pp
59
.Ft const char *
61
.Ft const char *
60
.Fn libusb_strerror "int code"
62
.Fn libusb_strerror "int code"
61
Get ASCII representation of the error given by the
63
Get the ASCII representation of the error given by the
62
.Fa code
64
.Fa code
63
argument.
65
argument.
64
.Pp
66
.Pp
65
.Ft void
67
.Ft void
66
.Fn libusb_set_debug "libusb_context *ctx" "int level"
68
.Fn libusb_set_debug "libusb_context *ctx" "int level"
67
Set debug to the
69
Set the debug level to
68
.Fa level
70
.Fa level .
69
level.
70
.Pp
71
.Pp
71
.Ft ssize_t
72
.Ft ssize_t
72
.Fn libusb_get_device_list "libusb_context *ctx" "libusb_device ***list"
73
.Fn libusb_get_device_list "libusb_context *ctx" "libusb_device ***list"
73
Fill into
74
Populate
74
.Fa list
75
.Fa list
75
the list of usb device available.
76
with the list of usb devices available, adding a reference to each
76
All the device created by this
77
device in the list.
77
function must be unref and free when you are done with them.
78
All the list entries created by this
79
function must have their reference counter
80
decremented when you are done with them,
81
and the list itself must be freed.
78
This
82
This
79
function returns the number of devices in list or a LIBUSB_ERROR code.
83
function returns the number of devices in the list or a LIBUSB_ERROR code.
80
.Pp
84
.Pp
81
.Ft void
85
.Ft void
82
.Fn libusb_free_device_list "libusb_device **list" "int unref_devices"
86
.Fn libusb_free_device_list "libusb_device **list" "int unref_devices"
83
Free the list of devices discovered by libusb_get_device_list.
87
Free the list of devices discovered by libusb_get_device_list.
84
If
88
If
85
.Fa unref_device
89
.Fa unref_device
86
is set to 1 all devices are unref one time.
90
is set to 1 all devices in the list have their reference
91
counter decremented once.
87
.Pp
92
.Pp
88
.Ft uint8_t
93
.Ft uint8_t
89
.Fn libusb_get_bus_number "libusb_device *dev"
94
.Fn libusb_get_bus_number "libusb_device *dev"
Lines 120-132 Link Here
120
.Fn libusb_open "libusb_device *dev" "libusb_device_handle **devh"
125
.Fn libusb_open "libusb_device *dev" "libusb_device_handle **devh"
121
Open a device and obtain a device_handle.
126
Open a device and obtain a device_handle.
122
Returns 0 on success,
127
Returns 0 on success,
123
LIBUSB_ERROR_NO_MEM on memory allocation problem, LIBUSB_ERROR_ACCESS
128
LIBUSB_ERROR_NO_MEM on memory allocation problems, LIBUSB_ERROR_ACCESS
124
on permission problem, LIBUSB_ERROR_NO_DEVICE if the device has been
129
on permissions problems, LIBUSB_ERROR_NO_DEVICE if the device has been
125
disconnected and a LIBUSB_ERROR code on error.
130
disconnected and a LIBUSB_ERROR code on other errors.
126
.Pp
131
.Pp
127
.Ft libusb_device_handle *
132
.Ft libusb_device_handle *
128
.Fn libusb_open_device_with_vid_pid "libusb_context *ctx" "uint16_t vid" "uint16_t pid"
133
.Fn libusb_open_device_with_vid_pid "libusb_context *ctx" "uint16_t vid" "uint16_t pid"
129
Convenience function to open a device with is
134
A convenience function to open a device with vendor and producd IDs
130
.Fa vid
135
.Fa vid
131
and
136
and
132
.Fa pid.
137
.Fa pid.
Lines 150-156 Link Here
150
.Pp
155
.Pp
151
.Ft int
156
.Ft int
152
.Fn libusb_set_configuration "libusb_device_handle *devh" "int config"
157
.Fn libusb_set_configuration "libusb_device_handle *devh" "int config"
153
Set the active configuration
158
Set the active configuration to
154
.Fa config
159
.Fa config
155
for the device contained by
160
for the device contained by
156
.Fa devh.
161
.Fa devh.
Lines 164-179 Link Here
164
Claim an interface in a given libusb_handle
169
Claim an interface in a given libusb_handle
165
.Fa devh.
170
.Fa devh.
166
This is a non-blocking function.
171
This is a non-blocking function.
167
It returns 0 success, LIBUSB_ERROR_NOT_FOUND
172
It returns 0 on success, LIBUSB_ERROR_NOT_FOUND
168
if the requested interface does not exist, LIBUSB_ERROR_BUSY if a program or
173
if the requested interface does not exist, LIBUSB_ERROR_BUSY if a program or
169
driver has claimed the interface, LIBUSB_ERROR_NO_DEVICE if the device has
174
driver has claimed the interface, LIBUSB_ERROR_NO_DEVICE if the device has
170
been disconnected and a LIBUSB_ERROR code on failure.
175
been disconnected and a LIBUSB_ERROR code on failure.
171
.Pp
176
.Pp
172
.Ft int
177
.Ft int
173
.Fn libusb_release_interface "libusb_device_handle *devh" "int interface_number"
178
.Fn libusb_release_interface "libusb_device_handle *devh" "int interface_number"
174
This function release an interface.
179
This function releases an interface.
175
All the claimed interface must be released
180
All the claimed interfaces on a device must be released
176
before closing a device.
181
before closing the device.
177
Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the
182
Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the
178
interface was not claimed, LIBUSB_ERROR_NO_DEVICE if the device has been
183
interface was not claimed, LIBUSB_ERROR_NO_DEVICE if the device has been
179
disconnected and LIBUSB_ERROR on failure.
184
disconnected and LIBUSB_ERROR on failure.
Lines 184-190 Link Here
184
Returns 0 on success,
189
Returns 0 on success,
185
LIBUSB_ERROR_NOT_FOUND if the interface was not claimed or the requested
190
LIBUSB_ERROR_NOT_FOUND if the interface was not claimed or the requested
186
setting does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been
191
setting does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been
187
disconnected and LIBUSB_ERROR code on failure.
192
disconnected and a LIBUSB_ERROR code on failure.
188
.Pp
193
.Pp
189
.Ft int
194
.Ft int
190
.Fn libusb_clear_halt "libusb_device_handle *devh" "unsigned char endpoint"
195
.Fn libusb_clear_halt "libusb_device_handle *devh" "unsigned char endpoint"
Lines 202-232 Link Here
202
.Pp
207
.Pp
203
.Ft int
208
.Ft int
204
.Fn libusb_check_connected "libusb_device_handle *devh"
209
.Fn libusb_check_connected "libusb_device_handle *devh"
205
Test if USB device is still connected.
210
Test if the USB device is still connected.
206
Returns 0 on success,
211
Returns 0 on success,
207
LIBUSB_ERROR_NO_DEVICE if has been disconnected and a LIBUSB_ERROR
212
LIBUSB_ERROR_NO_DEVICE if it has been disconnected and a LIBUSB_ERROR
208
code on failure.
213
code on failure.
209
.Pp
214
.Pp
210
.Ft int
215
.Ft int
211
.Fn libusb_kernel_driver_active "libusb_device_handle *devh" "int interface"
216
.Fn libusb_kernel_driver_active "libusb_device_handle *devh" "int interface"
212
Determine if a driver is active on a interface.
217
Determine if a driver is active on a interface.
213
Returns 0 if no kernel driver
218
Returns 0 if no kernel driver
214
is active, returns 1 if a kernel driver is active,
219
is active, 1 if a kernel driver is active, LIBUSB_ERROR_NO_DEVICE
215
returns LIBUSB_ERROR_NO_DEVICE
220
if the device has been disconnected and a LIBUSB_ERROR code on failure.
216
if the device has been disconnected and returns a LIBUSB_ERROR code on failure.
217
.Pp
221
.Pp
218
.Ft int
222
.Ft int
219
.Fn libusb_get_driver "libusb_device_handle *devh" "int interface" "char *name" "int namelen"
223
.Fn libusb_get_driver "libusb_device_handle *devh" "int interface" "char *name" "int namelen"
220
or
224
or
221
.Ft int
225
.Ft int
222
.Fn libusb_get_driver_np "libusb_device_handle *devh" "int interface" "char *name" "int namelen"
226
.Fn libusb_get_driver_np "libusb_device_handle *devh" "int interface" "char *name" "int namelen"
223
Gets the name of the driver attached to the given
227
Copy the name of the driver attached to the given
224
.Fa device
228
.Fa device
225
and
229
and
226
.Fa interface
230
.Fa interface
227
into the buffer given by
231
into the buffer
228
.Fa name
232
.Fa name
229
and
233
of length
230
.Fa namelen .
234
.Fa namelen .
231
Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver is attached
235
Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver is attached
232
to the given interface and LIBUSB_ERROR_INVALID_PARAM if the interface does
236
to the given interface and LIBUSB_ERROR_INVALID_PARAM if the interface does
Lines 242-248 Link Here
242
.Ft int
246
.Ft int
243
.Fn libusb_detach_kernel_driver_np "libusb_device_handle *devh" "int interface"
247
.Fn libusb_detach_kernel_driver_np "libusb_device_handle *devh" "int interface"
244
Detach a kernel driver from an interface.
248
Detach a kernel driver from an interface.
245
This is needed to claim an interface required by a kernel driver.
249
This is needed to claim an interface already claimed by a kernel driver.
246
Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver was active,
250
Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver was active,
247
LIBUSB_ERROR_INVALID_PARAM if the interface does not exist,
251
LIBUSB_ERROR_INVALID_PARAM if the interface does not exist,
248
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
252
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
Lines 251-261 Link Here
251
.Pp
255
.Pp
252
.Ft int
256
.Ft int
253
.Fn libusb_attach_kernel_driver "libusb_device_handle *devh" "int interface"
257
.Fn libusb_attach_kernel_driver "libusb_device_handle *devh" "int interface"
254
Re-attach an interface kernel driver previously detached.
258
Re-attach an interface kernel driver that was previously detached.
255
Returns 0 on success,
259
Returns 0 on success,
256
LIBUSB_ERROR_INVALID_PARAM if the interface does not exist,
260
LIBUSB_ERROR_INVALID_PARAM if the interface does not exist,
257
LIBUSB_ERROR_NO_DEVICE
261
LIBUSB_ERROR_NO_DEVICE
258
if the device has been disconnect, LIBUSB_ERROR_BUSY if the driver cannot be
262
if the device has been disconnected, LIBUSB_ERROR_BUSY if the driver cannot be
259
attached because the interface is claimed by a program or driver and a
263
attached because the interface is claimed by a program or driver and a
260
LIBUSB_ERROR code on failure.
264
LIBUSB_ERROR code on failure.
261
.Pp
265
.Pp
Lines 273-296 Link Here
273
.Fn libsub_get_active_config_descriptor "libusb_device *dev" "struct libusb_config_descriptor **config"
277
.Fn libsub_get_active_config_descriptor "libusb_device *dev" "struct libusb_config_descriptor **config"
274
Get the USB configuration descriptor for the active configuration.
278
Get the USB configuration descriptor for the active configuration.
275
Returns 0 on
279
Returns 0 on
276
success, returns LIBUSB_ERROR_NOT_FOUND if the device is in unconfigured state
280
success, LIBUSB_ERROR_NOT_FOUND if the device is in
277
and returns another LIBUSB_ERROR code on error.
281
an unconfigured state
282
and a LIBUSB_ERROR code on error.
278
.Pp
283
.Pp
279
.Ft int
284
.Ft int
280
.Fn libusb_get_config_descriptor "libusb_device *dev" "uint8_t config_index" "libusb_config_descriptor **config"
285
.Fn libusb_get_config_descriptor "libusb_device *dev" "uint8_t config_index" "libusb_config_descriptor **config"
281
Get USB configuration descriptor based on its index
286
Get a USB configuration descriptor based on its index
282
.Fa idx.
287
.Fa idx.
283
Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the configuration does not exist
288
Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the configuration does not exist
284
and returns another LIBUSB_ERROR code on error.
289
and a LIBUSB_ERROR code on error.
285
.Pp
290
.Pp
286
.Ft int
291
.Ft int
287
.Fn libusb_get_config_descriptor_by_value "libusb_device *dev" "uint8 bConfigurationValue" "libusb_config_descriptor **config"
292
.Fn libusb_get_config_descriptor_by_value "libusb_device *dev" "uint8 bConfigurationValue" "libusb_config_descriptor **config"
288
Get a USB configuration descriptor with a specific bConfigurationValue.
293
Get a USB configuration descriptor with a specific bConfigurationValue.
289
This is
294
This is
290
a non-blocking function which does not send request through the device.
295
a non-blocking function which does not send a request through the device.
291
Returns 0
296
Returns 0
292
on success, LIBUSB_ERROR_NOT_FOUND if the configuration
297
on success, LIBUSB_ERROR_NOT_FOUND if the configuration
293
does not exist and another
298
does not exist and a
294
LIBUSB_ERROR code on failure.
299
LIBUSB_ERROR code on failure.
295
.Pp
300
.Pp
296
.Ft void
301
.Ft void
Lines 299-315 Link Here
299
.Pp
304
.Pp
300
.Ft int
305
.Ft int
301
.Fn libusb_get_string_descriptor_ascii "libusb_device_handle *devh" "uint8_t desc_idx" "unsigned char *data" "int length"
306
.Fn libusb_get_string_descriptor_ascii "libusb_device_handle *devh" "uint8_t desc_idx" "unsigned char *data" "int length"
302
Retrieve a string descriptor in C style ascii.
307
Retrieve a string descriptor in C style ASCII.
303
Returns a positive number of bytes in the resulting ASCII string
308
Returns the positive number of bytes in the resulting ASCII string
304
on success and a LIBUSB_ERROR code on failure.
309
on success and a LIBUSB_ERROR code on failure.
305
.Pp
310
.Pp
306
.Sh USB ASYNCHRONOUS I/O
311
.Sh USB ASYNCHRONOUS I/O
307
.Pp
312
.Pp
308
.Ft struct libusb_transfer *
313
.Ft struct libusb_transfer *
309
.Fn libusb_alloc_transfer "int iso_packets"
314
.Fn libusb_alloc_transfer "int iso_packets"
310
Allocate a transfer with
315
Allocate a transfer with the number of isochronous packet descriptors
311
.Fa iso_packets
316
specified by
312
numbers of isochronous packet descriptors.
317
.Fa iso_packets .
313
Returns NULL on error.
318
Returns NULL on error.
314
.Pp
319
.Pp
315
.Ft void
320
.Ft void
Lines 320-332 Link Here
320
.Fn libusb_submit_transfer "struct libusb_transfer *tr"
325
.Fn libusb_submit_transfer "struct libusb_transfer *tr"
321
This function will submit a transfer and returns immediately.
326
This function will submit a transfer and returns immediately.
322
Returns 0 on success, LIBUSB_ERROR_NO_DEVICE if
327
Returns 0 on success, LIBUSB_ERROR_NO_DEVICE if
323
the device has been disconnected and
328
the device has been disconnected and a
324
LIBUSB_ERROR code on other failure.
329
LIBUSB_ERROR code on other failure.
325
.Pp
330
.Pp
326
.Ft int
331
.Ft int
327
.Fn libusb_cancel_transfer "struct libusb_transfer *tr"
332
.Fn libusb_cancel_transfer "struct libusb_transfer *tr"
328
This function asynchronously cancel a transfer.
333
This function asynchronously cancels a transfer.
329
Returns 0 on success and LIBUSB_ERROR code on failure.
334
Returns 0 on success and a LIBUSB_ERROR code on failure.
330
.Pp
335
.Pp
331
.Sh USB SYNCHRONOUS I/O
336
.Sh USB SYNCHRONOUS I/O
332
.Pp
337
.Pp
Lines 334-347 Link Here
334
.Fn libusb_control_transfer "libusb_device_handle *devh" "uint8_t bmRequestType" "uint8_t bRequest" "uint16_t wValue" "uint16_t wIndex" "unsigned char *data" "uint16_t wLength" "unsigned int timeout"
339
.Fn libusb_control_transfer "libusb_device_handle *devh" "uint8_t bmRequestType" "uint8_t bRequest" "uint16_t wValue" "uint16_t wIndex" "unsigned char *data" "uint16_t wLength" "unsigned int timeout"
335
Perform a USB control transfer.
340
Perform a USB control transfer.
336
Returns the actual number of bytes
341
Returns the actual number of bytes
337
transferred on success in the range from and including zero until and
342
transferred on success, in the range from and including zero up to and
338
including
343
including
339
.Fa wLength .
344
.Fa wLength .
340
On error a libusb error code is returned, for example
345
On error a LIBUSB_ERROR code is returned, for example
341
LIBUSB_ERROR_TIMEOUT if the transfer timeout, LIBUSB_ERROR_PIPE if the
346
LIBUSB_ERROR_TIMEOUT if the transfer timed out, LIBUSB_ERROR_PIPE if the
342
control request was not supported, LIBUSB_ERROR_NO_DEVICE if the
347
control request was not supported, LIBUSB_ERROR_NO_DEVICE if the
343
device has been disconnected or another LIBUSB_ERROR code on other failures.
348
device has been disconnected and another LIBUSB_ERROR code on other failures.
344
The libusb error codes are always negative.
349
The LIBUSB_ERROR codes are all negative.
345
.Pp
350
.Pp
346
.Ft int
351
.Ft int
347
.Fn libusb_bulk_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout"
352
.Fn libusb_bulk_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout"
Lines 349-358 Link Here
349
A timeout value of zero means no timeout.
354
A timeout value of zero means no timeout.
350
The timeout value is given in milliseconds.
355
The timeout value is given in milliseconds.
351
Returns 0 on success, LIBUSB_ERROR_TIMEOUT
356
Returns 0 on success, LIBUSB_ERROR_TIMEOUT
352
if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not
357
if the transfer timed out, LIBUSB_ERROR_PIPE if the control request was not
353
supported, LIBUSB_ERROR_OVERFLOW if the device offered more data,
358
supported, LIBUSB_ERROR_OVERFLOW if the device offered more data,
354
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and
359
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and
355
LIBUSB_ERROR code on other failure.
360
a LIBUSB_ERROR code on other failure.
356
.Pp
361
.Pp
357
.Ft int
362
.Ft int
358
.Fn libusb_interrupt_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout"
363
.Fn libusb_interrupt_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout"
Lines 360-369 Link Here
360
A timeout value of zero means no timeout.
365
A timeout value of zero means no timeout.
361
The timeout value is given in milliseconds.
366
The timeout value is given in milliseconds.
362
Returns 0 on success, LIBUSB_ERROR_TIMEOUT
367
Returns 0 on success, LIBUSB_ERROR_TIMEOUT
363
if the transfer timeout, LIBUSB_ERROR_PIPE if the control request was not
368
if the transfer timed out, LIBUSB_ERROR_PIPE if the control request was not
364
supported, LIBUSB_ERROR_OVERFLOW if the device offered more data,
369
supported, LIBUSB_ERROR_OVERFLOW if the device offered more data,
365
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and
370
LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and
366
LIBUSB_ERROR code on other failure.
371
a LIBUSB_ERROR code on other failure.
367
.Pp
372
.Pp
368
.Sh USB EVENTS
373
.Sh USB EVENTS
369
.Pp
374
.Pp
Lines 381-387 Link Here
381
.Fn libusb_unlock_events "libusb_context *ctx"
386
.Fn libusb_unlock_events "libusb_context *ctx"
382
Release the event handling lock.
387
Release the event handling lock.
383
This will wake up any thread blocked
388
This will wake up any thread blocked
384
on libusb_wait_for_event().
389
on
390
.B libusb_wait_for_event() .
385
.Pp
391
.Pp
386
.Ft int
392
.Ft int
387
.Fn libusb_event_handling_ok "libusb_context *ctx"
393
.Fn libusb_event_handling_ok "libusb_context *ctx"
Lines 394-406 Link Here
394
.Ft int
400
.Ft int
395
.Fn libusb_event_handler_active "libusb_context *ctx"
401
.Fn libusb_event_handler_active "libusb_context *ctx"
396
Determine if an active thread is handling events.
402
Determine if an active thread is handling events.
397
Returns 1 if yes and 0 if there
403
Returns 1 if there is a thread handling events and 0 if there
398
are no threads currently handling events.
404
are no threads currently handling events.
399
.Pp
405
.Pp
400
.Ft void
406
.Ft void
401
.Fn libusb_lock_event_waiters "libusb_context *ctx"
407
.Fn libusb_lock_event_waiters "libusb_context *ctx"
402
Acquire the event_waiters lock.
408
Acquire the event_waiters lock.
403
This lock is designed to be obtained under the
409
This lock is designed to be obtained in the
404
situation where you want to be aware when events are completed, but some other
410
situation where you want to be aware when events are completed, but some other
405
thread is event handling so calling libusb_handle_events() is not allowed.
411
thread is event handling so calling libusb_handle_events() is not allowed.
406
.Pp
412
.Pp
Lines 417-423 Link Here
417
block until the timeout expires or a transfer completes or a thread releases
423
block until the timeout expires or a transfer completes or a thread releases
418
the event handling lock through libusb_unlock_events().
424
the event handling lock through libusb_unlock_events().
419
Returns 0 after a
425
Returns 0 after a
420
transfer completes or another thread stops event handling, returns 1 if the
426
transfer completes or another thread stops event handling, and 1 if the
421
timeout expired.
427
timeout expired.
422
.Pp
428
.Pp
423
.Ft int
429
.Ft int
Lines 431-449 Link Here
431
.Fn libusb_handle_events "libusb_context *ctx"
437
.Fn libusb_handle_events "libusb_context *ctx"
432
Handle any pending events in blocking mode with a sensible timeout.
438
Handle any pending events in blocking mode with a sensible timeout.
433
Returns 0
439
Returns 0
434
on success, returns a LIBUSB_ERROR code on failure.
440
on success and a LIBUSB_ERROR code on failure.
435
.Pp
441
.Pp
436
.Ft int
442
.Ft int
437
.Fn libusb_handle_events_locked "libusb_context *ctx" "struct timeval *tv"
443
.Fn libusb_handle_events_locked "libusb_context *ctx" "struct timeval *tv"
438
Handle any pending events by polling file desciptors, without checking if
444
Handle any pending events by polling file desciptors, without checking if
439
another threads are already doing so.
445
another thread is already doing so.
440
Must be called with the event lock held.
446
Must be called with the event lock held.
441
.Pp
447
.Pp
442
.Ft int
448
.Ft int
443
.Fn libusb_get_next_timeout "libusb_context *ctx" "struct timeval *tv"
449
.Fn libusb_get_next_timeout "libusb_context *ctx" "struct timeval *tv"
444
Determine the next internal timeout that libusb needs to handle.
450
Determine the next internal timeout that libusb needs to handle.
445
Returns 0
451
Returns 0
446
if there are no pending timeouts, 1 if a timeout was returned, or LIBUSB_ERROR
452
if there are no pending timeouts, 1 if a timeout was returned, or a LIBUSB_ERROR
447
code on failure.
453
code on failure.
448
.Pp
454
.Pp
449
.Ft void
455
.Ft void

Return to bug 159898