]> sigrok.org Git - libsigrok.git/commitdiff
siglent-sds: move model dependent request emission to after identification
authorGerhard Sittig <redacted>
Sat, 22 May 2021 10:26:18 +0000 (12:26 +0200)
committerGerhard Sittig <redacted>
Tue, 1 Jun 2021 06:20:59 +0000 (08:20 +0200)
Device or model or protocol variant specific commands should only be
used after the device reliably got identified. The "CHDR OFF" command
upsets other devices and needs to move after *IDN? and model checks.

src/hardware/siglent-sds/api.c

index 172c8af2faa414967a10100ff2679c8b8d75ffc4..846399b678c4a8a3af56864e99ffbf27173b9d87 100644 (file)
@@ -257,10 +257,6 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
        const struct siglent_sds_model *model;
        gchar *channel_name;
 
-       sr_dbg("Setting Communication Headers to off.");
-       if (sr_scpi_send(scpi, "CHDR OFF") != SR_OK)
-               return NULL;
-
        if (sr_scpi_get_hw_id(scpi, &hw_info) != SR_OK) {
                sr_info("Couldn't get IDN response, retrying.");
                sr_scpi_close(scpi);
@@ -284,6 +280,10 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
                return NULL;
        }
 
+       sr_dbg("Setting Communication Headers to off.");
+       if (sr_scpi_send(scpi, "CHDR OFF") != SR_OK)
+               return NULL;
+
        sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->vendor = g_strdup(model->series->vendor->name);
        sdi->model = g_strdup(model->name);