aboutsummaryrefslogtreecommitdiff
path: root/libusb/libusb.h
diff options
context:
space:
mode:
Diffstat (limited to 'libusb/libusb.h')
-rw-r--r--libusb/libusb.h55
1 files changed, 42 insertions, 13 deletions
diff --git a/libusb/libusb.h b/libusb/libusb.h
index 1308571..2592ea7 100644
--- a/libusb/libusb.h
+++ b/libusb/libusb.h
@@ -26,13 +26,19 @@
#define LIBUSB_H
#if defined(_MSC_VER)
+#pragma warning(push)
+/* Disable: warning C4200: nonstandard extension used : zero-sized array in struct/union */
+#pragma warning(disable:4200)
/* on MS environments, the inline keyword is available in C++ only */
#if !defined(__cplusplus)
#define inline __inline
#endif
/* ssize_t is also not available */
+#ifndef _SSIZE_T_DEFINED
+#define _SSIZE_T_DEFINED
#include <basetsd.h>
typedef SSIZE_T ssize_t;
+#endif /* _SSIZE_T_DEFINED */
#endif /* _MSC_VER */
#include <limits.h>
@@ -136,7 +142,7 @@ typedef SSIZE_T ssize_t;
* Internally, LIBUSB_API_VERSION is defined as follows:
* (libusb major << 24) | (libusb minor << 16) | (16 bit incremental)
*/
-#define LIBUSB_API_VERSION 0x01000108
+#define LIBUSB_API_VERSION 0x01000109
/* The following is kept for compatibility, but will be deprecated in the future */
#define LIBUSBX_API_VERSION LIBUSB_API_VERSION
@@ -904,7 +910,7 @@ struct libusb_container_id_descriptor {
/** \ingroup libusb_asyncio
* Setup packet for control transfers. */
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__WATCOMC__)
#pragma pack(push, 1)
#endif
struct libusb_control_setup {
@@ -932,7 +938,7 @@ struct libusb_control_setup {
/** Number of bytes to transfer */
uint16_t wLength;
} LIBUSB_PACKED;
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) || defined(__WATCOMC__)
#pragma pack(pop)
#endif
@@ -979,8 +985,9 @@ struct libusb_version {
* 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.
+ * every function call where a context is required, and the default context
+ * will be used. Note that libusb_set_option(NULL, ...) is special, and adds
+ * an option to a list of default options for new contexts.
*
* For more information, see \ref libusb_contexts.
*/
@@ -989,7 +996,7 @@ typedef struct libusb_context libusb_context;
/** \ingroup libusb_dev
* 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
- * originating from libusb_get_device_list().
+ * originating from libusb_get_device_list() or libusb_hotplug_register_callback().
*
* 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().
@@ -1325,6 +1332,9 @@ enum libusb_log_level {
/** \ingroup libusb_lib
* Log callback mode.
+ *
+ * Since version 1.0.23, \ref LIBUSB_API_VERSION >= 0x01000107
+ *
* \see libusb_set_log_cb()
*/
enum libusb_log_cb_mode {
@@ -1341,6 +1351,9 @@ enum libusb_log_cb_mode {
* is a global log message
* \param level the log level, see \ref libusb_log_level for a description
* \param str the log message
+ *
+ * Since version 1.0.23, \ref LIBUSB_API_VERSION >= 0x01000107
+ *
* \see libusb_set_log_cb()
*/
typedef void (LIBUSB_CALL *libusb_log_cb)(libusb_context *ctx,
@@ -2092,20 +2105,36 @@ enum libusb_option {
*/
LIBUSB_OPTION_USE_USBDK = 1,
- /** Set libusb has weak authority. With this option, libusb will skip
- * scan devices in libusb_init.
+ /** Do not scan for devices
+ *
+ * With this option set, libusb will skip scanning devices in
+ * libusb_init(). Must be set before calling libusb_init().
*
- * This option should be set before calling libusb_init(), otherwise
- * libusb_init will failed. Normally libusb_wrap_sys_device need set
- * this option.
+ * Hotplug functionality will also be deactivated.
*
- * Only valid on Linux-based operating system, such as Android.
+ * The option is useful in combination with libusb_wrap_sys_device(),
+ * which can access a device directly without prior device scanning.
+ *
+ * This is typically needed on Android, where access to USB devices
+ * is limited.
+ *
+ * For LIBUSB_API_VERSION 0x01000108 it was called LIBUSB_OPTION_WEAK_AUTHORITY
+ *
+ * Only valid on Linux.
*/
- LIBUSB_OPTION_WEAK_AUTHORITY = 2
+ LIBUSB_OPTION_NO_DEVICE_DISCOVERY = 2,
+
+#define LIBUSB_OPTION_WEAK_AUTHORITY LIBUSB_OPTION_NO_DEVICE_DISCOVERY
+
+ LIBUSB_OPTION_MAX = 3
};
int LIBUSB_CALL libusb_set_option(libusb_context *ctx, enum libusb_option option, ...);
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
#if defined(__cplusplus)
}
#endif