]> sigrok.org Git - libsigrok.git/commitdiff
scpi_usbtmc_libusb: disable bulk_out clear_halt for Rigol DS1000
authorAurelien Jacobs <redacted>
Sat, 5 Apr 2014 23:31:12 +0000 (01:31 +0200)
committerBert Vermeulen <redacted>
Sun, 6 Apr 2014 15:32:59 +0000 (17:32 +0200)
fix hangup issue with Rigol firmware version 00.02.02.02.00

hardware/common/scpi_usbtmc_libusb.c

index 933ce83c084e720ead9b002fc369ee1c3d0299a9..f6c18d9316328050123cb0111aa2383ce408ec46 100644 (file)
@@ -43,6 +43,7 @@ struct scpi_usbtmc_libusb {
        int response_length;
        int response_bytes_read;
        int remaining_length;
+       int rigol_ds1000;
 };
 
 /* Some USBTMC-specific enums, as defined in the USBTMC standard. */
@@ -234,6 +235,8 @@ static int scpi_usbtmc_libusb_open(void *priv)
                                }
                        }
                        found = 1;
+                       uscpi->rigol_ds1000 = des.idVendor  == 0x1ab1 &&
+                                             des.idProduct == 0x0588;
                }
                libusb_free_config_descriptor(confdes);
                if (found)
@@ -272,6 +275,7 @@ static int scpi_usbtmc_libusb_open(void *priv)
                       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));
@@ -527,6 +531,7 @@ static int scpi_usbtmc_libusb_close(void *priv)
        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));