libusb.3 (d1d015864103b253b3fcb2f72a0da5b0cfeb31b6) libusb.3 (03205428b8c51b7ec8bba846f9d976023249cdf1)
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:

--- 12 unchanged lines hidden (view full) ---

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$
28.\"
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:

--- 12 unchanged lines hidden (view full) ---

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$
28.\"
29.Dd June 7, 2013
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
36USB access library
37.Pq libusb, -lusb

--- 442 unchanged lines hidden (view full) ---

480This will
481block until the timeout expires or a transfer completes or a thread releases
482the event handling lock through libusb_unlock_events().
483Returns 0 after a
484transfer completes or another thread stops event handling, and 1 if the
485timeout expired.
486.Pp
487.Ft int
30.Dt LIBUSB 3
31.Os
32.Sh NAME
33.Nm libusb
34.Nd "USB access library"
35.Sh LIBRARY
36USB access library
37.Pq libusb, -lusb

--- 442 unchanged lines hidden (view full) ---

480This will
481block until the timeout expires or a transfer completes or a thread releases
482the event handling lock through libusb_unlock_events().
483Returns 0 after a
484transfer completes or another thread stops event handling, and 1 if the
485timeout expired.
486.Pp
487.Ft int
488.Fn libusb_handle_events_timeout_completed "libusb_context *ctx" "struct timeval *tv" "int *completed"
489Handle any pending events by checking if timeouts have expired and by
490checking the set of file descriptors for activity.
491If the
492.Fa completed
493argument is not equal to NULL, this function will
494loop until a transfer completion callback sets the variable pointed to
495by the
496.Fa completed
497argument to non-zero.
498If the
499.Fa tv
500argument is not equal to NULL, this function will return
501LIBUSB_ERROR_TIMEOUT after the given timeout.
502Returns 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"
506Handle any pending events by checking the set of file descriptors for activity.
507If the
508.Fa completed
509argument is not equal to NULL, this function will
510loop until a transfer completion callback sets the variable pointed to
511by the
512.Fa completed
513argument to non-zero.
514Returns 0 on success, or a LIBUSB_ERROR code on failure.
515.Pp
516.Ft int
488.Fn libusb_handle_events_timeout "libusb_context *ctx" "struct timeval *tv"
489Handle any pending events by checking if timeouts have expired and by
490checking the set of file descriptors for activity.
491Returns 0 on success, or a
517.Fn libusb_handle_events_timeout "libusb_context *ctx" "struct timeval *tv"
518Handle any pending events by checking if timeouts have expired and by
519checking the set of file descriptors for activity.
520Returns 0 on success, or a
492LIBUSB_ERROR code on failure.
521LIBUSB_ERROR code on failure or timeout.
493.Pp
494.Ft int
495.Fn libusb_handle_events "libusb_context *ctx"
496Handle any pending events in blocking mode with a sensible timeout.
497Returns 0
498on success and a LIBUSB_ERROR code on failure.
499.Pp
500.Ft int
501.Fn libusb_handle_events_locked "libusb_context *ctx" "struct timeval *tv"
502Handle any pending events by polling file descriptors, without checking if
503another thread is already doing so.
504Must be called with the event lock held.
505.Pp
506.Ft int
507.Fn libusb_get_next_timeout "libusb_context *ctx" "struct timeval *tv"
508Determine the next internal timeout that libusb needs to handle.
509Returns 0
510if there are no pending timeouts, 1 if a timeout was returned, or a LIBUSB_ERROR
522.Pp
523.Ft int
524.Fn libusb_handle_events "libusb_context *ctx"
525Handle any pending events in blocking mode with a sensible timeout.
526Returns 0
527on 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"
531Handle any pending events by polling file descriptors, without checking if
532another thread is already doing so.
533Must be called with the event lock held.
534.Pp
535.Ft int
536.Fn libusb_get_next_timeout "libusb_context *ctx" "struct timeval *tv"
537Determine the next internal timeout that libusb needs to handle.
538Returns 0
539if there are no pending timeouts, 1 if a timeout was returned, or a LIBUSB_ERROR
511code on failure.
540code on failure or timeout.
512.Pp
513.Ft void
514.Fn libusb_set_pollfd_notifiers "libusb_context *ctx" "libusb_pollfd_added_cb added_cb" "libusb_pollfd_removed_cb remove_cb" "void *user_data"
515Register notification functions for file descriptor additions/removals.
516These functions will be invoked for every new or removed file descriptor
517that libusb uses as an event source.
518.Pp
519.Ft const struct libusb_pollfd **

--- 50 unchanged lines hidden ---
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"
544Register notification functions for file descriptor additions/removals.
545These functions will be invoked for every new or removed file descriptor
546that libusb uses as an event source.
547.Pp
548.Ft const struct libusb_pollfd **

--- 50 unchanged lines hidden ---