libusb
|
Macros | |
#define | LIBUSB_CALL |
libusb's Windows calling convention. | |
#define | libusb_le16_to_cpu libusb_cpu_to_le16 |
Convert a 16-bit value from little-endian to host-endian format. |
Functions | |
int | libusb_has_capability (uint32_t capability) |
Check at runtime if the loaded library has a given capability. | |
const char * | libusb_error_name (int error_code) |
Returns a constant NULL-terminated string with the ASCII name of a libusb error code. | |
struct libusb_version * | libusb_get_version (void) |
Returns a pointer to const struct libusb_version with the version (major, minor, micro, rc, and nano) of the running library. |
#define LIBUSB_CALL |
libusb's Windows calling convention.
Under Windows, the selection of available compilers and configurations means that, unlike other platforms, there is not one true calling convention (calling convention: the manner in which parameters are passed to funcions in the generated assembly code).
Matching the Windows API itself, libusb uses the WINAPI convention (which translates to the stdcall
convention) and guarantees that the library is compiled in this way. The public header file also includes appropriate annotations so that your own software will use the right convention, even if another convention is being used by default within your codebase.
The one consideration that you must apply in your software is to mark all functions which you use as libusb callbacks with this LIBUSB_CALL annotation, so that they too get compiled for the correct calling convention.
On non-Windows operating systems, this macro is defined as nothing. This means that you can apply it to your code without worrying about cross-platform compatibility.
#define libusb_le16_to_cpu libusb_cpu_to_le16 |
Convert a 16-bit value from little-endian to host-endian format.
On little endian systems, this function does nothing. On big endian systems, the bytes are swapped.
x | the little-endian value to convert |
Standard requests, as defined in table 9-3 of the USB2 specifications.
enum libusb_request_type |
Request type bits of the bmRequestType field in control transfers.
Recipient bits of the bmRequestType field in control transfers.
Values 4 through 31 are reserved.
enum libusb_error |
Error codes.
Most libusb functions return 0 on success or one of these codes on failure. You can call libusb_error_name() to retrieve a string representation of an error code.
enum libusb_capability |
Capabilities supported by this instance of libusb.
Test if the loaded library supports a given capability by calling libusb_has_capability().
LIBUSB_CAP_HAS_CAPABILITY |
The libusb_has_capability() API is available. |
LIBUSB_CAP_HAS_HOTPLUG |
The libusb hotplug API is available. |
int libusb_has_capability | ( | uint32_t | capability | ) |
Check at runtime if the loaded library has a given capability.
capability | the libusb_capability to check for |
const char* libusb_error_name | ( | int | error_code | ) |
Returns a constant NULL-terminated string with the ASCII name of a libusb error code.
The caller must not free() the returned string.
error_code | The libusb_error code to return the name of. |