rigol-ds: properly report which channel is enabled.

This commit is contained in:
Aurelien Jacobs 2016-06-25 21:37:53 +02:00 committed by Uwe Hermann
parent 9ea62f2e0a
commit e264ebded8
1 changed files with 5 additions and 0 deletions

View File

@ -769,6 +769,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
SR_PRIV int rigol_ds_get_dev_cfg(const struct sr_dev_inst *sdi) SR_PRIV int rigol_ds_get_dev_cfg(const struct sr_dev_inst *sdi)
{ {
struct dev_context *devc; struct dev_context *devc;
struct sr_channel *ch;
char *cmd; char *cmd;
unsigned int i; unsigned int i;
int res; int res;
@ -782,6 +783,8 @@ SR_PRIV int rigol_ds_get_dev_cfg(const struct sr_dev_inst *sdi)
g_free(cmd); g_free(cmd);
if (res != SR_OK) if (res != SR_OK)
return SR_ERR; return SR_ERR;
ch = g_slist_nth_data(sdi->channels, i);
ch->enabled = devc->analog_channels[i];
} }
sr_dbg("Current analog channel state:"); sr_dbg("Current analog channel state:");
for (i = 0; i < devc->model->analog_channels; i++) for (i = 0; i < devc->model->analog_channels; i++)
@ -804,6 +807,8 @@ SR_PRIV int rigol_ds_get_dev_cfg(const struct sr_dev_inst *sdi)
g_free(cmd); g_free(cmd);
if (res != SR_OK) if (res != SR_OK)
return SR_ERR; return SR_ERR;
ch = g_slist_nth_data(sdi->channels, i + devc->model->analog_channels);
ch->enabled = devc->digital_channels[i];
sr_dbg("D%d: %s", i, devc->digital_channels[i] ? "on" : "off"); sr_dbg("D%d: %s", i, devc->digital_channels[i] ? "on" : "off");
} }
} }