Fix #1576 by handling DSO1000B's CHAN#:PROB? responses
This commit is contained in:
parent
e434f624ba
commit
34ce4d8258
|
@ -905,7 +905,21 @@ SR_PRIV int rigol_ds_get_dev_cfg(const struct sr_dev_inst *sdi)
|
||||||
/* Probe attenuation. */
|
/* Probe attenuation. */
|
||||||
for (i = 0; i < devc->model->analog_channels; i++) {
|
for (i = 0; i < devc->model->analog_channels; i++) {
|
||||||
cmd = g_strdup_printf(":CHAN%d:PROB?", i + 1);
|
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);
|
g_free(cmd);
|
||||||
if (res != SR_OK)
|
if (res != SR_OK)
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
|
|
Loading…
Reference in New Issue