X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Frigol-ds%2Fprotocol.c;h=201e0a31b920d6761c6c7104e01a52e14e3431cd;hb=cb828f1b3e00ccd0ad23d7cb98dca4d0d4749b07;hp=fbbd03209cc1162e56464258707b269ca9ee2202;hpb=69990295852d658346980f3aad5e52ff0271bcd9;p=libsigrok.git diff --git a/src/hardware/rigol-ds/protocol.c b/src/hardware/rigol-ds/protocol.c index fbbd0320..201e0a31 100644 --- a/src/hardware/rigol-ds/protocol.c +++ b/src/hardware/rigol-ds/protocol.c @@ -905,7 +905,21 @@ SR_PRIV int rigol_ds_get_dev_cfg(const struct sr_dev_inst *sdi) /* Probe attenuation. */ for (i = 0; i < devc->model->analog_channels; i++) { cmd = g_strdup_printf(":CHAN%d:PROB?", i + 1); - res = sr_scpi_get_float(sdi->conn, cmd, &devc->attenuation[i]); + + /* DSO1000B series prints an X after the probe factor, so + * we get a string and check for that instead of only handling + * floats. */ + char *response; + res = sr_scpi_get_string(sdi->conn, cmd, &response); + if (res != SR_OK) + return SR_ERR; + + int len = strlen(response); + if (response[len-1] == 'X') + response[len-1] = 0; + + res = sr_atof_ascii(response, &devc->attenuation[i]); + g_free(response); g_free(cmd); if (res != SR_OK) return SR_ERR;