libusb.h | libusb.h | |||
---|---|---|---|---|
skipping to change at line 536 | skipping to change at line 536 | |||
uint16_t wIndex; | uint16_t wIndex; | |||
/** Number of bytes to transfer */ | /** Number of bytes to transfer */ | |||
uint16_t wLength; | uint16_t wLength; | |||
}; | }; | |||
#define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup)) | #define LIBUSB_CONTROL_SETUP_SIZE (sizeof(struct libusb_control_setup)) | |||
/* libusb */ | /* libusb */ | |||
struct libusb_context; | ||||
struct libusb_device; | struct libusb_device; | |||
struct libusb_device_handle; | struct libusb_device_handle; | |||
/** \ingroup lib | ||||
* Structure representing a libusb session. The concept of individual libus | ||||
b | ||||
* sessions allows for your program to use two libraries (or dynamically | ||||
* load two modules) which both independently use libusb. This will prevent | ||||
* interference between the individual libusb users - for example | ||||
* libusb_set_debug() will not affect the other user of the library, and | ||||
* libusb_exit() will not destroy resources that the other user is still | ||||
* using. | ||||
* | ||||
* Sessions are created by libusb_init() and destroyed through libusb_exit( | ||||
). | ||||
* If your application is guaranteed to only ever include a single libusb | ||||
* user (i.e. you), you do not have to worry about contexts: pass NULL in | ||||
* every function call where a context is required. The default context | ||||
* will be used. | ||||
* | ||||
* For more information, see \ref contexts. | ||||
*/ | ||||
typedef struct libusb_context libusb_context; | ||||
/** \ingroup dev | /** \ingroup dev | |||
* Structure representing a USB device detected on the system. This is an | * Structure representing a USB device detected on the system. This is an | |||
* opaque type for which you are only ever provided with a pointer, usually | * opaque type for which you are only ever provided with a pointer, usually | |||
* originating from libusb_get_device_list(). | * originating from libusb_get_device_list(). | |||
* | * | |||
* Certain operations can be performed on a device, but in order to do any | * Certain operations can be performed on a device, but in order to do any | |||
* I/O you will have to first obtain a device handle using libusb_open(). | * I/O you will have to first obtain a device handle using libusb_open(). | |||
* | * | |||
* Devices are reference counted with libusb_device_ref() and | * Devices are reference counted with libusb_device_ref() and | |||
* libusb_device_unref(), and are freed when the reference count reaches 0. | * libusb_device_unref(), and are freed when the reference count reaches 0. | |||
skipping to change at line 595 | skipping to change at line 615 | |||
/** Entity not found */ | /** Entity not found */ | |||
LIBUSB_ERROR_NOT_FOUND = -5, | LIBUSB_ERROR_NOT_FOUND = -5, | |||
/** Resource busy */ | /** Resource busy */ | |||
LIBUSB_ERROR_BUSY = -6, | LIBUSB_ERROR_BUSY = -6, | |||
/** Operation timed out */ | /** Operation timed out */ | |||
LIBUSB_ERROR_TIMEOUT = -7, | LIBUSB_ERROR_TIMEOUT = -7, | |||
/** Overflow */ | ||||
LIBUSB_ERROR_OVERFLOW = -8, | ||||
/** Pipe error */ | /** Pipe error */ | |||
LIBUSB_ERROR_PIPE = -8, | LIBUSB_ERROR_PIPE = -9, | |||
/** System call interrupted (perhaps due to signal) */ | /** System call interrupted (perhaps due to signal) */ | |||
LIBUSB_ERROR_INTERRUPTED = -9, | LIBUSB_ERROR_INTERRUPTED = -10, | |||
/** Insufficient memory */ | /** Insufficient memory */ | |||
LIBUSB_ERROR_NO_MEM = -10, | LIBUSB_ERROR_NO_MEM = -11, | |||
/** Operation not supported or unimplemented on this platform */ | /** Operation not supported or unimplemented on this platform */ | |||
LIBUSB_ERROR_NOT_SUPPORTED = -11, | LIBUSB_ERROR_NOT_SUPPORTED = -12, | |||
/** Other error */ | /** Other error */ | |||
LIBUSB_ERROR_OTHER = -12, | LIBUSB_ERROR_OTHER = -99, | |||
}; | }; | |||
/** \ingroup asyncio | /** \ingroup asyncio | |||
* Transfer status codes */ | * Transfer status codes */ | |||
enum libusb_transfer_status { | enum libusb_transfer_status { | |||
/** Transfer completed without error. Note that this does not indica te | /** Transfer completed without error. Note that this does not indica te | |||
* that the entire amount of requested data was transferred. */ | * that the entire amount of requested data was transferred. */ | |||
LIBUSB_TRANSFER_COMPLETED, | LIBUSB_TRANSFER_COMPLETED, | |||
/** Transfer failed */ | /** Transfer failed */ | |||
skipping to change at line 633 | skipping to change at line 656 | |||
/** Transfer was cancelled */ | /** Transfer was cancelled */ | |||
LIBUSB_TRANSFER_CANCELLED, | LIBUSB_TRANSFER_CANCELLED, | |||
/** For bulk/interrupt endpoints: halt condition detected (endpoint | /** For bulk/interrupt endpoints: halt condition detected (endpoint | |||
* stalled). For control endpoints: control request not supported. * / | * stalled). For control endpoints: control request not supported. * / | |||
LIBUSB_TRANSFER_STALL, | LIBUSB_TRANSFER_STALL, | |||
/** Device was disconnected */ | /** Device was disconnected */ | |||
LIBUSB_TRANSFER_NO_DEVICE, | LIBUSB_TRANSFER_NO_DEVICE, | |||
/** Device sent more data than requested */ | ||||
LIBUSB_TRANSFER_OVERFLOW, | ||||
}; | }; | |||
/** \ingroup asyncio | /** \ingroup asyncio | |||
* libusb_transfer.flags values */ | * libusb_transfer.flags values */ | |||
enum libusb_transfer_flags { | enum libusb_transfer_flags { | |||
/** Report short frames as errors */ | /** Report short frames as errors */ | |||
LIBUSB_TRANSFER_SHORT_NOT_OK = 1<<0, | LIBUSB_TRANSFER_SHORT_NOT_OK = 1<<0, | |||
/** Automatically free() transfer buffer during libusb_free_transfer () */ | /** Automatically free() transfer buffer during libusb_free_transfer () */ | |||
LIBUSB_TRANSFER_FREE_BUFFER = 1<<1, | LIBUSB_TRANSFER_FREE_BUFFER = 1<<1, | |||
skipping to change at line 723 | skipping to change at line 749 | |||
unsigned char *buffer; | unsigned char *buffer; | |||
/** Number of isochronous packets. Only used for I/O with isochronou s | /** Number of isochronous packets. Only used for I/O with isochronou s | |||
* endpoints. */ | * endpoints. */ | |||
int num_iso_packets; | int num_iso_packets; | |||
/** Isochronous packet descriptors, for isochronous transfers only. */ | /** Isochronous packet descriptors, for isochronous transfers only. */ | |||
struct libusb_iso_packet_descriptor iso_packet_desc[0]; | struct libusb_iso_packet_descriptor iso_packet_desc[0]; | |||
}; | }; | |||
int libusb_init(void); | int libusb_init(libusb_context **ctx); | |||
void libusb_exit(void); | void libusb_exit(libusb_context *ctx); | |||
void libusb_set_debug(int level); | void libusb_set_debug(libusb_context *ctx, int level); | |||
ssize_t libusb_get_device_list(libusb_device ***list); | ssize_t libusb_get_device_list(libusb_context *ctx, | |||
libusb_device ***list); | ||||
void libusb_free_device_list(libusb_device **list, int unref_devices); | void libusb_free_device_list(libusb_device **list, int unref_devices); | |||
libusb_device *libusb_ref_device(libusb_device *dev); | libusb_device *libusb_ref_device(libusb_device *dev); | |||
void libusb_unref_device(libusb_device *dev); | void libusb_unref_device(libusb_device *dev); | |||
int libusb_get_device_descriptor(libusb_device *dev, | int libusb_get_device_descriptor(libusb_device *dev, | |||
struct libusb_device_descriptor *desc); | struct libusb_device_descriptor *desc); | |||
int libusb_get_active_config_descriptor(libusb_device *dev, | int libusb_get_active_config_descriptor(libusb_device *dev, | |||
struct libusb_config_descriptor **config); | struct libusb_config_descriptor **config); | |||
int libusb_get_config_descriptor(libusb_device *dev, uint8_t config_index, | int libusb_get_config_descriptor(libusb_device *dev, uint8_t config_index, | |||
struct libusb_config_descriptor **config); | struct libusb_config_descriptor **config); | |||
skipping to change at line 753 | skipping to change at line 780 | |||
int libusb_get_max_packet_size(libusb_device *dev, unsigned char endpoint); | int libusb_get_max_packet_size(libusb_device *dev, unsigned char endpoint); | |||
int libusb_open(libusb_device *dev, libusb_device_handle **handle); | int libusb_open(libusb_device *dev, libusb_device_handle **handle); | |||
void libusb_close(libusb_device_handle *dev_handle); | void libusb_close(libusb_device_handle *dev_handle); | |||
libusb_device *libusb_get_device(libusb_device_handle *dev_handle); | libusb_device *libusb_get_device(libusb_device_handle *dev_handle); | |||
int libusb_set_configuration(libusb_device_handle *dev, int configuration); | int libusb_set_configuration(libusb_device_handle *dev, int configuration); | |||
int libusb_claim_interface(libusb_device_handle *dev, int iface); | int libusb_claim_interface(libusb_device_handle *dev, int iface); | |||
int libusb_release_interface(libusb_device_handle *dev, int iface); | int libusb_release_interface(libusb_device_handle *dev, int iface); | |||
libusb_device_handle *libusb_open_device_with_vid_pid(uint16_t vendor_id, | libusb_device_handle *libusb_open_device_with_vid_pid(libusb_context *ctx, | |||
uint16_t product_id); | uint16_t vendor_id, uint16_t product_id); | |||
int libusb_set_interface_alt_setting(libusb_device_handle *dev, | int libusb_set_interface_alt_setting(libusb_device_handle *dev, | |||
int interface_number, int alternate_setting); | int interface_number, int alternate_setting); | |||
int libusb_clear_halt(libusb_device_handle *dev, unsigned char endpoint); | int libusb_clear_halt(libusb_device_handle *dev, unsigned char endpoint); | |||
int libusb_reset_device(libusb_device_handle *dev); | int libusb_reset_device(libusb_device_handle *dev); | |||
int libusb_kernel_driver_active(libusb_device_handle *dev, int interface); | int libusb_kernel_driver_active(libusb_device_handle *dev, int interface); | |||
int libusb_detach_kernel_driver(libusb_device_handle *dev, int interface); | int libusb_detach_kernel_driver(libusb_device_handle *dev, int interface); | |||
/* async I/O */ | /* async I/O */ | |||
skipping to change at line 1108 | skipping to change at line 1135 | |||
return libusb_control_transfer(dev, LIBUSB_ENDPOINT_IN, | return libusb_control_transfer(dev, LIBUSB_ENDPOINT_IN, | |||
LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_STRING << 8) | des c_index, | LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_STRING << 8) | des c_index, | |||
langid, data, length, 1000); | langid, data, length, 1000); | |||
} | } | |||
int libusb_get_string_descriptor_ascii(libusb_device_handle *dev, | int libusb_get_string_descriptor_ascii(libusb_device_handle *dev, | |||
uint8_t index, unsigned char *data, int length); | uint8_t index, unsigned char *data, int length); | |||
/* polling and timeouts */ | /* polling and timeouts */ | |||
int libusb_try_lock_events(void); | int libusb_try_lock_events(libusb_context *ctx); | |||
void libusb_lock_events(void); | void libusb_lock_events(libusb_context *ctx); | |||
void libusb_unlock_events(void); | void libusb_unlock_events(libusb_context *ctx); | |||
int libusb_event_handler_active(void); | int libusb_event_handler_active(libusb_context *ctx); | |||
void libusb_lock_event_waiters(void); | void libusb_lock_event_waiters(libusb_context *ctx); | |||
void libusb_unlock_event_waiters(void); | void libusb_unlock_event_waiters(libusb_context *ctx); | |||
int libusb_wait_for_event(struct timeval *tv); | int libusb_wait_for_event(libusb_context *ctx, struct timeval *tv); | |||
int libusb_handle_events_timeout(struct timeval *tv); | int libusb_handle_events_timeout(libusb_context *ctx, struct timeval *tv); | |||
int libusb_handle_events(void); | int libusb_handle_events(libusb_context *ctx); | |||
int libusb_handle_events_locked(struct timeval *tv); | int libusb_handle_events_locked(libusb_context *ctx, struct timeval *tv); | |||
int libusb_get_next_timeout(struct timeval *tv); | int libusb_get_next_timeout(libusb_context *ctx, struct timeval *tv); | |||
/** \ingroup poll | /** \ingroup poll | |||
* File descriptor for polling | * File descriptor for polling | |||
*/ | */ | |||
struct libusb_pollfd { | struct libusb_pollfd { | |||
/** Numeric file descriptor */ | /** Numeric file descriptor */ | |||
int fd; | int fd; | |||
/** Event flags to poll for from <poll.h>. POLLIN indicates that you | /** Event flags to poll for from <poll.h>. POLLIN indicates that you | |||
* should monitor this file descriptor for becoming ready to read fr om, | * should monitor this file descriptor for becoming ready to read fr om, | |||
skipping to change at line 1141 | skipping to change at line 1168 | |||
* nonblocking write readiness. */ | * nonblocking write readiness. */ | |||
short events; | short events; | |||
}; | }; | |||
/** \ingroup poll | /** \ingroup poll | |||
* Callback function, invoked when a new file descriptor should be added | * Callback function, invoked when a new file descriptor should be added | |||
* to the set of file descriptors monitored for events. | * to the set of file descriptors monitored for events. | |||
* \param fd the new file descriptor | * \param fd the new file descriptor | |||
* \param events events to monitor for, see \ref libusb_pollfd for a | * \param events events to monitor for, see \ref libusb_pollfd for a | |||
* description | * description | |||
* \param user_data User data pointer specified in | ||||
* libusb_set_pollfd_notifiers() call | ||||
* \see libusb_set_pollfd_notifiers() | * \see libusb_set_pollfd_notifiers() | |||
*/ | */ | |||
typedef void (*libusb_pollfd_added_cb)(int fd, short events); | typedef void (*libusb_pollfd_added_cb)(int fd, short events, void *user_dat a); | |||
/** \ingroup poll | /** \ingroup poll | |||
* Callback function, invoked when a file descriptor should be removed from | * Callback function, invoked when a file descriptor should be removed from | |||
* the set of file descriptors being monitored for events. After returning | * the set of file descriptors being monitored for events. After returning | |||
* from this callback, do not use that file descriptor again. | * from this callback, do not use that file descriptor again. | |||
* \param fd the file descriptor to stop monitoring | * \param fd the file descriptor to stop monitoring | |||
* \param user_data User data pointer specified in | ||||
* libusb_set_pollfd_notifiers() call | ||||
* \see libusb_set_pollfd_notifiers() | * \see libusb_set_pollfd_notifiers() | |||
*/ | */ | |||
typedef void (*libusb_pollfd_removed_cb)(int fd); | typedef void (*libusb_pollfd_removed_cb)(int fd, void *user_data); | |||
const struct libusb_pollfd **libusb_get_pollfds(void); | const struct libusb_pollfd **libusb_get_pollfds(libusb_context *ctx); | |||
void libusb_set_pollfd_notifiers(libusb_pollfd_added_cb added_cb, | void libusb_set_pollfd_notifiers(libusb_context *ctx, | |||
libusb_pollfd_removed_cb removed_cb); | libusb_pollfd_added_cb added_cb, libusb_pollfd_removed_cb removed_cb | |||
, | ||||
void *user_data); | ||||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} | } | |||
#endif | #endif | |||
#endif | #endif | |||
End of changes. 19 change blocks. | ||||
27 lines changed or deleted | 62 lines changed or added | |||