Fix a couple of mdoc issues in libusb.3 and usbdi.9.
[dragonfly.git] / lib / libusb / libusb.3
1 .\"
2 .\" Copyright (c) 2009 Sylvestre Gallon
3 .\"
4 .\" All rights reserved.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\"
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" SUCH DAMAGE.
26 .\"
27 .\" $FreeBSD: head/lib/libusb/libusb.3 260315 2014-01-05 10:41:43Z hselasky $
28 .\"
29 .Dd January 5, 2014
30 .Dt LIBUSB 3
31 .Os
32 .Sh NAME
33 .Nm libusb
34 .Nd "USB access library"
35 .Sh LIBRARY
36 USB access library
37 .Pq libusb, -lusb
38 .Sh SYNOPSIS
39 .In libusb.h
40 .Sh DESCRIPTION
41 The
42 .Nm
43 library contains interfaces for directly managing a usb device.
44 The current implementation supports v1.0 of the libusb API.
45 .Sh LIBRARY INITIALISATION / DEINITIALISATION
46 .Ft int
47 .Fn libusb_init libusb_context **ctx
48 This function initialises libusb.
49 It must be called at the beginning
50 of the program, before other libusb routines are used.
51 This function returns 0 on success or LIBUSB_ERROR on
52 failure.
53 .Pp
54 .Ft void
55 .Fn libusb_exit "libusb_context *ctx"
56 Deinitialise libusb.
57 Must be called at the end of the application.
58 Other libusb routines may not be called after this function.
59 .Pp
60 .Ft const char *
61 .Fn libusb_strerror "int code"
62 Get the ASCII representation of the error given by the
63 .Fa code
64 argument.
65 This function does not return NULL.
66 .Pp
67 .Ft const char *
68 .Fn libusb_error_name "int code"
69 Get the ASCII representation of the error enum given by the
70 .Fa code
71 argument.
72 This function does not return NULL.
73 .Pp
74 .Ft void
75 .Fn libusb_set_debug "libusb_context *ctx" "int level"
76 Set the debug level to
77 .Fa level .
78 .Pp
79 .Ft ssize_t
80 .Fn libusb_get_device_list "libusb_context *ctx" "libusb_device ***list"
81 Populate
82 .Fa list
83 with the list of usb devices available, adding a reference to each
84 device in the list.
85 All the list entries created by this
86 function must have their reference counter
87 decremented when you are done with them,
88 and the list itself must be freed.
89 This
90 function returns the number of devices in the list or a LIBUSB_ERROR code.
91 .Pp
92 .Ft void
93 .Fn libusb_free_device_list "libusb_device **list" "int unref_devices"
94 Free the list of devices discovered by libusb_get_device_list.
95 If
96 .Fa unref_device
97 is set to 1 all devices in the list have their reference
98 counter decremented once.
99 .Pp
100 .Ft uint8_t
101 .Fn libusb_get_bus_number "libusb_device *dev"
102 Returns the number of the bus contained by the device
103 .Fa dev .
104 .Pp
105 .Ft int
106 .Fn libusb_get_port_numbers "libusb_device *dev" "uint8_t *buf" "uint8_t bufsize"
107 Stores, in the buffer
108 .Fa buf
109 of size
110 .Fa bufsize ,
111 the list of all port numbers from root for the device
112 .Fa dev .
113 .Pp
114 .Ft int
115 .Fn libusb_get_port_path "libusb_context *ctx" "libusb_device *dev" "uint8_t *buf" "uint8_t bufsize"
116 Deprecated function equivalent to libusb_get_port_numbers.
117 .Pp
118 .Ft uint8_t
119 .Fn libusb_get_device_address "libusb_device *dev"
120 Returns the device_address contained by the device
121 .Fa dev .
122 .Pp
123 .Ft enum libusb_speed
124 .Fn libusb_get_device_speed "libusb_device *dev"
125 Returns the wire speed at which the device is connected.
126 See the LIBUSB_SPEED_XXX enums for more information.
127 LIBUSB_SPEED_UNKNOWN is returned in case of unknown wire speed.
128 .Pp
129 .Ft int
130 .Fn libusb_get_max_packet_size "libusb_device *dev" "unsigned char endpoint"
131 Returns the wMaxPacketSize value on success, LIBUSB_ERROR_NOT_FOUND if the
132 endpoint does not exist and LIBUSB_ERROR_OTHERS on other failure.
133 .Pp
134 .Ft int
135 .Fn libusb_get_max_iso_packet_size "libusb_device *dev" "unsigned char endpoint"
136 Returns the packet size multiplied by the packet multiplier on success,
137 LIBUSB_ERROR_NOT_FOUND if the endpoint does not exist and
138 LIBUSB_ERROR_OTHERS on other failure.
139 .Pp
140 .Ft libusb_device *
141 .Fn libusb_ref_device "libusb_device *dev"
142 Increment the reference counter of the device
143 .Fa dev .
144 .Pp
145 .Ft void
146 .Fn libusb_unref_device "libusb_device *dev"
147 Decrement the reference counter of the device
148 .Fa dev .
149 .Pp
150 .Ft int
151 .Fn libusb_open "libusb_device *dev" "libusb_device_handle **devh"
152 Open a device and obtain a device_handle.
153 Returns 0 on success,
154 LIBUSB_ERROR_NO_MEM on memory allocation problems, LIBUSB_ERROR_ACCESS
155 on permissions problems, LIBUSB_ERROR_NO_DEVICE if the device has been
156 disconnected and a LIBUSB_ERROR code on other errors.
157 .Pp
158 .Ft libusb_device_handle *
159 .Fn libusb_open_device_with_vid_pid "libusb_context *ctx" "uint16_t vid" "uint16_t pid"
160 A convenience function to open a device by vendor and product IDs
161 .Fa vid
162 and
163 .Fa pid .
164 Returns NULL on error.
165 .Pp
166 .Ft void
167 .Fn libusb_close "libusb_device_handle *devh"
168 Close a device handle.
169 .Pp
170 .Ft libusb_device *
171 .Fn libusb_get_device "libusb_device_handle *devh"
172 Get the device contained by devh.
173 Returns NULL on error.
174 .Pp
175 .Ft int
176 .Fn libusb_get_configuration "libusb_device_handle *devh" "int *config"
177 Returns the value of the current configuration.
178 Returns 0
179 on success, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
180 and a LIBUSB_ERROR code on error.
181 .Pp
182 .Ft int
183 .Fn libusb_set_configuration "libusb_device_handle *devh" "int config"
184 Set the active configuration to
185 .Fa config
186 for the device contained by
187 .Fa devh .
188 This function returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the requested
189 configuration does not exist, LIBUSB_ERROR_BUSY if the interfaces are currently
190 claimed, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a
191 LIBUSB_ERROR code on failure.
192 .Pp
193 .Ft int
194 .Fn libusb_claim_interface "libusb_device_handle *devh" "int interface_number"
195 Claim an interface in a given libusb_handle
196 .Fa devh .
197 This is a non-blocking function.
198 It returns 0 on success, LIBUSB_ERROR_NOT_FOUND
199 if the requested interface does not exist, LIBUSB_ERROR_BUSY if a program or
200 driver has claimed the interface, LIBUSB_ERROR_NO_DEVICE if the device has
201 been disconnected and a LIBUSB_ERROR code on failure.
202 .Pp
203 .Ft int
204 .Fn libusb_release_interface "libusb_device_handle *devh" "int interface_number"
205 This function releases an interface.
206 All the claimed interfaces on a device must be released
207 before closing the device.
208 Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the
209 interface was not claimed, LIBUSB_ERROR_NO_DEVICE if the device has been
210 disconnected and LIBUSB_ERROR on failure.
211 .Pp
212 .Ft int
213 .Fn libusb_set_interface_alt_setting "libusb_device_handle *dev" "int interface_number" "int alternate_setting"
214 Activate an alternate setting for an interface.
215 Returns 0 on success,
216 LIBUSB_ERROR_NOT_FOUND if the interface was not claimed or the requested
217 setting does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been
218 disconnected and a LIBUSB_ERROR code on failure.
219 .Pp
220 .Ft int
221 .Fn libusb_clear_halt "libusb_device_handle *devh" "unsigned char endpoint"
222 Clear an halt/stall for a endpoint.
223 Returns 0 on success, LIBUSB_ERROR_NOT_FOUND
224 if the endpoint does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been
225 disconnected and a LIBUSB_ERROR code on failure.
226 .Pp
227 .Ft int
228 .Fn libusb_reset_device "libusb_device_handle *devh"
229 Perform an USB port reset for an usb device.
230 Returns 0 on success,
231 LIBUSB_ERROR_NOT_FOUND if re-enumeration is required or if the device has
232 been disconnected and a LIBUSB_ERROR code on failure.
233 .Pp
234 .Ft int
235 .Fn libusb_check_connected "libusb_device_handle *devh"
236 Test if the USB device is still connected.
237 Returns 0 on success,
238 LIBUSB_ERROR_NO_DEVICE if it has been disconnected and a LIBUSB_ERROR
239 code on failure.
240 .Pp
241 .Ft int
242 .Fn libusb_kernel_driver_active "libusb_device_handle *devh" "int interface"
243 Determine if a driver is active on a interface.
244 Returns 0 if no kernel driver is active
245 and 1 if a kernel driver is active, LIBUSB_ERROR_NO_DEVICE
246 if the device has been disconnected and a LIBUSB_ERROR code on failure.
247 .Pp
248 .Ft int
249 .Fn libusb_get_driver "libusb_device_handle *devh" "int interface" "char *name" "int namelen"
250 or
251 .Ft int
252 .Fn libusb_get_driver_np "libusb_device_handle *devh" "int interface" "char *name" "int namelen"
253 Copy the name of the driver attached to the given
254 .Fa device
255 and
256 .Fa interface
257 into the buffer
258 .Fa name
259 of length
260 .Fa namelen .
261 Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver is attached
262 to the given interface and LIBUSB_ERROR_INVALID_PARAM if the interface does
263 not exist.
264 This function is non-portable.
265 The buffer pointed to by
266 .Fa name
267 is only zero terminated on success.
268 .Pp
269 .Ft int
270 .Fn libusb_detach_kernel_driver "libusb_device_handle *devh" "int interface"
271 or
272 .Ft int
273 .Fn libusb_detach_kernel_driver_np "libusb_device_handle *devh" "int interface"
274 Detach a kernel driver from an interface.
275 This is needed to claim an interface already claimed by a kernel driver.
276 Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver was active,
277 LIBUSB_ERROR_INVALID_PARAM if the interface does not exist,
278 LIBUSB_ERROR_NO_DEVICE if the device has been disconnected
279 and a LIBUSB_ERROR code on failure.
280 This function is non-portable.
281 .Pp
282 .Ft int
283 .Fn libusb_attach_kernel_driver "libusb_device_handle *devh" "int interface"
284 Re-attach an interface kernel driver that was previously detached.
285 Returns 0 on success,
286 LIBUSB_ERROR_INVALID_PARAM if the interface does not exist,
287 LIBUSB_ERROR_NO_DEVICE
288 if the device has been disconnected, LIBUSB_ERROR_BUSY if the driver cannot be
289 attached because the interface is claimed by a program or driver and a
290 LIBUSB_ERROR code on failure.
291 .Sh USB DESCRIPTORS
292 .Ft int
293 .Fn libusb_get_device_descriptor "libusb_device *dev" "libusb_device_descriptor *desc"
294 Get the USB device descriptor for the device
295 .Fa dev .
296 This is a non-blocking function.
297 Returns 0 on success and a LIBUSB_ERROR code on
298 failure.
299 .Pp
300 .Ft int
301 .Fn libusb_get_active_config_descriptor "libusb_device *dev" "struct libusb_config_descriptor **config"
302 Get the USB configuration descriptor for the active configuration.
303 Returns 0 on
304 success, LIBUSB_ERROR_NOT_FOUND if the device is in
305 an unconfigured state
306 and a LIBUSB_ERROR code on error.
307 .Pp
308 .Ft int
309 .Fn libusb_get_config_descriptor "libusb_device *dev" "uint8_t config_index" "libusb_config_descriptor **config"
310 Get a USB configuration descriptor based on its index
311 .Fa idx .
312 Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the configuration does not exist
313 and a LIBUSB_ERROR code on error.
314 .Pp
315 .Ft int
316 .Fn libusb_get_config_descriptor_by_value "libusb_device *dev" "uint8 bConfigurationValue" "libusb_config_descriptor **config"
317 Get a USB configuration descriptor with a specific bConfigurationValue.
318 This is
319 a non-blocking function which does not send a request through the device.
320 Returns 0
321 on success, LIBUSB_ERROR_NOT_FOUND if the configuration
322 does not exist and a
323 LIBUSB_ERROR code on failure.
324 .Pp
325 .Ft void
326 .Fn libusb_free_config_descriptor "libusb_config_descriptor *config"
327 Free a configuration descriptor.
328 .Pp
329 .Ft int
330 .Fn libusb_get_string_descriptor "libusb_device_handle *devh" "uint8_t desc_idx" "uint16_t langid" "unsigned char *data" "int length"
331 Retrieve a string descriptor in raw format.
332 Returns the number of bytes actually transferred on success
333 or a negative LIBUSB_ERROR code on failure.
334 .Pp
335 .Ft int
336 .Fn libusb_get_string_descriptor_ascii "libusb_device_handle *devh" "uint8_t desc_idx" "unsigned char *data" "int length"
337 Retrieve a string descriptor in C style ASCII.
338 Returns the positive number of bytes in the resulting ASCII string
339 on success and a LIBUSB_ERROR code on failure.
340 .Pp
341 .Ft int
342 .Fn libusb_parse_ss_endpoint_comp "const void *buf" "int len" "libusb_ss_endpoint_companion_descriptor **ep_comp"
343 This function parses the USB 3.0 endpoint companion descriptor in host endian format pointed to by
344 .Fa buf
345 and having a length of
346 .Fa len .
347 Typically these arguments are the extra and extra_length fields of the
348 endpoint descriptor.
349 On success the pointer to resulting descriptor is stored at the location given by
350 .Fa ep_comp .
351 Returns zero on success and a LIBUSB_ERROR code on failure.
352 On success the parsed USB 3.0 endpoint companion descriptor must be
353 freed using the libusb_free_ss_endpoint_comp function.
354 .Pp
355 .Ft void
356 .Fn libusb_free_ss_endpoint_comp "libusb_ss_endpoint_companion_descriptor *ep_comp"
357 This function is NULL safe and frees a parsed USB 3.0 endpoint companion descriptor.
358 .Pp
359 .Ft int
360 .Fn libusb_parse_bos_descriptor "const void *buf" "int len" "libusb_bos_descriptor **bos"
361 This function parses a Binary Object Store, BOS, descriptor into host endian format pointed to by
362 .Fa buf
363 and having a length of
364 .Fa len .
365 On success the pointer to resulting descriptor is stored at the location given by
366 .Fa bos .
367 Returns zero on success and a LIBUSB_ERROR code on failure.
368 On success the parsed BOS descriptor must be freed using the
369 libusb_free_bos_descriptor function.
370 .Pp
371 .Ft void
372 .Fn libusb_free_bos_descriptor "libusb_bos_descriptor *bos"
373 This function is NULL safe and frees a parsed BOS descriptor.
374 .Sh USB ASYNCHRONOUS I/O
375 .Ft struct libusb_transfer *
376 .Fn libusb_alloc_transfer "int iso_packets"
377 Allocate a transfer with the number of isochronous packet descriptors
378 specified by
379 .Fa iso_packets .
380 Returns NULL on error.
381 .Pp
382 .Ft void
383 .Fn libusb_free_transfer "struct libusb_transfer *tr"
384 Free a transfer.
385 .Pp
386 .Ft int
387 .Fn libusb_submit_transfer "struct libusb_transfer *tr"
388 This function will submit a transfer and returns immediately.
389 Returns 0 on success, LIBUSB_ERROR_NO_DEVICE if
390 the device has been disconnected and a
391 LIBUSB_ERROR code on other failure.
392 .Pp
393 .Ft int
394 .Fn libusb_cancel_transfer "struct libusb_transfer *tr"
395 This function asynchronously cancels a transfer.
396 Returns 0 on success and a LIBUSB_ERROR code on failure.
397 .Sh USB SYNCHRONOUS I/O
398 .Ft int
399 .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"
400 Perform a USB control transfer.
401 Returns the actual number of bytes
402 transferred on success, in the range from and including zero up to and
403 including
404 .Fa wLength .
405 On error a LIBUSB_ERROR code is returned, for example
406 LIBUSB_ERROR_TIMEOUT if the transfer timed out, LIBUSB_ERROR_PIPE if the
407 control request was not supported, LIBUSB_ERROR_NO_DEVICE if the
408 device has been disconnected and another LIBUSB_ERROR code on other failures.
409 The LIBUSB_ERROR codes are all negative.
410 .Pp
411 .Ft int
412 .Fn libusb_bulk_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout"
413 Perform an USB bulk transfer.
414 A timeout value of zero means no timeout.
415 The timeout value is given in milliseconds.
416 Returns 0 on success, LIBUSB_ERROR_TIMEOUT
417 if the transfer timed out, LIBUSB_ERROR_PIPE if the control request was not
418 supported, LIBUSB_ERROR_OVERFLOW if the device offered more data,
419 LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and
420 a LIBUSB_ERROR code on other failure.
421 .Pp
422 .Ft int
423 .Fn libusb_interrupt_transfer "struct libusb_device_handle *devh" "unsigned char endpoint" "unsigned char *data" "int length" "int *transferred" "unsigned int timeout"
424 Perform an USB Interrupt transfer.
425 A timeout value of zero means no timeout.
426 The timeout value is given in milliseconds.
427 Returns 0 on success, LIBUSB_ERROR_TIMEOUT
428 if the transfer timed out, LIBUSB_ERROR_PIPE if the control request was not
429 supported, LIBUSB_ERROR_OVERFLOW if the device offered more data,
430 LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and
431 a LIBUSB_ERROR code on other failure.
432 .Sh USB EVENTS
433 .Ft int
434 .Fn libusb_try_lock_events "libusb_context *ctx"
435 Try to acquire the event handling lock.
436 Returns 0 if the lock was obtained and 1 if not.
437 .Pp
438 .Ft void
439 .Fn libusb_lock_events "libusb_context *ctx"
440 Acquire the event handling lock.
441 This function is blocking.
442 .Pp
443 .Ft void
444 .Fn libusb_unlock_events "libusb_context *ctx"
445 Release the event handling lock.
446 This will wake up any thread blocked
447 on
448 .Fn libusb_wait_for_event .
449 .Pp
450 .Ft int
451 .Fn libusb_event_handling_ok "libusb_context *ctx"
452 Determine if it still OK for this thread to be doing event handling.
453 Returns 1
454 if event handling can start or continue.
455 Returns 0 if this thread must give up
456 the events lock.
457 .Pp
458 .Ft int
459 .Fn libusb_event_handler_active "libusb_context *ctx"
460 Determine if an active thread is handling events.
461 Returns 1 if there is a thread handling events and 0 if there
462 are no threads currently handling events.
463 .Pp
464 .Ft void
465 .Fn libusb_lock_event_waiters "libusb_context *ctx"
466 Acquire the event_waiters lock.
467 This lock is designed to be obtained in the
468 situation where you want to be aware when events are completed, but some other
469 thread is event handling so calling libusb_handle_events() is not allowed.
470 .Pp
471 .Ft void
472 .Fn libusb_unlock_event_waiters "libusb_context *ctx"
473 Release the event_waiters lock.
474 .Pp
475 .Ft int
476 .Fn libusb_wait_for_event "libusb_context *ctx" "struct timeval *tv"
477 Wait for another thread to signal completion of an event.
478 Must be called
479 with the event waiters lock held, see libusb_lock_event_waiters().
480 This will
481 block until the timeout expires or a transfer completes or a thread releases
482 the event handling lock through libusb_unlock_events().
483 Returns 0 after a
484 transfer completes or another thread stops event handling, and 1 if the
485 timeout expired.
486 .Pp
487 .Ft int
488 .Fn libusb_handle_events_timeout_completed "libusb_context *ctx" "struct timeval *tv" "int *completed"
489 Handle any pending events by checking if timeouts have expired and by
490 checking the set of file descriptors for activity.
491 If the
492 .Fa completed
493 argument is not equal to NULL, this function will
494 loop until a transfer completion callback sets the variable pointed to
495 by the
496 .Fa completed
497 argument to non-zero.
498 If the
499 .Fa tv
500 argument is not equal to NULL, this function will return
501 LIBUSB_ERROR_TIMEOUT after the given timeout.
502 Returns 0 on success, or a LIBUSB_ERROR code on failure or timeout.
503 .Pp
504 .Ft int
505 .Fn libusb_handle_events_completed "libusb_context *ctx" "int *completed"
506 Handle any pending events by checking the set of file descriptors for activity.
507 If the
508 .Fa completed
509 argument is not equal to NULL, this function will
510 loop until a transfer completion callback sets the variable pointed to
511 by the
512 .Fa completed
513 argument to non-zero.
514 Returns 0 on success, or a LIBUSB_ERROR code on failure.
515 .Pp
516 .Ft int
517 .Fn libusb_handle_events_timeout "libusb_context *ctx" "struct timeval *tv"
518 Handle any pending events by checking if timeouts have expired and by
519 checking the set of file descriptors for activity.
520 Returns 0 on success, or a
521 LIBUSB_ERROR code on failure or timeout.
522 .Pp
523 .Ft int
524 .Fn libusb_handle_events "libusb_context *ctx"
525 Handle any pending events in blocking mode with a sensible timeout.
526 Returns 0
527 on success and a LIBUSB_ERROR code on failure.
528 .Pp
529 .Ft int
530 .Fn libusb_handle_events_locked "libusb_context *ctx" "struct timeval *tv"
531 Handle any pending events by polling file descriptors, without checking if
532 another thread is already doing so.
533 Must be called with the event lock held.
534 .Pp
535 .Ft int
536 .Fn libusb_get_next_timeout "libusb_context *ctx" "struct timeval *tv"
537 Determine the next internal timeout that libusb needs to handle.
538 Returns 0
539 if there are no pending timeouts, 1 if a timeout was returned, or a LIBUSB_ERROR
540 code on failure or timeout.
541 .Pp
542 .Ft void
543 .Fn libusb_set_pollfd_notifiers "libusb_context *ctx" "libusb_pollfd_added_cb added_cb" "libusb_pollfd_removed_cb remove_cb" "void *user_data"
544 Register notification functions for file descriptor additions/removals.
545 These functions will be invoked for every new or removed file descriptor
546 that libusb uses as an event source.
547 .Pp
548 .Ft const struct libusb_pollfd **
549 .Fn libusb_get_pollfds "libusb_context *ctx"
550 Retrive a list of file descriptors that should be polled by your main loop as
551 libusb event sources.
552 Returns a NULL-terminated list on success or NULL on failure.
553 .Sh LIBUSB VERSION 0.1 COMPATIBILITY
554 The library is also compliant with LibUSB version 0.1.12.
555 .Pp
556 .Fn usb_open
557 .Fn usb_close
558 .Fn usb_get_string
559 .Fn usb_get_string_simple
560 .Fn usb_get_descriptor_by_endpoint
561 .Fn usb_get_descriptor
562 .Fn usb_parse_descriptor
563 .Fn usb_parse_configuration
564 .Fn usb_destroy_configuration
565 .Fn usb_fetch_and_parse_descriptors
566 .Fn usb_bulk_write
567 .Fn usb_bulk_read
568 .Fn usb_interrupt_write
569 .Fn usb_interrupt_read
570 .Fn usb_control_msg
571 .Fn usb_set_configuration
572 .Fn usb_claim_interface
573 .Fn usb_release_interface
574 .Fn usb_set_altinterface
575 .Fn usb_resetep
576 .Fn usb_clear_halt
577 .Fn usb_reset
578 .Fn usb_strerror
579 .Fn usb_init
580 .Fn usb_set_debug
581 .Fn usb_find_busses
582 .Fn usb_find_devices
583 .Fn usb_device
584 .Fn usb_get_busses
585 .Fn usb_check_connected
586 .Fn usb_get_driver_np
587 .Fn usb_detach_kernel_driver_np
588 .Sh SEE ALSO
589 .Xr libusb20 3 ,
590 .Xr usb 4 ,
591 .Xr usbconfig 8 ,
592 .Xr usbdump 8
593 .Pp
594 .Pa http://libusb.sourceforge.net/
595 .Sh HISTORY
596 .Nm
597 support first appeared in
598 .Fx 8.0 .