uint64_t samplerate;
int unitsize;
int num_channels;
+ int num_analog_channels;
int cur_chunk;
gboolean finished;
};
SR_CONF_CAPTUREFILE | SR_CONF_SET,
SR_CONF_CAPTURE_UNITSIZE | SR_CONF_GET | SR_CONF_SET,
SR_CONF_NUM_LOGIC_CHANNELS | SR_CONF_SET,
+ SR_CONF_NUM_ANALOG_CHANNELS | SR_CONF_SET,
SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET,
SR_CONF_SESSIONFILE | SR_CONF_SET,
};
case SR_CONF_NUM_LOGIC_CHANNELS:
vdev->num_channels = g_variant_get_int32(data);
break;
+ case SR_CONF_NUM_ANALOG_CHANNELS:
+ vdev->num_analog_channels = g_variant_get_int32(data);
+ break;
default:
return SR_ERR_NA;
}
struct sr_channel *ch;
int ret, i, j;
uint64_t tmp_u64;
- int total_channels, k;
+ int total_channels, total_analog, k;
+ GSList *l;
int unitsize;
char **sections, **keys, *val;
char channelname[SR_MAX_CHANNELNAME_LEN + 1];
sr_channel_new(sdi, k, SR_CHANNEL_LOGIC,
FALSE, channelname);
}
+ } else if (!strcmp(keys[j], "total analog")) {
+ total_analog = g_key_file_get_integer(kf,
+ sections[i], keys[j], &error);
+ if (!sdi || total_analog < 0 || error) {
+ ret = SR_ERR_DATA;
+ break;
+ }
+ sr_config_set(sdi, NULL, SR_CONF_NUM_ANALOG_CHANNELS,
+ g_variant_new_int32(total_analog));
+ for (k = 0; k < total_analog; k++) {
+ g_snprintf(channelname, sizeof(channelname),
+ "%d", k);
+ sr_channel_new(sdi, k, SR_CHANNEL_ANALOG,
+ FALSE, channelname);
+ }
} else if (!strncmp(keys[j], "probe", 5)) {
tmp_u64 = g_ascii_strtoull(keys[j] + 5, NULL, 10);
if (!sdi || tmp_u64 == 0 || tmp_u64 > G_MAXINT) {
sr_dev_channel_name_set(ch, val);
g_free(val);
sr_dev_channel_enable(ch, TRUE);
+ } else if (!strncmp(keys[j], "analog", 6)) {
+ tmp_u64 = g_ascii_strtoull(keys[j]+6, NULL, 10);
+ if (!sdi || tmp_u64 == 0 || tmp_u64 > G_MAXINT) {
+ ret = SR_ERR_DATA;
+ break;
+ }
+ ch = NULL;
+ for (l = sdi->channels; l; l = l->next) {
+ ch = l->data;
+ if ((guint64)ch->index == tmp_u64 - 1)
+ break;
+ else
+ ch = NULL;
+ }
+ if (!ch) {
+ ret = SR_ERR_DATA;
+ break;
+ }
+ val = g_key_file_get_string(kf, sections[i],
+ keys[j], &error);
+ if (!val) {
+ ret = SR_ERR_DATA;
+ break;
+ }
+ /* sr_session_save() */
+ sr_dev_channel_name_set(ch, val);
+ g_free(val);
+ sr_dev_channel_enable(ch, TRUE);
}
}
g_strfreev(keys);