]> sigrok.org Git - libsigrok.git/blobdiff - hardware/rigol-ds/api.c
appa-55ii: driver implementation with Live and Memory data source support
[libsigrok.git] / hardware / rigol-ds / api.c
index 66df606bc468eb81f1101e7e151eb94579077f82..6b92fa8de091ec5a943402fc6a8bd25f0a754abe 100644 (file)
@@ -164,6 +164,16 @@ static const struct rigol_ds_model supported_models[] = {
        {"DS2072", RIGOL_DS2000, PROTOCOL_IEEE488_2, {5, 1000000000}, {500, 1}, {500, 1000000}, false, 14},
        {"DS2102", RIGOL_DS2000, PROTOCOL_IEEE488_2, {5, 1000000000}, {500, 1}, {500, 1000000}, false, 14},
        {"DS2202", RIGOL_DS2000, PROTOCOL_IEEE488_2, {2, 1000000000}, {500, 1}, {500, 1000000}, false, 14},
+       {"VS5022", RIGOL_VS5000, PROTOCOL_LEGACY, {20, 1000000000}, {50, 1}, {2, 1000}, false, 14},
+       {"VS5022D", RIGOL_VS5000, PROTOCOL_LEGACY, {20, 1000000000}, {50, 1}, {2, 1000}, true, 14},
+       {"VS5042", RIGOL_VS5000, PROTOCOL_LEGACY, {10, 1000000000}, {50, 1}, {2, 1000}, false, 14},
+       {"VS5042D", RIGOL_VS5000, PROTOCOL_LEGACY, {10, 1000000000}, {50, 1}, {2, 1000}, true, 14},
+       {"VS5062", RIGOL_VS5000, PROTOCOL_LEGACY, {5, 1000000000}, {50, 1}, {2, 1000}, false, 14},
+       {"VS5062D", RIGOL_VS5000, PROTOCOL_LEGACY, {5, 1000000000}, {50, 1}, {2, 1000}, true, 14},
+       {"VS5102", RIGOL_VS5000, PROTOCOL_LEGACY, {2, 1000000000}, {50, 1}, {2, 1000}, false, 14},
+       {"VS5102D", RIGOL_VS5000, PROTOCOL_LEGACY, {2, 1000000000}, {50, 1}, {2, 1000}, true, 14},
+       {"VS5202", RIGOL_VS5000, PROTOCOL_LEGACY, {2, 1000000000}, {50, 1}, {2, 1000}, false, 14},
+       {"VS5202D", RIGOL_VS5000, PROTOCOL_LEGACY, {2, 1000000000}, {50, 1}, {2, 1000}, true, 14},
 };
 
 SR_PRIV struct sr_dev_driver rigol_ds_driver_info;
@@ -232,16 +242,16 @@ static int probe_port(const char *resource, const char *serialcomm, GSList **dev
        *devices = NULL;
 
        if (strncmp(resource, usbtmc_prefix, strlen(usbtmc_prefix)) == 0) {
-               sr_dbg("Opening USBTMC device %s", resource);
+               sr_dbg("Opening USBTMC device %s.", resource);
                if (!(scpi = scpi_usbtmc_dev_inst_new(resource)))
                        return SR_ERR_MALLOC;
        } else if (strncmp(resource, tcp_prefix, strlen(tcp_prefix)) == 0) {
-               sr_dbg("Opening TCP connection %s", resource);
+               sr_dbg("Opening TCP connection %s.", resource);
                tokens = g_strsplit(resource + strlen(tcp_prefix), "/", 0);
                address = tokens[0];
                port = tokens[1];
                if (!address || !port || tokens[2]) {
-                       sr_dbg("Invalid parameters");
+                       sr_err("Invalid parameters.");
                        g_strfreev(tokens);
                        return SR_ERR_ARG;
                }
@@ -250,7 +260,7 @@ static int probe_port(const char *resource, const char *serialcomm, GSList **dev
                if (!scpi)
                        return SR_ERR_MALLOC;
        } else {
-               sr_dbg("Opening serial device %s", resource);
+               sr_dbg("Opening serial device %s.", resource);
                if (!(scpi = scpi_serial_dev_inst_new(resource, serialcomm)))
                        return SR_ERR_MALLOC;
        }
@@ -269,6 +279,7 @@ static int probe_port(const char *resource, const char *serialcomm, GSList **dev
 
        if (strcasecmp(hw_info->manufacturer, "Rigol Technologies")) {
                sr_scpi_hw_info_free(hw_info);
+               sr_scpi_close(scpi);
                sr_scpi_free(scpi);
                return SR_ERR_NA;
        }
@@ -284,11 +295,13 @@ static int probe_port(const char *resource, const char *serialcomm, GSList **dev
                                              hw_info->manufacturer, hw_info->model,
                                                  hw_info->firmware_version))) {
                sr_scpi_hw_info_free(hw_info);
+               sr_scpi_close(scpi);
                sr_scpi_free(scpi);
                return SR_ERR_NA;
        }
 
        sr_scpi_hw_info_free(hw_info);
+       sr_scpi_close(scpi);
 
        sdi->conn = scpi;