diff options
author | Peter Stuge <peter@stuge.se> | 2011-09-14 02:30:18 +0200 |
---|---|---|
committer | Peter Stuge <peter@stuge.se> | 2011-10-17 16:23:54 +0200 |
commit | e16805130a04b2642891e86b8f479e6343ca17da (patch) | |
tree | 4231d31eb62d51183c648d2ececd9e96fabcf6d1 /libusb/core.c | |
parent | 2dc2fa2a56408e515d25359323b4ea2f1bbec14a (diff) | |
download | libusbx-e16805130a04b2642891e86b8f479e6343ca17da.tar.gz |
Add libusb_has_capability() API function
Since it is currently not planned to change the filename of the libusb
library between libusb-1.0 versions at least on Windows systems it's
important to have a capability API.
Currently there exists only one capability; LIBUSB_CAP_HAS_CAPABILITY,
which tests support for the libusb_has_capability() API.
Diffstat (limited to 'libusb/core.c')
-rw-r--r-- | libusb/core.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/libusb/core.c b/libusb/core.c index 5834bea..0d05333 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -1664,6 +1664,22 @@ void API_EXPORTED libusb_exit(struct libusb_context *ctx) free(ctx); } +/** \ingroup misc + * Check at runtime if the loaded library has a given capability. + * + * \param capability the \ref libusb_capability to check for + * \returns 1 if the running library has the capability, 0 otherwise + */ +int API_EXPORTED libusb_has_capability(uint32_t capability) +{ + enum libusb_capability cap = capability; + switch (cap) { + case LIBUSB_CAP_HAS_CAPABILITY: + return 1; + } + return 0; +} + void usbi_log_v(struct libusb_context *ctx, enum usbi_log_level level, const char *function, const char *format, va_list args) { |