goto fail_libusb_open;
}
- libusb_set_configuration(dev, 1);
+ int current_configuration = 0;
+ libusb_get_configuration(dev, ¤t_configuration);
+ if (current_configuration != 1)
+ libusb_set_configuration(dev, 1);
+
libusb_claim_interface(dev, 0);
+ libusb_get_configuration(dev, ¤t_configuration);
+ if (current_configuration != 1) {
+ res = -ENODEV;
+ goto cleanup;
+ }
+
seq = 1;
bootloader_command cmd;