libusb.h | libusb.h | |||
---|---|---|---|---|
skipping to change at line 147 | skipping to change at line 147 | |||
* // Use one of the newer features from the libusb API | * // Use one of the newer features from the libusb API | |||
* #endif | * #endif | |||
* \endcode | * \endcode | |||
* | * | |||
* Another feature of LIBUSB_API_VERSION is that it can be used to detect | * Another feature of LIBUSB_API_VERSION is that it can be used to detect | |||
* whether you are compiling against the libusb or the libusb library. | * whether you are compiling against the libusb or the libusb library. | |||
* | * | |||
* Internally, LIBUSB_API_VERSION is defined as follows: | * Internally, LIBUSB_API_VERSION is defined as follows: | |||
* (libusb major << 24) | (libusb minor << 16) | (16 bit incremental) | * (libusb major << 24) | (libusb minor << 16) | (16 bit incremental) | |||
*/ | */ | |||
#define LIBUSB_API_VERSION 0x01000102 | #define LIBUSB_API_VERSION 0x01000103 | |||
/* The following is kept for compatibility, but will be deprecated in the f uture */ | /* The following is kept for compatibility, but will be deprecated in the f uture */ | |||
#define LIBUSBX_API_VERSION LIBUSB_API_VERSION | #define LIBUSBX_API_VERSION LIBUSB_API_VERSION | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/** | /** | |||
* \ingroup misc | * \ingroup misc | |||
skipping to change at line 346 | skipping to change at line 346 | |||
/** Control endpoint */ | /** Control endpoint */ | |||
LIBUSB_TRANSFER_TYPE_CONTROL = 0, | LIBUSB_TRANSFER_TYPE_CONTROL = 0, | |||
/** Isochronous endpoint */ | /** Isochronous endpoint */ | |||
LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1, | LIBUSB_TRANSFER_TYPE_ISOCHRONOUS = 1, | |||
/** Bulk endpoint */ | /** Bulk endpoint */ | |||
LIBUSB_TRANSFER_TYPE_BULK = 2, | LIBUSB_TRANSFER_TYPE_BULK = 2, | |||
/** Interrupt endpoint */ | /** Interrupt endpoint */ | |||
LIBUSB_TRANSFER_TYPE_INTERRUPT = 3 | LIBUSB_TRANSFER_TYPE_INTERRUPT = 3, | |||
/** Stream endpoint */ | ||||
LIBUSB_TRANSFER_TYPE_BULK_STREAM = 4, | ||||
}; | }; | |||
/** \ingroup misc | /** \ingroup misc | |||
* Standard requests, as defined in table 9-5 of the USB 3.0 specifications */ | * Standard requests, as defined in table 9-5 of the USB 3.0 specifications */ | |||
enum libusb_standard_request { | enum libusb_standard_request { | |||
/** Request status of the specific recipient */ | /** Request status of the specific recipient */ | |||
LIBUSB_REQUEST_GET_STATUS = 0x00, | LIBUSB_REQUEST_GET_STATUS = 0x00, | |||
/** Clear or disable a specific feature */ | /** Clear or disable a specific feature */ | |||
LIBUSB_REQUEST_CLEAR_FEATURE = 0x01, | LIBUSB_REQUEST_CLEAR_FEATURE = 0x01, | |||
skipping to change at line 1388 | skipping to change at line 1391 | |||
libusb_device_handle * LIBUSB_CALL libusb_open_device_with_vid_pid( | libusb_device_handle * LIBUSB_CALL libusb_open_device_with_vid_pid( | |||
libusb_context *ctx, uint16_t vendor_id, uint16_t product_id); | libusb_context *ctx, uint16_t vendor_id, uint16_t product_id); | |||
int LIBUSB_CALL libusb_set_interface_alt_setting(libusb_device_handle *dev, | int LIBUSB_CALL libusb_set_interface_alt_setting(libusb_device_handle *dev, | |||
int interface_number, int alternate_setting); | int interface_number, int alternate_setting); | |||
int LIBUSB_CALL libusb_clear_halt(libusb_device_handle *dev, | int LIBUSB_CALL libusb_clear_halt(libusb_device_handle *dev, | |||
unsigned char endpoint); | unsigned char endpoint); | |||
int LIBUSB_CALL libusb_reset_device(libusb_device_handle *dev); | int LIBUSB_CALL libusb_reset_device(libusb_device_handle *dev); | |||
int LIBUSB_CALL libusb_alloc_streams(libusb_device_handle *dev, | ||||
uint32_t num_streams, unsigned char *endpoints, int num_endpoints); | ||||
int LIBUSB_CALL libusb_free_streams(libusb_device_handle *dev, | ||||
unsigned char *endpoints, int num_endpoints); | ||||
int LIBUSB_CALL libusb_kernel_driver_active(libusb_device_handle *dev, | int LIBUSB_CALL libusb_kernel_driver_active(libusb_device_handle *dev, | |||
int interface_number); | int interface_number); | |||
int LIBUSB_CALL libusb_detach_kernel_driver(libusb_device_handle *dev, | int LIBUSB_CALL libusb_detach_kernel_driver(libusb_device_handle *dev, | |||
int interface_number); | int interface_number); | |||
int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev, | int LIBUSB_CALL libusb_attach_kernel_driver(libusb_device_handle *dev, | |||
int interface_number); | int interface_number); | |||
int LIBUSB_CALL libusb_set_auto_detach_kernel_driver( | int LIBUSB_CALL libusb_set_auto_detach_kernel_driver( | |||
libusb_device_handle *dev, int enable); | libusb_device_handle *dev, int enable); | |||
/* async I/O */ | /* async I/O */ | |||
skipping to change at line 1474 | skipping to change at line 1482 | |||
setup->bRequest = bRequest; | setup->bRequest = bRequest; | |||
setup->wValue = libusb_cpu_to_le16(wValue); | setup->wValue = libusb_cpu_to_le16(wValue); | |||
setup->wIndex = libusb_cpu_to_le16(wIndex); | setup->wIndex = libusb_cpu_to_le16(wIndex); | |||
setup->wLength = libusb_cpu_to_le16(wLength); | setup->wLength = libusb_cpu_to_le16(wLength); | |||
} | } | |||
struct libusb_transfer * LIBUSB_CALL libusb_alloc_transfer(int iso_packets) ; | struct libusb_transfer * LIBUSB_CALL libusb_alloc_transfer(int iso_packets) ; | |||
int LIBUSB_CALL libusb_submit_transfer(struct libusb_transfer *transfer); | int LIBUSB_CALL libusb_submit_transfer(struct libusb_transfer *transfer); | |||
int LIBUSB_CALL libusb_cancel_transfer(struct libusb_transfer *transfer); | int LIBUSB_CALL libusb_cancel_transfer(struct libusb_transfer *transfer); | |||
void LIBUSB_CALL libusb_free_transfer(struct libusb_transfer *transfer); | void LIBUSB_CALL libusb_free_transfer(struct libusb_transfer *transfer); | |||
void LIBUSB_CALL libusb_transfer_set_stream_id( | ||||
struct libusb_transfer *transfer, uint32_t stream_id); | ||||
uint32_t LIBUSB_CALL libusb_transfer_get_stream_id( | ||||
struct libusb_transfer *transfer); | ||||
/** \ingroup asyncio | /** \ingroup asyncio | |||
* Helper function to populate the required \ref libusb_transfer fields | * Helper function to populate the required \ref libusb_transfer fields | |||
* for a control transfer. | * for a control transfer. | |||
* | * | |||
* If you pass a transfer buffer to this function, the first 8 bytes will | * If you pass a transfer buffer to this function, the first 8 bytes will | |||
* be interpreted as a control setup packet, and the wLength field will be | * be interpreted as a control setup packet, and the wLength field will be | |||
* used to automatically populate the \ref libusb_transfer::length "length" | * used to automatically populate the \ref libusb_transfer::length "length" | |||
* field of the transfer. Therefore the recommended approach is: | * field of the transfer. Therefore the recommended approach is: | |||
* -# Allocate a suitably sized data buffer (including space for control se tup) | * -# Allocate a suitably sized data buffer (including space for control se tup) | |||
skipping to change at line 1551 | skipping to change at line 1563 | |||
transfer->type = LIBUSB_TRANSFER_TYPE_BULK; | transfer->type = LIBUSB_TRANSFER_TYPE_BULK; | |||
transfer->timeout = timeout; | transfer->timeout = timeout; | |||
transfer->buffer = buffer; | transfer->buffer = buffer; | |||
transfer->length = length; | transfer->length = length; | |||
transfer->user_data = user_data; | transfer->user_data = user_data; | |||
transfer->callback = callback; | transfer->callback = callback; | |||
} | } | |||
/** \ingroup asyncio | /** \ingroup asyncio | |||
* Helper function to populate the required \ref libusb_transfer fields | * Helper function to populate the required \ref libusb_transfer fields | |||
* for a bulk transfer using bulk streams. | ||||
* | ||||
* Since version 1.0.19, \ref LIBUSB_API_VERSION >= 0x01000103 | ||||
* | ||||
* \param transfer the transfer to populate | ||||
* \param dev_handle handle of the device that will handle the transfer | ||||
* \param endpoint address of the endpoint where this transfer will be sent | ||||
* \param stream_id bulk stream id for this transfer | ||||
* \param buffer data buffer | ||||
* \param length length of data buffer | ||||
* \param callback callback function to be invoked on transfer completion | ||||
* \param user_data user data to pass to callback function | ||||
* \param timeout timeout for the transfer in milliseconds | ||||
*/ | ||||
static inline void libusb_fill_bulk_stream_transfer( | ||||
struct libusb_transfer *transfer, libusb_device_handle *dev_handle, | ||||
unsigned char endpoint, uint32_t stream_id, | ||||
unsigned char *buffer, int length, libusb_transfer_cb_fn callback, | ||||
void *user_data, unsigned int timeout) | ||||
{ | ||||
libusb_fill_bulk_transfer(transfer, dev_handle, endpoint, buffer, | ||||
length, callback, user_data, timeout); | ||||
transfer->type = LIBUSB_TRANSFER_TYPE_BULK_STREAM; | ||||
libusb_transfer_set_stream_id(transfer, stream_id); | ||||
} | ||||
/** \ingroup asyncio | ||||
* Helper function to populate the required \ref libusb_transfer fields | ||||
* for an interrupt transfer. | * for an interrupt transfer. | |||
* | * | |||
* \param transfer the transfer to populate | * \param transfer the transfer to populate | |||
* \param dev_handle handle of the device that will handle the transfer | * \param dev_handle handle of the device that will handle the transfer | |||
* \param endpoint address of the endpoint where this transfer will be sent | * \param endpoint address of the endpoint where this transfer will be sent | |||
* \param buffer data buffer | * \param buffer data buffer | |||
* \param length length of data buffer | * \param length length of data buffer | |||
* \param callback callback function to be invoked on transfer completion | * \param callback callback function to be invoked on transfer completion | |||
* \param user_data user data to pass to callback function | * \param user_data user data to pass to callback function | |||
* \param timeout timeout for the transfer in milliseconds | * \param timeout timeout for the transfer in milliseconds | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 42 lines changed or added | |||