X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Frigol-ds%2Fapi.c;h=465001048ac5af4a93c87d6db478a35f86140467;hb=f2a189f0a7737d6abc1140b61a554c4a9f1efb70;hp=57bfd033a8587a34dc286cb94521d83502aedc46;hpb=3f239f0803b9fbc073dd7abe9fc7b2a0c606fbb6;p=libsigrok.git diff --git a/hardware/rigol-ds/api.c b/hardware/rigol-ds/api.c index 57bfd033..46500104 100644 --- a/hardware/rigol-ds/api.c +++ b/hardware/rigol-ds/api.c @@ -143,6 +143,11 @@ static const char *trigger_sources[] = { "D15", }; +static const char *trigger_slopes[] = { + "r", + "f", +}; + static const char *coupling[] = { "AC", "DC", @@ -267,10 +272,13 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) gchar *channel_name, **version; if (sr_scpi_get_hw_id(scpi, &hw_info) != SR_OK) { - sr_info("Couldn't get IDN response."); + sr_info("Couldn't get IDN response, retrying."); sr_scpi_close(scpi); - sr_scpi_free(scpi); - return NULL; + sr_scpi_open(scpi); + if (sr_scpi_get_hw_id(scpi, &hw_info) != SR_OK) { + sr_info("Couldn't get IDN response."); + return NULL; + } } for (i = 0; i < ARRAY_SIZE(supported_models); i++) { @@ -287,13 +295,9 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi) model->name, hw_info->firmware_version))) { sr_scpi_hw_info_free(hw_info); - sr_scpi_close(scpi); - sr_scpi_free(scpi); return NULL; } - sr_scpi_close(scpi); - sdi->conn = scpi; sdi->driver = di; @@ -546,6 +550,15 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi, tmp_str = devc->trigger_source; *data = g_variant_new_string(tmp_str); break; + case SR_CONF_TRIGGER_SLOPE: + if (!strcmp(devc->trigger_slope, "POS")) + tmp_str = "r"; + else if (!strcmp(devc->trigger_slope, "NEG")) + tmp_str = "f"; + else + return SR_ERR_NA; + *data = g_variant_new_string(tmp_str); + break; case SR_CONF_TIMEBASE: for (i = 0; i < devc->num_timebases; i++) { float tb = (float)devc->timebases[i][0] / devc->timebases[i][1]; @@ -838,6 +851,9 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi, *data = g_variant_new_strv(trigger_sources, devc->model->has_digital ? ARRAY_SIZE(trigger_sources) : 4); break; + case SR_CONF_TRIGGER_SLOPE: + *data = g_variant_new_strv(trigger_slopes, ARRAY_SIZE(trigger_slopes)); + break; case SR_CONF_DATA_SOURCE: if (!devc) /* Can't know this until we have the exact model. */ @@ -931,7 +947,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi, void *cb_data) switch (devc->model->series->protocol) { case PROTOCOL_V2: - if (rigol_ds_config_set(sdi, ":ACQ:MDEP LONG") != SR_OK) + if (rigol_ds_config_set(sdi, ":ACQ:MEMD LONG") != SR_OK) return SR_ERR; break; case PROTOCOL_V3: