]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/asix-sigma/api.c
drivers: Random SR_CONF_LIMIT_* cleanups.
[libsigrok.git] / src / hardware / asix-sigma / api.c
index aaefb450e77bec56e4be068fdad3d6a1721ed3f5..d2667f09fd5168c1431f7744b738d48e58779cdb 100644 (file)
@@ -112,8 +112,8 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
 
        sdi = g_malloc0(sizeof(struct sr_dev_inst));
        sdi->status = SR_ST_INITIALIZING;
-       sdi->vendor = g_strdup(USB_VENDOR_NAME);
-       sdi->model = g_strdup(USB_MODEL_NAME);
+       sdi->vendor = g_strdup("ASIX");
+       sdi->model = g_strdup("SIGMA");
 
        for (i = 0; i < ARRAY_SIZE(channel_names); i++)
                sr_channel_new(sdi, i, SR_CHANNEL_LOGIC, TRUE, channel_names[i]);
@@ -156,8 +156,8 @@ static int dev_close(struct sr_dev_inst *sdi)
        return (ftdi_usb_close(&devc->ftdic) == 0) ? SR_OK : SR_ERR;
 }
 
-static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
-               const struct sr_channel_group *cg)
+static int config_get(uint32_t key, GVariant **data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
 
@@ -189,8 +189,8 @@ static int config_get(uint32_t key, GVariant **data, const struct sr_dev_inst *s
        return SR_OK;
 }
 
-static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
-               const struct sr_channel_group *cg)
+static int config_set(uint32_t key, GVariant *data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
        uint64_t tmp;
@@ -206,11 +206,7 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
                ret = sigma_set_samplerate(sdi, g_variant_get_uint64(data));
                break;
        case SR_CONF_LIMIT_MSEC:
-               tmp = g_variant_get_uint64(data);
-               if (tmp > 0)
-                       devc->limit_msec = g_variant_get_uint64(data);
-               else
-                       ret = SR_ERR;
+               devc->limit_msec = g_variant_get_uint64(data);
                break;
        case SR_CONF_LIMIT_SAMPLES:
                tmp = g_variant_get_uint64(data);
@@ -232,8 +228,8 @@ static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sd
        return ret;
 }
 
-static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
-               const struct sr_channel_group *cg)
+static int config_list(uint32_t key, GVariant **data,
+       const struct sr_dev_inst *sdi, const struct sr_channel_group *cg)
 {
        switch (key) {
        case SR_CONF_DEVICE_OPTIONS:
@@ -243,9 +239,7 @@ static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *
                break;
 #if ASIX_SIGMA_WITH_TRIGGER
        case SR_CONF_TRIGGER_MATCH:
-               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
-                               trigger_matches, ARRAY_SIZE(trigger_matches),
-                               sizeof(int32_t));
+               *data = std_gvar_array_i32(ARRAY_AND_SIZE(trigger_matches));
                break;
 #endif
        default: