kinect_upload_fw: fix setting configuration for some devices
[kinect-audio-setup.git] / kinect_upload_fw / kinect_upload_fw.c
index b2188d6..e3b72db 100644 (file)
@@ -155,9 +155,19 @@ int main(int argc, char** argv) {
                goto fail_libusb_open;
        }
 
-       libusb_set_configuration(dev, 1);
+       int current_configuration = 0;
+       libusb_get_configuration(dev, &current_configuration);
+       if (current_configuration != 1)
+               libusb_set_configuration(dev, 1);
+
        libusb_claim_interface(dev, 0);
 
+       libusb_get_configuration(dev, &current_configuration);
+       if (current_configuration != 1) {
+               res = -ENODEV;
+               goto cleanup;
+       }
+
        seq = 1;
 
        bootloader_command cmd;