doc: Explain default options in libusb_set_option documentation
[platform/upstream/libusb.git] / libusb / libusb.h
index c958113..7ec3fcf 100644 (file)
 #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>
@@ -979,8 +982,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 +993,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().
@@ -2098,20 +2102,30 @@ enum libusb_option {
         */
        LIBUSB_OPTION_USE_USBDK = 1,
 
-       /** Flag that libusb has weak authority.
+       /** Do not scan for devices
         *
         * With this option set, libusb will skip scanning devices in
-        * libusb_init().
+        * libusb_init(). Must be set before calling libusb_init().
+        *
+        * Hotplug functionality will also be deactivated.
         *
-        * This option should be set before calling libusb_init(), otherwise
-        * libusb_init() might fail. The option is typically needed on Android
-        * and used together with libusb_wrap_sys_device().
+        * 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.
         *
         * Only valid on Linux.
         */
-       LIBUSB_OPTION_WEAK_AUTHORITY = 2,
+       LIBUSB_OPTION_NO_DEVICE_DISCOVERY = 2,
+
+       /** Flag that libusb has weak authority.
+        *
+        * (Deprecated) alias for LIBUSB_OPTION_NO_DEVICE_DISCOVERY
+        */
+       LIBUSB_OPTION_WEAK_AUTHORITY = 3,
 
-       LIBUSB_OPTION_MAX = 3
+       LIBUSB_OPTION_MAX = 4
 };
 
 int LIBUSB_CALL libusb_set_option(libusb_context *ctx, enum libusb_option option, ...);