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,
};
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];
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;
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++) {
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;
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;
int ret;
const char *s;
+ if (!sdi)
+ return SR_ERR_ARG;
+
if (sdi->status != SR_ST_ACTIVE)
return SR_ERR_DEV_CLOSED;
}
} else {
/* Channel group specified. */
- if (!sdi)
- return SR_ERR_ARG;
- if (g_slist_length(cg->channels) > 1)
- return SR_ERR_NA;
ch = cg->channels->data;
pch = ch->priv;
switch (key) {
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;
/* 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;
}
/* 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. */
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]);