Windows: Fix logic in enumeration of driver name and port number
authorPete Batard <pbatard@gmail.com>
Tue, 5 Oct 2010 11:50:53 +0000 (12:50 +0100)
committerPeter Stuge <peter@stuge.se>
Mon, 13 Jun 2011 20:01:43 +0000 (22:01 +0200)
libusb/os/windows_usb.c

index 9498e14..83a4606 100644 (file)
@@ -1433,7 +1433,7 @@ static int set_device_paths(struct libusb_context *ctx, struct discovered_devs *
                // Check that the driver installation is OK
                if ( (!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_INSTALL_STATE,
                        &reg_type, (BYTE*)&install_state, 4, &size))
-                 && (size != 4) ){
+                 || (size != 4) ){
                        usbi_warn(ctx, "could not detect installation state of driver for %s: %s",
                                dev_interface_details->DevicePath, windows_error_str(0));
                } else if (install_state != 0) {
@@ -1445,7 +1445,7 @@ static int set_device_paths(struct libusb_context *ctx, struct discovered_devs *
                // The SPDRP_ADDRESS for USB devices should be the device port number on the hub
                if ( (!SetupDiGetDeviceRegistryProperty(dev_info, &dev_info_data, SPDRP_ADDRESS,
                        &reg_type, (BYTE*)&port_nr, 4, &size))
-                 && (size != 4) ){
+                 || (size != 4) ){
                        usbi_warn(ctx, "could not retrieve port number for device %s, skipping: %s",
                                dev_interface_details->DevicePath, windows_error_str(0));
                        continue;