X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Frigol-ds%2Fapi.c;h=d4e12daf8b6b447e9d55ec4aeeaadf5152544d65;hb=a31b2ccbd8db3716d2b13971a8519631e06727fa;hp=9007ea18d0b70c51e534f24e1fb354df25269755;hpb=d5876cfb4a51140e449e37e35937795ad43368f7;p=libsigrok.git diff --git a/hardware/rigol-ds/api.c b/hardware/rigol-ds/api.c index 9007ea18..d4e12daf 100644 --- a/hardware/rigol-ds/api.c +++ b/hardware/rigol-ds/api.c @@ -246,10 +246,6 @@ static int probe_port(const char *resource, const char *serialcomm, GSList **dev { struct dev_context *devc; struct sr_dev_inst *sdi; - const char *usbtmc_prefix = "/dev/usbtmc"; - const char *tcp_prefix = "tcp/"; - const char *vxi_prefix = "vxi/"; - gchar **tokens, *address, *port, *instrument; struct sr_scpi_dev_inst *scpi; struct sr_scpi_hw_info *hw_info; struct sr_probe *probe; @@ -259,43 +255,8 @@ 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); - 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); - tokens = g_strsplit(resource + strlen(tcp_prefix), "/", 0); - address = tokens[0]; - port = tokens[1]; - if (!address || !port || tokens[2]) { - sr_err("Invalid parameters."); - g_strfreev(tokens); - return SR_ERR_ARG; - } - scpi = scpi_tcp_dev_inst_new(address, port); - g_strfreev(tokens); - if (!scpi) - return SR_ERR_MALLOC; - } else if (HAVE_RPC && !strncmp(resource, vxi_prefix, strlen(vxi_prefix))) { - sr_dbg("Opening VXI connection %s.", resource); - tokens = g_strsplit(resource + strlen(tcp_prefix), "/", 0); - address = tokens[0]; - instrument = tokens[1]; - if (!address) { - sr_err("Invalid parameters."); - g_strfreev(tokens); - return SR_ERR_ARG; - } - scpi = scpi_vxi_dev_inst_new(address, instrument); - g_strfreev(tokens); - if (!scpi) - return SR_ERR_MALLOC; - } else { - sr_dbg("Opening serial device %s.", resource); - if (!(scpi = scpi_serial_dev_inst_new(resource, serialcomm))) - return SR_ERR_MALLOC; - } + if (!(scpi = scpi_dev_inst_new(resource, serialcomm))) + return SR_ERR; if (sr_scpi_open(scpi) != SR_OK) { sr_info("Couldn't open SCPI device."); @@ -760,6 +721,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, if (!devc) /* Can't know this until we have the exact model. */ return SR_ERR_ARG; + if (devc->num_timebases <= 0) + return SR_ERR_NA; g_variant_builder_init(&gvb, G_VARIANT_TYPE_ARRAY); for (i = 0; i < devc->num_timebases; i++) { rational[0] = g_variant_new_uint64(devc->timebases[i][0]);