+ 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;
+ case SR_HWCAP_VDIV:
+ /* TODO not supporting vdiv per channel yet */
+ tmp_rat = *(const struct sr_rational *)value;
+ for (i = 0; vdivs[i].p && vdivs[i].q; i++) {
+ if (vdivs[i].p == tmp_rat.p
+ && vdivs[i].q == tmp_rat.q) {
+ ctx->voltage_ch1 = i;
+ ctx->voltage_ch2 = i;
+ break;
+ }
+ }
+ if (vdivs[i].p == 0 && vdivs[i].q == 0)
+ ret = SR_ERR_ARG;
+ break;
+ case SR_HWCAP_COUPLING:
+ /* TODO not supporting coupling per channel yet */
+ for (i = 0; coupling[i]; i++) {
+ if (!strcmp(value, coupling[i])) {
+ ctx->coupling_ch1 = i;
+ ctx->coupling_ch2 = i;
+ break;
+ }
+ }
+ if (coupling[i] == 0)
+ ret = SR_ERR_ARG;
+ break;