]> sigrok.org Git - libsigrok.git/commitdiff
scpi_usbtmc_libusb: disable all clear_halt for Rigol DS1000
authorAurelien Jacobs <redacted>
Sun, 6 Apr 2014 20:47:44 +0000 (22:47 +0200)
committerAurelien Jacobs <redacted>
Sun, 6 Apr 2014 20:47:44 +0000 (22:47 +0200)
hardware/common/scpi_usbtmc_libusb.c

index f6c18d9316328050123cb0111aa2383ce408ec46..c814ba167945135377dae85fab6490078a68ae44 100644 (file)
@@ -270,12 +270,12 @@ static int scpi_usbtmc_libusb_open(void *priv)
                return SR_ERR;
        }
 
+       if (!uscpi->rigol_ds1000) {
        if ((ret = libusb_clear_halt(usb->devhdl, uscpi->bulk_in_ep)) < 0) {
                sr_err("Failed to clear halt/stall condition for EP %d: %s.",
                       uscpi->bulk_in_ep, libusb_error_name(ret));
                return SR_ERR;
        }
-       if (!uscpi->rigol_ds1000)
        if ((ret = libusb_clear_halt(usb->devhdl, uscpi->bulk_out_ep)) < 0) {
                sr_err("Failed to clear halt/stall condition for EP %d: %s.",
                       uscpi->bulk_out_ep, libusb_error_name(ret));
@@ -286,6 +286,7 @@ static int scpi_usbtmc_libusb_open(void *priv)
                       uscpi->interrupt_ep, libusb_error_name(ret));
                return SR_ERR;
        }
+       }
 
        /* Get capabilities. */
        ret = libusb_control_transfer(usb->devhdl,
@@ -528,16 +529,17 @@ static int scpi_usbtmc_libusb_close(void *priv)
        if (!usb->devhdl)
                return SR_ERR;
 
+       if (!uscpi->rigol_ds1000) {
        if ((ret = libusb_clear_halt(usb->devhdl, uscpi->bulk_in_ep)) < 0)
                sr_err("Failed to clear halt/stall condition for EP %d: %s.",
                       uscpi->bulk_in_ep, libusb_error_name(ret));
-       if (!uscpi->rigol_ds1000)
        if ((ret = libusb_clear_halt(usb->devhdl, uscpi->bulk_out_ep)) < 0)
                sr_err("Failed to clear halt/stall condition for EP %d: %s.",
                       uscpi->bulk_out_ep, libusb_error_name(ret));
        if ((ret = libusb_clear_halt(usb->devhdl, uscpi->interrupt_ep)) < 0)
                sr_err("Failed to clear halt/stall condition for EP %d: %s.",
                       uscpi->interrupt_ep, libusb_error_name(ret));
+       }
 
        if ((ret = libusb_release_interface(usb->devhdl, uscpi->interface)) < 0)
                sr_err("Failed to release interface: %s.",