DESCRIPTION The libusb library contains interfaces for directly managing a usb de- vice. The current implementation supports v1.0 of the libusb API. LIBRARY INITIALISATION AND DEINITIALISATION const struct libusb _ version * libusb _ get _ version ( void ) This function re- turns version information about LibUSB. int libusb _ init ( libusb _ context **ctx ) This function initialises libusb. It must be called at the beginning of the program, before other libusb routines are used. This function returns 0 on success or LIBUSB_ERROR on failure. void libusb _ exit ( libusb _ context *ctx ) Deinitialise libusb. Must be called at the end of the application. Other libusb routines may not be called after this function. int libusb _ has _ capability ( uint32 _ t capability ) This function checks the runtime capabilities of libusb . This function will return non-zero if the given capability is supported, 0 if it is not supported. The valid values for capability are: LIBUSB _ CAP _ HAS _ CAPABILITY libusb supports libusb _ has _ capability (). LIBUSB _ CAP _ HAS _ HOTPLUG libusb supports hotplug notifications. LIBUSB _ CAP _ HAS _ HID _ ACCESS libusb can access HID devices without requiring user intervention. LIBUSB _ CAP _ SUPPORTS _ DETACH _ KERNEL _ DRIVER libusb supports detaching of the default USB driver with libusb _ detach _ kernel _ driver (). const char * libusb _ strerror ( int code ) Get the ASCII representation of the error given by the code argument. This function does not return NULL. const char * libusb _ error _ name ( int code ) Get the ASCII representation of the error enum given by the code argument. This function does not return NULL. void libusb _ set _ debug ( libusb _ context *ctx , int level ) Set the debug level to level . ssize _ t libusb _ get _ device _ list ( libusb _ context *ctx , libusb _ device ***list ) Populate list with the list of usb devices available, adding a reference to each device in the list. All the list entries created by this function must have their reference counter decremented when you are done with them, and the list itself must be freed. This function returns the number of devices in the list or a LIBUSB_ERROR code. void libusb _ free _ device _ list ( libusb _ device **list , int unref _ devices ) Free the list of devices discovered by libusb_get_device_list. If unref _ device is set to 1 all devices in the list have their reference counter decremented once. uint8 _ t libusb _ get _ bus _ number ( libusb _ device *dev ) Returns the number of the bus contained by the device dev . uint8 _ t libusb _ get _ port _ number ( libusb _ device *dev ) Returns the port num- ber which the device given by dev is attached to. int libusb _ get _ port _ numbers ( libusb _ device *dev , uint8 _ t *buf , uint8 _ t bufsize ) Stores, in the buffer buf of size bufsize , the list of all port numbers from root for the device dev . int libusb _ get _ port _ path ( libusb _ context *ctx , libusb _ device *dev , uint8 _ t *buf , uint8 _ t bufsize ) Deprecated function equivalent to libusb_get_port_numbers. uint8 _ t libusb _ get _ device _ address ( libusb _ device *dev ) Returns the de- vice_address contained by the device dev . enum libusb _ speed libusb _ get _ device _ speed ( libusb _ device *dev ) Returns the wire speed at which the device is connected. See the LIBUSB_SPEED_XXX enums for more information. LIBUSB_SPEED_UNKNOWN is returned in case of unknown wire speed. int libusb _ get _ max _ packet _ size ( libusb _ device *dev , unsigned char endpoint ) Returns the wMaxPacketSize value on success, LIBUSB_ER- ROR_NOT_FOUND if the endpoint does not exist and LIBUSB_ERROR_OTHERS on other failure. int libusb _ get _ max _ iso _ packet _ size ( libusb _ device *dev , unsigned char endpoint ) Returns the packet size multiplied by the packet multiplier on success, LIBUSB_ERROR_NOT_FOUND if the endpoint does not exist and LIBUSB_ERROR_OTHERS on other failure. libusb _ device * libusb _ ref _ device ( libusb _ device *dev ) Increment the ref- erence counter of the device dev . void libusb _ unref _ device ( libusb _ device *dev ) Decrement the reference counter of the device dev . int libusb _ open ( libusb _ device *dev , libusb _ device _ handle **devh ) Open a device and obtain a device_handle. Returns 0 on success, LIBUSB_ER- ROR_NO_MEM on memory allocation problems, LIBUSB_ERROR_ACCESS on permis- sions problems, LIBUSB_ERROR_NO_DEVICE if the device has been discon- nected and a LIBUSB_ERROR code on other errors. libusb _ device _ handle * libusb _ open _ device _ with _ vid _ pid ( libusb _ context *ctx , uint16 _ t vid , uint16 _ t pid ) A convenience function to open a device by vendor and product IDs vid and pid . Returns NULL on error. void libusb _ close ( libusb _ device _ handle *devh ) Close a device handle. libusb _ device * libusb _ get _ device ( libusb _ device _ handle *devh ) Get the de- vice contained by devh. Returns NULL on error. int libusb _ get _ configuration ( libusb _ device _ handle *devh , int *config ) Re- turns the value of the current configuration. Returns 0 on success, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on error. int libusb _ set _ configuration ( libusb _ device _ handle *devh , int config ) Set the active configuration to config for the device contained by devh . This function returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the re- quested configuration does not exist, LIBUSB_ERROR_BUSY if the interfaces are currently claimed, LIBUSB_ERROR_NO_DEVICE if the device has been dis- connected and a LIBUSB_ERROR code on failure. int libusb _ claim _ interface ( libusb _ device _ handle *devh , int interface _ number ) Claim an interface in a given libusb_handle devh . This is a non-blocking function. It returns 0 on success, LIBUSB_ER- ROR_NOT_FOUND if the requested interface does not exist, LIBUSB_ER- ROR_BUSY if a program or driver has claimed the interface, LIBUSB_ER- ROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. int libusb _ release _ interface ( libusb _ device _ handle *devh , int interface _ number ) This function releases an interface. All the claimed interfaces on a device must be released before closing the device. Re- turns 0 on success, LIBUSB_ERROR_NOT_FOUND if the interface was not claimed, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and LIBUSB_ERROR on failure. int libusb _ set _ interface _ alt _ setting ( libusb _ device _ handle *dev , int interface _ number , int alternate _ setting ) Activate an alternate setting for an interface. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if the interface was not claimed or the requested setting does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. int libusb _ clear _ halt ( libusb _ device _ handle *devh , unsigned char endpoint ) Clear an halt/stall for a endpoint. Returns 0 on success, LIBUSB_ER- ROR_NOT_FOUND if the endpoint does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. int libusb _ reset _ device ( libusb _ device _ handle *devh ) Perform an USB port reset for an usb device. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if re-enumeration is required or if the device has been disconnected and a LIBUSB_ERROR code on failure. int libusb _ check _ connected ( libusb _ device _ handle *devh ) Test if the USB device is still connected. Returns 0 on success, LIBUSB_ERROR_NO_DEVICE if it has been disconnected and a LIBUSB_ERROR code on failure. int libusb _ kernel _ driver _ active ( libusb _ device _ handle *devh , int interface ) Determine if a driver is active on a interface. Returns 0 if no kernel driver is active and 1 if a kernel driver is active, LIBUSB_ER- ROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. int libusb _ get _ driver ( libusb _ device _ handle *devh , int interface , char *name , int namelen ) or int libusb _ get _ driver _ np ( libusb _ device _ handle *devh , int interface , char *name , int namelen ) Copy the name of the driver attached to the given device and interface into the buffer name of length namelen . Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no ker- nel driver is attached to the given interface and LIBUSB_ERROR_IN- VALID_PARAM if the interface does not exist. This function is non-porta- ble. The buffer pointed to by name is only zero terminated on success. int libusb _ detach _ kernel _ driver ( libusb _ device _ handle *devh , int interface ) or int libusb _ detach _ kernel _ driver _ np ( libusb _ device _ handle *devh , int interface ) Detach a kernel driver from an interface. This is needed to claim an interface already claimed by a kernel driver. Returns 0 on success, LIBUSB_ERROR_NOT_FOUND if no kernel driver was active, LIBUSB_ERROR_INVALID_PARAM if the interface does not exist, LIBUSB_ER- ROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on failure. This function is non-portable. int libusb _ attach _ kernel _ driver ( libusb _ device _ handle *devh , int interface ) Re-attach an interface kernel driver that was previously de- tached. Returns 0 on success, LIBUSB_ERROR_INVALID_PARAM if the inter- face does not exist, LIBUSB_ERROR_NO_DEVICE if the device has been dis- connected, LIBUSB_ERROR_BUSY if the driver cannot be attached because the interface is claimed by a program or driver and a LIBUSB_ERROR code on failure. int libusb _ set _ auto _ detach _ kernel _ driver ( libusb _ device _ handle *devh , int enable ) This function enables automatic kernel interface driver detach when an interface is claimed. When the interface is restored the kernel driver is allowed to be re-attached. If the enable argument is non-zero the feature is enabled. Else disabled. Returns 0 on success and a LIBUSB_ERROR code on failure. USB DESCRIPTORS int libusb _ get _ device _ descriptor ( libusb _ device *dev , libusb _ device _ descriptor *desc ) Get the USB device descriptor for the de- vice dev . This is a non-blocking function. Returns 0 on success and a LIBUSB_ERROR code on failure. int libusb _ get _ active _ config _ descriptor ( libusb _ device *dev , struct libusb _ config _ descriptor **config ) Get the USB configuration descriptor for the active configuration. Returns 0 on success, LIBUSB_ER- ROR_NOT_FOUND if the device is in an unconfigured state and a LIBUSB_ER- ROR code on error. int libusb _ get _ config _ descriptor ( libusb _ device *dev , uint8 _ t config _ index , libusb _ config _ descriptor **config ) Get a USB configuration descriptor based on its index idx . Returns 0 on success, LIBUSB_ER- ROR_NOT_FOUND if the configuration does not exist and a LIBUSB_ERROR code on error. int libusb _ get _ config _ descriptor _ by _ value ( libusb _ device *dev , uint8 bConfigurationValue , libusb _ config _ descriptor **config ) Get a USB config- uration descriptor with a specific bConfigurationValue. This is a non- blocking function which does not send a request through the device. Re- turns 0 on success, LIBUSB_ERROR_NOT_FOUND if the configuration does not exist and a LIBUSB_ERROR code on failure. void libusb _ free _ config _ descriptor ( libusb _ config _ descriptor *config ) Free a configuration descriptor. int libusb _ get _ string _ descriptor ( libusb _ device _ handle *devh , uint8 _ t desc _ idx , uint16 _ t langid , unsigned char *data , int length ) Retrieve a string descriptor in raw format. Returns the number of bytes actually transferred on success or a negative LIBUSB_ERROR code on failure. int libusb _ get _ string _ descriptor _ ascii ( libusb _ device _ handle *devh , uint8 _ t desc _ idx , unsigned char *data , int length ) Retrieve a string de- scriptor in C style ASCII. Returns the positive number of bytes in the resulting ASCII string on success and a LIBUSB_ERROR code on failure. int libusb _ parse _ ss _ endpoint _ comp ( const void *buf , int len , libusb _ ss _ endpoint _ companion _ descriptor **ep _ comp ) This function parses the USB 3.0 endpoint companion descriptor in host endian format pointed to by buf and having a length of len . Typically these arguments are the extra and extra_length fields of the endpoint descriptor. On success the pointer to resulting descriptor is stored at the location given by ep _ comp . Returns zero on success and a LIBUSB_ERROR code on failure. On success the parsed USB 3.0 endpoint companion descriptor must be freed using the libusb_free_ss_endpoint_comp function. void libusb _ free _ ss _ endpoint _ comp ( libusb _ ss _ endpoint _ companion _ descriptor *ep _ comp ) This function is NULL safe and frees a parsed USB 3.0 endpoint companion descriptor given by ep _ comp . int libusb _ get _ ss _ endpoint _ companion _ descriptor ( struct libusb _ context *ctx , const struct libusb _ endpoint _ descriptor *endpoint , struct libusb _ ss _ endpoint _ companion _ descriptor **ep _ comp ) This function finds and parses the USB 3.0 endpoint companion descriptor given by endpoint . Returns zero on success and a LIBUSB_ERROR code on failure. On success the parsed USB 3.0 endpoint companion descriptor must be freed using the libusb_free_ss_endpoint_companion_descriptor function. void libusb _ free _ ss _ endpoint _ companion _ descriptor ( struct libusb _ ss _ endpoint _ companion _ descriptor *ep _ comp ) This function is NULL safe and frees a parsed USB 3.0 endpoint companion descriptor given by ep _ comp . int libusb _ get _ bos _ descriptor ( libusb _ device _ handle *handle , struct libusb _ bos _ descriptor **bos ) This function queries the USB device given by handle and stores a pointer to a parsed BOS descriptor into bos . Re- turns zero on success and a LIBUSB_ERROR code on failure. On success the parsed BOS descriptor must be freed using the libusb_free_bos_descriptor function. int libusb _ parse _ bos _ descriptor ( const void *buf , int len , libusb _ bos _ descriptor **bos ) This function parses a Binary Object Store, BOS, descriptor into host endian format pointed to by buf and having a length of len . On success the pointer to resulting descriptor is stored at the location given by bos . Returns zero on success and a LIBUSB_ERROR code on failure. On success the parsed BOS descriptor must be freed us- ing the libusb_free_bos_descriptor function. void libusb _ free _ bos _ descriptor ( libusb _ bos _ descriptor *bos ) This function is NULL safe and frees a parsed BOS descriptor given by bos . int libusb _ get _ usb _ 2 _ 0 _ extension _ descriptor ( struct libusb _ context *ctx , struct libusb _ bos _ dev _ capability _ descriptor *dev _ cap , struct libusb _ usb _ 2 _ 0 _ extension _ descriptor **usb _ 2 _ 0 _ extension ) This function parses the USB 2.0 extension descriptor from the descriptor given by dev _ cap and stores a pointer to the parsed descriptor into usb _ 2 _ 0 _ extension . Returns zero on success and a LIBUSB_ERROR code on failure. On success the parsed USB 2.0 extension descriptor must be freed using the libusb_free_usb_2_0_extension_descriptor function. void libusb _ free _ usb _ 2 _ 0 _ extension _ descriptor ( struct libusb _ usb _ 2 _ 0 _ extension _ descriptor *usb _ 2 _ 0 _ extension ) This function is NULL safe and frees a parsed USB 2.0 extension descriptor given by usb _ 2 _ 0 _ extension . int libusb _ get _ ss _ usb _ device _ capability _ descriptor ( struct libusb _ context *ctx , struct libusb _ bos _ dev _ capability _ descriptor *dev _ cap , struct libusb _ ss _ usb _ device _ capability _ descriptor **ss _ usb _ device _ capability ) This function parses the SuperSpeed device capability descriptor from the descriptor given by dev _ cap and stores a pointer to the parsed descriptor into ss _ usb _ device _ capability . Returns zero on success and a LIBUSB_ER- ROR code on failure. On success the parsed SuperSpeed device capability descriptor must be freed using the libusb_free_ss_usb_device_capabil- ity_descriptor function. void libusb _ free _ ss _ usb _ device _ capability _ descriptor ( struct libusb _ ss _ usb _ device _ capability _ descriptor *ss _ usb _ device _ capability ) This function is NULL safe and frees a parsed SuperSpeed device capabil- ity descriptor given by ss _ usb _ device _ capability . int libusb _ get _ container _ id _ descriptor ( struct libusb _ context *ctx , struct libusb _ bos _ dev _ capability _ descriptor *dev _ cap , struct libusb _ container _ id _ descriptor **container _ id ) This function parses the container ID descriptor from the descriptor given by dev _ cap and stores a pointer to the parsed descriptor into container _ id . Returns zero on suc- cess and a LIBUSB_ERROR code on failure. On success the parsed container ID descriptor must be freed using the libusb_free_container_id_descriptor function. void libusb _ free _ container _ id _ descriptor ( struct libusb _ container _ id _ descriptor *container _ id ) This function is NULL safe and frees a parsed container ID descriptor given by container _ id . USB ASYNCHRONOUS I/O struct libusb _ transfer * libusb _ alloc _ transfer ( int iso _ packets ) Allocate a transfer with the number of isochronous packet descriptors specified by iso _ packets . Returns NULL on error. void libusb _ free _ transfer ( struct libusb _ transfer *tr ) Free a transfer. int libusb _ submit _ transfer ( struct libusb _ transfer *tr ) This function will submit a transfer and returns immediately. Returns 0 on success, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on other failure. int libusb _ cancel _ transfer ( struct libusb _ transfer *tr ) This function asynchronously cancels a transfer. Returns 0 on success and a LIBUSB_ER- ROR code on failure. USB SYNCHRONOUS I/O int 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 ) Perform a USB control transfer. Returns the actual number of bytes transferred on success, in the range from and including zero up to and including wLength . On error a LIBUSB_ERROR code is returned, for example LIBUSB_ERROR_TIMEOUT if the transfer timed out, LIBUSB_ERROR_PIPE if the control request was not supported, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and another LIBUSB_ERROR code on other failures. The LIBUSB_ERROR codes are all negative. int libusb _ bulk _ transfer ( struct libusb _ device _ handle *devh , unsigned char endpoint , unsigned char *data , int length , int *transferred , unsigned int timeout ) Perform an USB bulk transfer. A timeout value of zero means no timeout. The timeout value is given in milliseconds. Returns 0 on suc- cess, LIBUSB_ERROR_TIMEOUT if the transfer timed out, LIBUSB_ERROR_PIPE if the control request was not supported, LIBUSB_ERROR_OVERFLOW if the device offered more data, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on other failure. int libusb _ interrupt _ transfer ( struct libusb _ device _ handle *devh , unsigned char endpoint , unsigned char *data , int length , int *transferred , unsigned int timeout ) Perform an USB Interrupt transfer. A timeout value of zero means no timeout. The timeout value is given in milliseconds. Returns 0 on success, LIBUSB_ERROR_TIMEOUT if the transfer timed out, LIBUSB_ERROR_PIPE if the control request was not supported, LIBUSB_ER- ROR_OVERFLOW if the device offered more data, LIBUSB_ERROR_NO_DEVICE if the device has been disconnected and a LIBUSB_ERROR code on other fail- USB STREAMS SUPPORT int libusb _ alloc _ streams ( libusb _ device _ handle *dev , uint32 _ t num _ streams , unsigned char *endpoints , int num _ endpoints ) This function verifies that the given number of streams using the given number of endpoints is al- lowed and allocates the resources needed to use so-called USB streams. Currently only a single stream per endpoint is supported to simplify the internals of LibUSB. This function returns 0 on success or a LIBUSB_ER- ROR code on failure. int libusb _ free _ streams ( libusb _ device _ handle *dev , unsigned char *endpoints , int num _ endpoints ) This function release resources needed for streams usage. Returns 0 on success or a LIBUSB_ERROR code on failure. void libusb _ transfer _ set _ stream _ id ( struct libusb _ transfer *transfer , uint32 _ t stream _ id ) This function sets the stream ID for the given USB transfer. uint32 _ t libusb _ transfer _ get _ stream _ id ( struct libusb _ transfer *transfer ) This function returns the stream ID for the given USB transfer. If no stream ID is used a value of zero is returned. USB EVENTS int libusb _ try _ lock _ events ( libusb _ context *ctx ) Try to acquire the event handling lock. Returns 0 if the lock was obtained and 1 if not. void libusb _ lock _ events ( libusb _ context *ctx ) Acquire the event handling lock. This function is blocking. void libusb _ unlock _ events ( libusb _ context *ctx ) Release the event handling lock. This will wake up any thread blocked on libusb _ wait _ for _ event (). int libusb _ event _ handling _ ok ( libusb _ context *ctx ) Determine if it still OK for this thread to be doing event handling. Returns 1 if event han- dling can start or continue. Returns 0 if this thread must give up the events lock. int libusb _ event _ handler _ active ( libusb _ context *ctx ) Determine if an ac- tive thread is handling events. Returns 1 if there is a thread handling events and 0 if there are no threads currently handling events. void libusb _ interrupt _ event _ handler ( libusb _ context *ctx ) Causes the libusb _ handle _ events () familiy of functions to return to the caller one time. The libusb _ handle _ events () functions may be called again after calling this function. void libusb _ lock _ event _ waiters ( libusb _ context *ctx ) Acquire the event_waiters lock. This lock is designed to be obtained in the situa- tion where you want to be aware when events are completed, but some other thread is event handling so calling libusb _ handle _ events () is not al- lowed. void libusb _ unlock _ event _ waiters ( libusb _ context *ctx ) Release the event_waiters lock. int libusb _ wait _ for _ event ( libusb _ context *ctx , struct timeval *tv ) Wait for another thread to signal completion of an event. Must be called with the event waiters lock held, see libusb _ lock _ event _ waiters (). This will block until the timeout expires or a transfer completes or a thread re- leases the event handling lock through libusb _ unlock _ events (). Returns 0 after a transfer completes or another thread stops event handling, and 1 if the timeout expired. int libusb _ handle _ events _ timeout _ completed ( libusb _ context *ctx , struct timeval *tv , int *completed ) Handle any pending events by checking if timeouts have expired and by checking the set of file descriptors for ac- tivity. If the completed argument is not equal to NULL, this function will loop until a transfer completion callback sets the variable pointed to by the completed argument to non-zero. If the tv argument is not equal to NULL, this function will return LIBUSB_ERROR_TIMEOUT after the given timeout. Returns 0 on success, or a LIBUSB_ERROR code on failure or timeout. int libusb _ handle _ events _ completed ( libusb _ context *ctx , int *completed ) Handle any pending events by checking the set of file descriptors for ac- tivity. If the completed argument is not equal to NULL, this function will loop until a transfer completion callback sets the variable pointed to by the completed argument to non-zero. Returns 0 on success, or a LIBUSB_ERROR code on failure. int libusb _ handle _ events _ timeout ( libusb _ context *ctx , struct timeval *tv ) Handle any pending events by checking if timeouts have expired and by checking the set of file descriptors for activity. Returns 0 on success, or a LIBUSB_ERROR code on failure or timeout. int libusb _ handle _ events ( libusb _ context *ctx ) Handle any pending events in blocking mode with a sensible timeout. Returns 0 on success and a LIBUSB_ERROR code on failure. int libusb _ handle _ events _ locked ( libusb _ context *ctx , struct timeval *tv ) Handle any pending events by polling file descriptors, without checking if another thread is already doing so. Must be called with the event lock held. int libusb _ get _ next _ timeout ( libusb _ context *ctx , struct timeval *tv ) De- termine the next internal timeout that libusb needs to handle. Returns 0 if there are no pending timeouts, 1 if a timeout was returned, or a LIBUSB_ERROR code on failure or timeout. void libusb _ set _ pollfd _ notifiers ( libusb _ context *ctx , libusb _ pollfd _ added _ cb added _ cb , libusb _ pollfd _ removed _ cb remove _ cb , void *user _ data ) Register notification functions for file descriptor addi- tions/removals. These functions will be invoked for every new or removed file descriptor that libusb uses as an event source. const struct libusb _ pollfd ** libusb _ get _ pollfds ( libusb _ context *ctx ) Re- trieve a list of file descriptors that should be polled by your main loop as libusb event sources. Returns a NULL-terminated list on success or NULL on failure. int 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 ) This function regis- ters a hotplug filter. The events argument select which events makes the hotplug filter trigger. Available event values are LIBUSB_HOT- PLUG_EVENT_DEVICE_ARRIVED and LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT. One or more events must be specified. The vendor _ id , product _ id and dev _ class arguments can be set to LIBUSB_HOTPLUG_MATCH_ANY to match any value in the USB device descriptor. Else the specified value is used for match- ing. If the flags argument is set to LIBUSB_HOTPLUG_ENUMERATE, all cur- rently attached and matching USB devices will be passed to the hotplug filter, given by the cb _ fn argument. Else the flags argument should be set to LIBUSB_HOTPLUG_NO_FLAGS. This function returns 0 upon success or a LIBUSB_ERROR code on failure. int libusb _ hotplug _ callback _ fn ( libusb _ context *ctx , libusb _ device *device , libusb _ hotplug _ event event , void *user _ data ) The hotplug filter function. If this function returns non-zero, the filter is removed. Else the filter is kept and can receive more events. The user _ data argu- ment is the same as given when the filter was registered. The event ar- gument can be either of LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED or LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT. void libusb _ hotplug _ deregister _ callback ( libusb _ context *ctx , libusb _ hotplug _ callback _ handle handle ) This function unregisters a hot- plug filter. LIBUSB VERSION 0.1 COMPATIBILITY The library is also compliant with LibUSB version 0.1.12. usb _ open () usb _ close () usb _ get _ string () usb _ get _ string _ simple () usb _ get _ descriptor _ by _ endpoint () usb _ get _ descriptor () usb _ parse _ descriptor () usb _ parse _ configuration () usb _ destroy _ configuration () usb _ fetch _ and _ parse _ descriptors () usb _ bulk _ write () usb _ bulk _ read () usb _ interrupt _ write () usb _ interrupt _ read () usb _ control _ msg () usb _ set _ configuration () usb _ claim _ interface () usb _ release _ interface () usb _ set _ altinterface () usb _ resetep () usb _ clear _ halt () usb _ reset () usb _ strerror () usb _ init () usb _ set _ debug () usb _ find _ busses () usb _ find _ devices () usb _ device () usb _ get _ busses () usb _ check _ connected () usb _ get _ driver _ np () usb _ detach _ kernel _ driver _ np () SEE ALSO libusb20(3) , usb(4) , usbconfig(8) , usbdump(8) https://libusb.info/ HISTORY libusb support first appeared in FreeBSD 8.0. FreeBSD 13.0 October, 2, 2022 FreeBSD 13.0 NAME | LIBRARY | SYNOPSIS | DESCRIPTION | LIBRARY INITIALISATION AND DEINITIALISATION | USB DESCRIPTORS | USB ASYNCHRONOUS I/O | USB SYNCHRONOUS I/O | USB STREAMS SUPPORT | USB EVENTS | LIBUSB VERSION 0.1 COMPATIBILITY | SEE ALSO | HISTORY

Want to link to this manual page? Use this URL:
< https://man.freebsd.org/cgi/man.cgi?query=libusb&sektion=3&manpath=FreeBSD+13.2-RELEASE+and+Ports >

home | help Legal Notices | © 1995-2023 The FreeBSD Project. All rights reserved.