]> sigrok.org Git - libsigrok.git/commitdiff
hameg-hmo: Expose more options with config_get().
authorpoljar (Damir Jelić) <redacted>
Thu, 16 Jan 2014 14:28:58 +0000 (15:28 +0100)
committerBert Vermeulen <redacted>
Thu, 16 Jan 2014 15:27:35 +0000 (16:27 +0100)
This patch exposes the TRIGGER_SOURCE and COUPLING options via config_get().

hardware/hameg-hmo/api.c

index bd97af8865e75cf17b4a76ba7d607e4217c6b78e..d61a5e87b323802af1ee71c6b1a951092fa60050 100644 (file)
@@ -445,6 +445,27 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
                                break;
                        }
 
+               } else {
+                       ret = SR_ERR_NA;
+               }
+               break;
+       case SR_CONF_TRIGGER_SOURCE:
+               *data = g_variant_new_string((*model->trigger_sources)[state->trigger_source]);
+               ret = SR_OK;
+               break;
+       case SR_CONF_COUPLING:
+               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_string((*model->coupling_options)[state->analog_channels[i].coupling]);
+                               ret = SR_OK;
+                               break;
+                       }
+
                } else {
                        ret = SR_ERR_NA;
                }