SR_HWCAP_TRIGGER_SOURCE,
SR_HWCAP_TRIGGER_SLOPE,
SR_HWCAP_HORIZ_TRIGGERPOS,
+ SR_HWCAP_FILTER,
0,
};
NULL
};
+static char *filter_targets[] = {
+ "CH1",
+ "CH2",
+ /* TODO: "TRIGGER", */
+ NULL
+};
+
SR_PRIV libusb_context *usb_context = NULL;
SR_PRIV GSList *dev_insts = NULL;
case SR_DI_TRIGGER_SOURCES:
info = trigger_sources;
break;
+ case SR_DI_FILTERS:
+ info = filter_targets;
+ break;
/* TODO remove this */
case SR_DI_CUR_SAMPLERATE:
info = &tmp;
float tmp_float;
uint64_t tmp_u64;
int ret, i;
- char *tmp_str;
+ char *tmp_str, **targets;
if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
return SR_ERR;
if (trigger_sources[i] == 0)
ret = SR_ERR_ARG;
break;
+ case SR_HWCAP_FILTER:
+ ctx->filter_ch1 = ctx->filter_ch2 = ctx->filter_trigger = 0;
+ targets = g_strsplit(value, ",", 0);
+ for (i = 0; targets[i]; i++) {
+ if (targets[i] == '\0')
+ /* Empty filter string can be used to clear them all. */
+ ;
+ else if (!strcmp(targets[i], "CH1"))
+ ctx->filter_ch1 = TRUE;
+ else if (!strcmp(targets[i], "CH2"))
+ ctx->filter_ch2 = TRUE;
+ else if (!strcmp(targets[i], "TRIGGER"))
+ ctx->filter_trigger = TRUE;
+ else {
+ sr_err("invalid filter target %s", targets[i]);
+ ret = SR_ERR_ARG;
+ }
+ }
+ g_strfreev(targets);
+ break;
default:
ret = SR_ERR_ARG;
}
int ret, tmp;
uint8_t cmdstring[8];
- sr_dbg("hantek-dso: sending CMD_SET_FILTERS");
+ sr_dbg("hantek-dso: preparing CMD_SET_FILTERS");
memset(cmdstring, 0, sizeof(cmdstring));
cmdstring[0] = CMD_SET_FILTERS;
cmdstring[1] = 0x0f;
- if (ctx->filter_ch1)
+ if (ctx->filter_ch1) {
+ sr_dbg("hantek-dso: turning on CH1 filter");
cmdstring[2] |= 0x80;
- if (ctx->filter_ch2)
+ }
+ if (ctx->filter_ch2) {
+ sr_dbg("hantek-dso: turning on CH2 filter");
cmdstring[2] |= 0x40;
- if (ctx->filter_trigger)
+ }
+ if (ctx->filter_trigger) {
+ /* TODO: supported on the DSO-2090? */
+ sr_dbg("hantek-dso: turning on trigger filter");
cmdstring[2] |= 0x20;
+ }
if (send_begin(ctx) != SR_OK)
return SR_ERR;
sr_err("Failed to set filters: %d", ret);
return SR_ERR;
}
+ sr_dbg("hantek-dso: sent CMD_SET_FILTERS");
return SR_OK;
}