- uint64_t *tmp_u64;
- char *stropt;
-
- /* Avoid compiler warnings. */
- device_index = device_index;
-
- if (capability == HWCAP_PROBECONFIG) {
- /* Nothing to do. */
- ret = SIGROK_OK;
- } else if (capability == HWCAP_LIMIT_SAMPLES) {
- tmp_u64 = value;
- limit_samples = *tmp_u64;
- ret = SIGROK_OK;
- } else if (capability == HWCAP_LIMIT_MSEC) {
- tmp_u64 = value;
- limit_msec = *tmp_u64;
- ret = SIGROK_OK;
- } else if (capability == HWCAP_PATTERN_MODE) {
- stropt = value;
- if (!strcmp(stropt, "random")) {
- default_genmode = GENMODE_RANDOM;
- ret = SIGROK_OK;
- } else if (!strcmp(stropt, "incremental")) {
- default_genmode = GENMODE_INC;
- ret = SIGROK_OK;
+ const char *stropt;
+
+ struct dev_context *const devc = sdi->priv;
+
+ if (sdi->status != SR_ST_ACTIVE)
+ return SR_ERR_DEV_CLOSED;
+
+ if (id == SR_CONF_SAMPLERATE) {
+ devc->cur_samplerate = g_variant_get_uint64(data);
+ sr_dbg("%s: setting samplerate to %" PRIu64, __func__,
+ devc->cur_samplerate);
+ ret = SR_OK;
+ } else if (id == SR_CONF_LIMIT_SAMPLES) {
+ devc->limit_msec = 0;
+ devc->limit_samples = g_variant_get_uint64(data);
+ sr_dbg("%s: setting limit_samples to %" PRIu64, __func__,
+ devc->limit_samples);
+ ret = SR_OK;
+ } else if (id == SR_CONF_LIMIT_MSEC) {
+ devc->limit_msec = g_variant_get_uint64(data);
+ devc->limit_samples = 0;
+ sr_dbg("%s: setting limit_msec to %" PRIu64, __func__,
+ devc->limit_msec);
+ ret = SR_OK;
+ } else if (id == SR_CONF_PATTERN_MODE) {
+ stropt = g_variant_get_string(data, NULL);
+ ret = SR_OK;
+ if (!strcmp(stropt, STR_PATTERN_SIGROK)) {
+ devc->sample_generator = PATTERN_SIGROK;
+ } else if (!strcmp(stropt, STR_PATTERN_RANDOM)) {
+ devc->sample_generator = PATTERN_RANDOM;
+ } else if (!strcmp(stropt, STR_PATTERN_INC)) {
+ devc->sample_generator = PATTERN_INC;
+ } else if (!strcmp(stropt, STR_PATTERN_ALL_LOW)) {
+ devc->sample_generator = PATTERN_ALL_LOW;
+ } else if (!strcmp(stropt, STR_PATTERN_ALL_HIGH)) {
+ devc->sample_generator = PATTERN_ALL_HIGH;