summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pete@akeo.ie>2012-09-15 23:57:21 +0100
committerPete Batard <pete@akeo.ie>2012-09-15 23:57:21 +0100
commit9d368fc4774344d81ab02840f3a8478301bfb6fa (patch)
treeefe5f1c65b1c2601f7d624b0f334c86aaa989bb3
parent75b94b24cf2a7b082b7fe1d493ebbdc3c999f910 (diff)
downloadlibusb-9d368fc4774344d81ab02840f3a8478301bfb6fa.tar.gz
Core: Introduce LIBUSBX_API_VERSION macro
* This macro can be used to detect if the version of libusbx being compiled against has a specific API feature, as well as to detect whether compilation occurs against libusb or libusbx.
-rw-r--r--libusb/libusb.h23
-rw-r--r--libusb/version_nano.h2
2 files changed, 24 insertions, 1 deletions
diff --git a/libusb/libusb.h b/libusb/libusb.h
index b166126..fd1a210 100644
--- a/libusb/libusb.h
+++ b/libusb/libusb.h
@@ -107,6 +107,29 @@ typedef unsigned __int32 uint32_t;
#define LIBUSB_CALL
#endif
+/** \def LIBUSBX_API_VERSION
+ * \ingroup misc
+ * libusbx's API version.
+ *
+ * Since version 1.0.13, to help with feature detection, libusbx defines
+ * a LIBUSBX_API_VERSION macro that gets increased every time there is a
+ * significant change to the API, such as the introduction of a new call,
+ * the definition of a new macro/enum member, or any other element that
+ * libusbx applications may want to detect at compilation time.
+ *
+ * The macro is typically used in an application as follows:
+ * #if defined(LIBUSBX_API_VERSION) && (LIBUSBX_API_VERSION >= 0x01001234)
+ * // Use one of the newer features from the libusbx API
+ * #endif
+ *
+ * Another feature of LIBUSBX_API_VERSION is that it can be used to detect
+ * whether you are compiling against the libusb or the libusbx library.
+ *
+ * Internally, LIBUSBX_API_VERSION is defined as follows:
+ * (libusbx major << 24) | (libusbx minor << 16) | (16 bit incremental)
+ */
+#define LIBUSBX_API_VERSION 0x01000100
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index dc44fe4..b4791e4 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 10567
+#define LIBUSB_NANO 10568