Virtual session: Workaround for SR_CONF_CAPTUREFILE (#944)

This is a (hopefully temporary) workaround for the
SR_CONF_CAPTUREFILE mechanism. The value for
vdev->capturefile is set by this, however only once
via stream_session_data().
During stream processing in stream_session_data(),
capturefile may receive new values - e.g. when there
are multiple logic files or if there is analog data.
With that, the initially set capturefile is overwritten.

When re-loading the file, we are then running into
issues because we don't know what the initial value was.
As all .sr files use "logic-1" by default and, we
simulate the behavior of stream_session_data() and
assign this name to capturefile if there are logic
channels present.

With this change, all three kinds of files reload
as expected: logic only, analog only and mixed signal.
For this reason, it's a short-term fix for #944.
This commit is contained in:
Soeren Apel 2017-05-21 17:10:38 +02:00
parent 6fb5570b15
commit 16a1d50a63
1 changed files with 11 additions and 1 deletions

View File

@ -124,7 +124,17 @@ static gboolean stream_session_data(struct sr_dev_inst *sdi)
} else {
/* We got all the chunks, finish up. */
g_free(vdev->capturefile);
vdev->capturefile = NULL;
/* If the file has logic channels, the initial value for
* capturefile is set by stream_session_data() - however only
* once. In order to not mess this mechanism up, we simulate
* this here if needed. For purely analog files, capturefile
* is not set.
*/
if (vdev->num_logic_channels)
vdev->capturefile = g_strdup("logic-1");
else
vdev->capturefile = NULL;
return FALSE;
}
}