Fix probe index error when load certain probes enabled *.dsl file

This commit is contained in:
DreamSourceLab 2015-09-29 11:20:06 +08:00
parent 49eea5765d
commit a042fabfb6
4 changed files with 6 additions and 11 deletions

View File

@ -208,7 +208,7 @@ SR_API gboolean sr_dev_has_option(const struct sr_dev_inst *sdi, int key)
if (!sdi || !sdi->driver || !sdi->driver->config_list)
return FALSE;
if (sdi->driver->config_list(SR_CONF_DEVICE_OPTIONS, &gvar, NULL, NULL) != SR_OK)
if (sdi->driver->config_list(SR_CONF_DEVICE_OPTIONS, &gvar, sdi, NULL) != SR_OK)
return FALSE;
ret = FALSE;

View File

@ -107,7 +107,6 @@ static const int32_t hwcaps[] = {
SR_CONF_SAMPLERATE,
/* These are really implemented in the driver, not the hardware. */
SR_CONF_MAX_HEIGHT,
SR_CONF_LIMIT_SAMPLES,
SR_CONF_CONTINUOUS,
};

View File

@ -121,7 +121,6 @@ static const int hwcaps[] = {
SR_CONF_DEMO_DEV,
SR_CONF_SAMPLERATE,
SR_CONF_PATTERN_MODE,
SR_CONF_MAX_HEIGHT,
SR_CONF_LIMIT_SAMPLES,
SR_CONF_LIMIT_MSEC,
SR_CONF_CONTINUOUS,

View File

@ -206,7 +206,7 @@ SR_API int sr_session_load(const char *filename)
g_variant_new_uint64(total_probes), sdi, NULL, NULL);
for (p = 0; p < total_probes; p++) {
snprintf(probename, SR_MAX_PROBENAME_LEN, "%" PRIu64, p);
if (!(probe = sr_channel_new(p, SR_CHANNEL_LOGIC, TRUE,
if (!(probe = sr_channel_new(p, SR_CHANNEL_LOGIC, FALSE,
probename)))
return SR_ERR;
sdi->channels = g_slist_append(sdi->channels, probe);
@ -217,17 +217,14 @@ SR_API int sr_session_load(const char *filename)
enabled_probes++;
tmp_u64 = strtoul(keys[j]+5, NULL, 10);
/* sr_session_save() */
sr_dev_probe_name_set(sdi, tmp_u64 - 1, val);
sr_dev_probe_name_set(sdi, tmp_u64, val);
sr_dev_probe_enable(sdi, tmp_u64, TRUE);
} else if (!strncmp(keys[j], "trigger", 7)) {
probenum = strtoul(keys[j]+7, NULL, 10);
sr_dev_trigger_set(sdi, probenum, val);
}
}
g_strfreev(keys);
/* Disable probes not specifically listed. */
if (total_probes)
for (p = enabled_probes; p < total_probes; p++)
sr_dev_probe_enable(sdi, p, FALSE);
}
devcnt++;
}
@ -307,9 +304,9 @@ SR_API int sr_session_save(const char *filename, const struct sr_dev_inst *sdi,
probe = l->data;
if (probe->enabled) {
if (probe->name)
fprintf(meta, "probe%d = %s\n", probecnt, probe->name);
fprintf(meta, "probe%d = %s\n", probe->index, probe->name);
if (probe->trigger)
fprintf(meta, " trigger%d = %s\n", probecnt, probe->trigger);
fprintf(meta, " trigger%d = %s\n", probe->index, probe->trigger);
probecnt++;
}
}