libusb.3 (37d0636aac290cc86ec7149a55167f6c21ad480f) libusb.3 (7bdc064b0b644d15bd9614d9e7db5c4279736d75)
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 17, 2016
29.Dd June 22, 2016
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

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

637These functions will be invoked for every new or removed file descriptor
638that libusb uses as an event source.
639.Pp
640.Ft const struct libusb_pollfd **
641.Fn libusb_get_pollfds "libusb_context *ctx"
642Retrive a list of file descriptors that should be polled by your main loop as
643libusb event sources.
644Returns a NULL-terminated list on success or NULL on failure.
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

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

637These functions will be invoked for every new or removed file descriptor
638that libusb uses as an event source.
639.Pp
640.Ft const struct libusb_pollfd **
641.Fn libusb_get_pollfds "libusb_context *ctx"
642Retrive a list of file descriptors that should be polled by your main loop as
643libusb event sources.
644Returns a NULL-terminated list on success or NULL on failure.
645.Pp
646.Ft int
647.Fn libusb_hotplug_register_callback "libusb_context *ctx" "libusb_hotplug_event events" "libusb_hotplug_flag flags" "int vendor_id" "int product_id" "int dev_class" "libusb_hotplug_callback_fn cb_fn" "void *user_data" "libusb_hotplug_callback_handle *handle"
648This function registers a hotplug filter.
649The
650.Fa events
651argument select which events makes the hotplug filter trigger.
652Available event values are LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED and LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT.
653One or more events must be specified.
654The
655.Fa vendor_id ,
656.Fa product_id
657and
658.Fa dev_class
659arguments can be set to LIBUSB_HOTPLUG_MATCH_ANY to match any value in the USB device descriptor.
660Else the specified value is used for matching.
661If the
662.Fa flags
663argument is set to LIBUSB_HOTPLUG_ENUMERATE, all currently attached and matching USB devices will be passed to the hotplug filter, given by the
664.Fa cb_fn
665argument.
666Else the
667.Fa flags
668argument should be set to LIBUSB_HOTPLUG_NO_FLAGS.
669This function returns 0 upon success or a LIBUSB_ERROR code on failure.
670.Pp
671.Ft int
672.Fn libusb_hotplug_callback_fn "libusb_context *ctx" "libusb_device *device" "libusb_hotplug_event event" "void *user_data"
673The hotplug filter function.
674If this function returns non-zero, the filter is removed.
675Else the filter is kept and can receive more events.
676The
677.Fa user_data
678argument is the same as given when the filter was registered.
679The
680.Fa event
681argument can be either of LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED or LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT.
682.Pp
683.Ft void
684.Fn libusb_hotplug_deregister_callback "libusb_context *ctx" "libusb_hotplug_callback_handle handle"
685This function unregisters a hotplug filter.
645.Sh LIBUSB VERSION 0.1 COMPATIBILITY
646The library is also compliant with LibUSB version 0.1.12.
647.Pp
648.Fn usb_open
649.Fn usb_close
650.Fn usb_get_string
651.Fn usb_get_string_simple
652.Fn usb_get_descriptor_by_endpoint

--- 38 unchanged lines hidden ---
686.Sh LIBUSB VERSION 0.1 COMPATIBILITY
687The library is also compliant with LibUSB version 0.1.12.
688.Pp
689.Fn usb_open
690.Fn usb_close
691.Fn usb_get_string
692.Fn usb_get_string_simple
693.Fn usb_get_descriptor_by_endpoint

--- 38 unchanged lines hidden ---