]> sigrok.org Git - libsigrok.git/blobdiff - hardware/hantek-dso/api.c
hantek-dso: Quickfix for build issue (will be removed later).
[libsigrok.git] / hardware / hantek-dso / api.c
index 0f1931133ab6267390b468adbfb9533178218892..518739eb6ed6c39665f0a11714d377a4de4cc0bf 100644 (file)
@@ -35,6 +35,8 @@
 #include "config.h"
 #include "dso.h"
 
+/* FIXME: Temporary build fix, this will be removed later. */
+#define GTV_TO_MSEC(gtv)       (gtv.tv_sec * 1000 + gtv.tv_usec / 1000)
 
 /* Max time in ms before we want to check on events */
 #define TICK    1
@@ -50,6 +52,7 @@ static int capabilities[] = {
        SR_HWCAP_HORIZ_TRIGGERPOS,
        SR_HWCAP_FILTER,
        SR_HWCAP_VDIV,
+       SR_HWCAP_COUPLING,
        0,
 };
 
@@ -391,6 +394,9 @@ static void *hw_get_device_info(int dev_index, int dev_info_id)
        case SR_DI_VDIVS:
                info = vdivs;
                break;
+       case SR_DI_COUPLING:
+               info = coupling;
+               break;
        /* TODO remove this */
        case SR_DI_CUR_SAMPLERATE:
                info = &tmp;
@@ -424,7 +430,7 @@ static int hw_dev_config_set(int dev_index, int hwcap, void *value)
        float tmp_float;
        uint64_t tmp_u64;
        int ret, i;
-       char *tmp_str, **targets;
+       char **targets;
 
        if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
@@ -479,10 +485,9 @@ static int hw_dev_config_set(int dev_index, int hwcap, void *value)
                        ret = SR_ERR_ARG;
                break;
        case SR_HWCAP_TRIGGER_SOURCE:
-               tmp_str = value;
                for (i = 0; trigger_sources[i]; i++) {
-                       if (!strcmp(tmp_str, trigger_sources[i])) {
-                               ctx->triggersource = g_strdup(tmp_str);
+                       if (!strcmp(value, trigger_sources[i])) {
+                               ctx->triggersource = g_strdup(value);
                                break;
                        }
                }
@@ -525,9 +530,8 @@ static int hw_dev_config_set(int dev_index, int hwcap, void *value)
                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])) {
+                       if (!strcmp(value, coupling[i])) {
                                ctx->coupling_ch1 = i;
                                ctx->coupling_ch2 = i;
                                break;