hameg-hmo: Add missing cases in config_get().

This commit is contained in:
poljar (Damir Jelić) 2014-03-25 17:44:38 +01:00 committed by Uwe Hermann
parent bbabdaf1e2
commit 3fd2dca207
1 changed files with 32 additions and 0 deletions

View File

@ -231,6 +231,11 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
*data = g_variant_new_int32(model->num_xdivs); *data = g_variant_new_int32(model->num_xdivs);
ret = SR_OK; ret = SR_OK;
break; break;
case SR_CONF_TIMEBASE:
*data = g_variant_new("(tt)", (*model->timebases)[state->timebase][0],
(*model->timebases)[state->timebase][1]);
ret = SR_OK;
break;
case SR_CONF_NUM_VDIV: case SR_CONF_NUM_VDIV:
if (pg_type == PG_NONE) { if (pg_type == PG_NONE) {
sr_err("No probe group specified."); sr_err("No probe group specified.");
@ -244,6 +249,25 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
break; break;
} }
} else {
ret = SR_ERR_NA;
}
break;
case SR_CONF_VDIV:
if (pg_type == PG_NONE) {
sr_err("No probe group specified.");
return SR_ERR_PROBE_GROUP;
} else if (pg_type == PG_ANALOG) {
for (i = 0; i < model->analog_channels; ++i) {
if (probe_group != &devc->analog_groups[i])
continue;
*data = g_variant_new("(tt)",
(*model->vdivs)[state->analog_channels[i].vdiv][0],
(*model->vdivs)[state->analog_channels[i].vdiv][1]);
ret = SR_OK;
break;
}
} else { } else {
ret = SR_ERR_NA; ret = SR_ERR_NA;
} }
@ -252,6 +276,14 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
*data = g_variant_new_string((*model->trigger_sources)[state->trigger_source]); *data = g_variant_new_string((*model->trigger_sources)[state->trigger_source]);
ret = SR_OK; ret = SR_OK;
break; break;
case SR_CONF_TRIGGER_SLOPE:
*data = g_variant_new_string((*model->trigger_slopes)[state->trigger_slope]);
ret = SR_OK;
break;
case SR_CONF_HORIZ_TRIGGERPOS:
*data = g_variant_new_double(state->horiz_triggerpos);
ret = SR_OK;
break;
case SR_CONF_COUPLING: case SR_CONF_COUPLING:
if (pg_type == PG_NONE) { if (pg_type == PG_NONE) {
sr_err("No probe group specified."); sr_err("No probe group specified.");