From: Soeren Apel Date: Sun, 21 May 2017 15:10:38 +0000 (+0200) Subject: Virtual session: Workaround for SR_CONF_CAPTUREFILE (#944) X-Git-Tag: libsigrok-0.5.0~60 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=16a1d50a6372725c6b4f5b76175f62a64366bfa0;p=libsigrok.git 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. --- diff --git a/src/session_driver.c b/src/session_driver.c index 285fa624..684a7e53 100644 --- a/src/session_driver.c +++ b/src/session_driver.c @@ -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; } }