Keep LIBUSB_OPTION_WEAK_AUTHORITY as a macro with same value
authorTormod Volden <debian.tormod@gmail.com>
Fri, 1 Oct 2021 22:05:32 +0000 (00:05 +0200)
committerNathan Hjelm <hjelmn@me.com>
Sat, 27 Nov 2021 17:04:05 +0000 (10:04 -0700)
If the value is always the same we retain binary compatibility.

References #935

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Signed-off-by: Nathan Hjelm <hjelmn@me.com>
libusb/core.c
libusb/libusb.h
libusb/os/linux_usbfs.c
libusb/version_nano.h

index 8ebf08b..7893ac2 100644 (file)
@@ -2229,7 +2229,6 @@ int API_EXPORTED libusb_set_option(libusb_context *ctx,
                /* Handle all backend-specific options here */
        case LIBUSB_OPTION_USE_USBDK:
        case LIBUSB_OPTION_NO_DEVICE_DISCOVERY:
-       case LIBUSB_OPTION_WEAK_AUTHORITY:
                if (usbi_backend.set_option)
                        return usbi_backend.set_option(ctx, option, ap);
 
index 7ec3fcf..53aeec5 100644 (file)
@@ -2115,17 +2115,15 @@ enum libusb_option {
         * 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_NO_DEVICE_DISCOVERY = 2,
 
-       /** Flag that libusb has weak authority.
-        *
-        * (Deprecated) alias for LIBUSB_OPTION_NO_DEVICE_DISCOVERY
-        */
-       LIBUSB_OPTION_WEAK_AUTHORITY = 3,
+#define LIBUSB_OPTION_WEAK_AUTHORITY LIBUSB_OPTION_NO_DEVICE_DISCOVERY
 
-       LIBUSB_OPTION_MAX = 4
+       LIBUSB_OPTION_MAX = 3
 };
 
 int LIBUSB_CALL libusb_set_option(libusb_context *ctx, enum libusb_option option, ...);
index 1888c92..c300675 100644 (file)
@@ -439,8 +439,7 @@ static int op_set_option(struct libusb_context *ctx, enum libusb_option option,
        UNUSED(ctx);
        UNUSED(ap);
 
-       if (option == LIBUSB_OPTION_NO_DEVICE_DISCOVERY ||
-           option == LIBUSB_OPTION_WEAK_AUTHORITY) {
+       if (option == LIBUSB_OPTION_NO_DEVICE_DISCOVERY) {
                usbi_dbg(ctx, "no enumeration will be performed");
                no_enumeration = 1;
                return LIBUSB_SUCCESS;
index d5d1fd2..ff0c997 100644 (file)
@@ -1 +1 @@
-#define LIBUSB_NANO 11676
+#define LIBUSB_NANO 11678