]> sigrok.org Git - libsigrok.git/blobdiff - hardware/hantek-dso/api.c
sr: change sr_dev_trigger_set() to use sdi
[libsigrok.git] / hardware / hantek-dso / api.c
index ebb4edc2e9cde85aab6a507df6c53696a9e631c1..d1b2f9b6c2cb2e6474634008fe519edbefb16281 100644 (file)
@@ -157,6 +157,7 @@ static struct sr_dev_inst *dso_dev_new(int index, const struct dso_profile *prof
                prof->vendor, prof->model, NULL);
        if (!sdi)
                return NULL;
+       sdi->driver = hdi;
 
        if (!(ctx = g_try_malloc0(sizeof(struct context)))) {
                sr_err("hantek-dso: ctx malloc failed");
@@ -395,6 +396,9 @@ static int hw_info_get(int info_id, const void **data,
        case SR_DI_INST:
                *data = sdi;
                break;
+       case SR_DI_HWCAPS:
+               *data = hwcaps;
+               break;
        case SR_DI_NUM_PROBES:
                *data = GINT_TO_POINTER(NUM_PROBES);
                break;
@@ -423,6 +427,8 @@ static int hw_info_get(int info_id, const void **data,
        case SR_DI_CUR_SAMPLERATE:
                *data = &tmp;
                break;
+       default:
+               return SR_ERR_ARG;
        }
 
        return SR_OK;
@@ -438,14 +444,9 @@ static int hw_dev_status_get(int dev_index)
        return sdi->status;
 }
 
-static const int *hw_hwcap_get_all(void)
-{
-       return hwcaps;
-}
-
-static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
+static int hw_dev_config_set(const struct sr_dev_inst *sdi, int hwcap,
+               const void *value)
 {
-       struct sr_dev_inst *sdi;
        struct context *ctx;
        struct sr_rational tmp_rat;
        float tmp_float;
@@ -453,9 +454,6 @@ static int hw_dev_config_set(int dev_index, int hwcap, const void *value)
        int ret, i;
        char **targets;
 
-       if (!(sdi = sr_dev_inst_get(hdi->instances, dev_index)))
-               return SR_ERR;
-
        if (sdi->status != SR_ST_ACTIVE)
                return SR_ERR;
 
@@ -879,7 +877,6 @@ SR_PRIV struct sr_dev_driver hantek_dso_driver_info = {
        .dev_close = hw_dev_close,
        .info_get = hw_info_get,
        .dev_status_get = hw_dev_status_get,
-//     .hwcap_get_all = hw_hwcap_get_all,
        .dev_config_set = hw_dev_config_set,
        .dev_acquisition_start = hw_dev_acquisition_start,
        .dev_acquisition_stop = hw_dev_acquisition_stop,