]> sigrok.org Git - libsigrok.git/blobdiff - hardware/hantek-dso/api.c
hantek-dso: support for SR_HWCAP_COUPLING
[libsigrok.git] / hardware / hantek-dso / api.c
index 6c1042ffca439250f89a550d4df137786cb9a7eb..0f1931133ab6267390b468adbfb9533178218892 100644 (file)
@@ -125,6 +125,13 @@ static char *filter_targets[] = {
        NULL
 };
 
+static char *coupling[] = {
+       "AC",
+       "DC",
+       "GND",
+       NULL
+};
+
 SR_PRIV libusb_context *usb_context = NULL;
 SR_PRIV GSList *dev_insts = NULL;
 
@@ -516,6 +523,19 @@ static int hw_dev_config_set(int dev_index, int hwcap, void *value)
                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 */
+               tmp_str = value;
+               for (i = 0; coupling[i]; i++) {
+                       if (!strcmp(tmp_str, coupling[i])) {
+                               ctx->coupling_ch1 = i;
+                               ctx->coupling_ch2 = i;
+                               break;
+                       }
+               }
+               if (coupling[i] == 0)
+                       ret = SR_ERR_ARG;
+               break;
        default:
                ret = SR_ERR_ARG;
        }