sr: fix session loading for 0-numbered probes
They're still numbered starting from 1 in the current version (1) of the sigrok file format, we just work around that for now.
This commit is contained in:
parent
31fc1fbce3
commit
fb381e4d71
|
@ -134,7 +134,7 @@ SR_API int sr_session_load(const char *filename)
|
||||||
sdi->driver->dev_config_set(sdi, SR_HWCAP_CAPTURE_NUM_PROBES, &total_probes);
|
sdi->driver->dev_config_set(sdi, SR_HWCAP_CAPTURE_NUM_PROBES, &total_probes);
|
||||||
for (p = 0; p < total_probes; p++) {
|
for (p = 0; p < total_probes; p++) {
|
||||||
snprintf(probename, SR_MAX_PROBENAME_LEN, "%" PRIu64, p);
|
snprintf(probename, SR_MAX_PROBENAME_LEN, "%" PRIu64, p);
|
||||||
if (!(probe = sr_probe_new(j, SR_PROBE_LOGIC, TRUE,
|
if (!(probe = sr_probe_new(p, SR_PROBE_LOGIC, TRUE,
|
||||||
probename)))
|
probename)))
|
||||||
return SR_ERR;
|
return SR_ERR;
|
||||||
sdi->probes = g_slist_append(sdi->probes, probe);
|
sdi->probes = g_slist_append(sdi->probes, probe);
|
||||||
|
@ -144,13 +144,15 @@ SR_API int sr_session_load(const char *filename)
|
||||||
continue;
|
continue;
|
||||||
enabled_probes++;
|
enabled_probes++;
|
||||||
tmp_u64 = strtoul(keys[j]+5, NULL, 10);
|
tmp_u64 = strtoul(keys[j]+5, NULL, 10);
|
||||||
sr_dev_probe_name_set(sdi, tmp_u64, val);
|
/* sr_session_save() */
|
||||||
|
sr_dev_probe_name_set(sdi, tmp_u64 - 1, val);
|
||||||
} else if (!strncmp(keys[j], "trigger", 7)) {
|
} else if (!strncmp(keys[j], "trigger", 7)) {
|
||||||
probenum = strtoul(keys[j]+7, NULL, 10);
|
probenum = strtoul(keys[j]+7, NULL, 10);
|
||||||
sr_dev_trigger_set(sdi, probenum, val);
|
sr_dev_trigger_set(sdi, probenum, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
g_strfreev(keys);
|
g_strfreev(keys);
|
||||||
|
/* Disable probes not specifically listed. */
|
||||||
for (p = enabled_probes; p < total_probes; p++)
|
for (p = enabled_probes; p < total_probes; p++)
|
||||||
sr_dev_probe_enable(sdi, p, FALSE);
|
sr_dev_probe_enable(sdi, p, FALSE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue