]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/scpi-pps/api.c
Change type of SR_CONF keys to uint32_t.
[libsigrok.git] / src / hardware / scpi-pps / api.c
index 5b64f4b622e9b4a5f788b14a00f03f61e56bc620..aea3bd5e26833c95cee54ea3c7e850dc98cfcd61 100644 (file)
@@ -25,7 +25,7 @@ static struct sr_dev_driver *di = &scpi_pps_driver_info;
 extern unsigned int num_pps_profiles;
 extern const struct scpi_pps pps_profiles[];
 
-static const int32_t scanopts[] = {
+static const uint32_t scanopts[] = {
        SR_CONF_CONN,
        SR_CONF_SERIALCOMM,
 };
@@ -56,7 +56,7 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
        GMatchInfo *model_mi;
        GSList *l;
        uint64_t mask;
-       unsigned int ch_num, ch_idx, old_idx, i, j;
+       unsigned int ch_num, ch_idx, i, j;
        const char *vendor;
        char ch_name[16];
 
@@ -95,7 +95,6 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
        ch_idx = 0;
        for (ch_num = 0; ch_num < device->num_channels; ch_num++) {
                /* Create one channel per measurable output unit. */
-               old_idx = ch_idx;
                for (i = 0; i < ARRAY_SIZE(pci); i++) {
                        if (!scpi_cmd_get(sdi, pci[i].command))
                                continue;
@@ -109,14 +108,6 @@ static struct sr_dev_inst *probe_device(struct sr_scpi_dev_inst *scpi)
                        ch->priv = pch;
                        sdi->channels = g_slist_append(sdi->channels, ch);
                }
-               if (ch_idx == old_idx) {
-                       /*
-                        * Didn't create any channels for this hardware output.
-                        * This can happen if the device has no measurement capability.
-                        */
-                       g_free(pch);
-                       continue;
-               }
        }
 
        for (i = 0; i < device->num_channel_groups; i++) {
@@ -199,7 +190,7 @@ static int cleanup(void)
        return SR_OK;
 }
 
-static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
+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;
@@ -322,7 +313,7 @@ static int config_get(int key, GVariant **data, const struct sr_dev_inst *sdi,
        return ret;
 }
 
-static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
+static int config_set(uint32_t key, GVariant *data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
        struct sr_channel *ch;
@@ -405,7 +396,7 @@ static int config_set(int key, GVariant *data, const struct sr_dev_inst *sdi,
        return ret;
 }
 
-static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
+static int config_list(uint32_t key, GVariant **data, const struct sr_dev_inst *sdi,
                const struct sr_channel_group *cg)
 {
        struct dev_context *devc;
@@ -418,8 +409,8 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
 
        /* Always available, even without sdi. */
        if (key == SR_CONF_SCAN_OPTIONS) {
-               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
-                               scanopts, ARRAY_SIZE(scanopts), sizeof(int32_t));
+               *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
+                               scanopts, ARRAY_SIZE(scanopts), sizeof(uint32_t));
                return SR_OK;
        }
 
@@ -432,9 +423,9 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
                /* No channel group: global options. */
                switch (key) {
                case SR_CONF_DEVICE_OPTIONS:
-                       *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
+                       *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
                                        devc->device->devopts, devc->device->num_devopts,
-                                       sizeof(int32_t));
+                                       sizeof(uint32_t));
                        break;
                case SR_CONF_OUTPUT_CHANNEL_CONFIG:
                        /* Not used. */
@@ -469,9 +460,9 @@ static int config_list(int key, GVariant **data, const struct sr_dev_inst *sdi,
 
                switch (key) {
                case SR_CONF_DEVICE_OPTIONS:
-                       *data = g_variant_new_fixed_array(G_VARIANT_TYPE_INT32,
+                       *data = g_variant_new_fixed_array(G_VARIANT_TYPE_UINT32,
                                        devc->device->devopts_cg, devc->device->num_devopts_cg,
-                                       sizeof(int32_t));
+                                       sizeof(uint32_t));
                        break;
                case SR_CONF_OUTPUT_VOLTAGE_MAX:
                        ch_spec = &(devc->device->channels[ch->index]);