]> sigrok.org Git - libsigrok.git/commitdiff
ols: Support get/set/list on all device options
authorBert Vermeulen <redacted>
Sat, 13 Apr 2013 22:36:05 +0000 (00:36 +0200)
committerBert Vermeulen <redacted>
Sat, 13 Apr 2013 22:36:05 +0000 (00:36 +0200)
Where it makes sense: _LOGIC_ANALYZER and _TRIGGER_TYPE don't have much
use for all of them.

hardware/openbench-logic-sniffer/api.c

index 4e1a40cdc031869b485002c3d6747f89cfa7cf4e..16ed80b9e7c2df0e00051637d71824a66a7f489e 100644 (file)
@@ -29,6 +29,7 @@ static const int32_t hwopts[] = {
 static const int32_t hwcaps[] = {
        SR_CONF_LOGIC_ANALYZER,
        SR_CONF_SAMPLERATE,
+       SR_CONF_TRIGGER_TYPE,
        SR_CONF_CAPTURE_RATIO,
        SR_CONF_LIMIT_SAMPLES,
        SR_CONF_RLE,
@@ -240,13 +241,22 @@ static int config_get(int id, GVariant **data, const struct sr_dev_inst *sdi)
 {
        struct dev_context *devc;
 
+       if (!sdi)
+               return SR_ERR_ARG;
+
+       devc = sdi->priv;
        switch (id) {
        case SR_CONF_SAMPLERATE:
-               if (sdi) {
-                       devc = sdi->priv;
-                       *data = g_variant_new_uint64(devc->cur_samplerate);
-               } else
-                       return SR_ERR;
+               *data = g_variant_new_uint64(devc->cur_samplerate);
+               break;
+       case SR_CONF_CAPTURE_RATIO:
+               *data = g_variant_new_uint64(devc->capture_ratio);
+               break;
+       case SR_CONF_LIMIT_SAMPLES:
+               *data = g_variant_new_uint64(devc->limit_samples);
+               break;
+       case SR_CONF_RLE:
+               *data = g_variant_new_boolean(devc->flag_reg & FLAG_RLE ? TRUE : FALSE);
                break;
        default:
                return SR_ERR_ARG;
@@ -277,10 +287,7 @@ static int config_set(int id, GVariant *data, const struct sr_dev_inst *sdi)
                tmp_u64 = g_variant_get_uint64(data);
                if (tmp_u64 < MIN_NUM_SAMPLES)
                        return SR_ERR;
-               if (tmp_u64 > devc->max_samples)
-                       sr_err("Sample limit exceeds hardware maximum.");
                devc->limit_samples = tmp_u64;
-               sr_info("Sample limit is %" PRIu64 ".", devc->limit_samples);
                ret = SR_OK;
                break;
        case SR_CONF_CAPTURE_RATIO: