Soeren Apel [Mon, 5 Mar 2018 22:45:46 +0000 (23:45 +0100)]
Fix #1132 by passing segment IDs, not segment instances
Passing segment instances fails because this creates a race condition.
When a long conversion is taking place, the SignalBase::samples_added
signal is called often but since it's in a separate thread, the calls
are queued and aren't executed immediately. Now if the conversion is
restarted - for example as a result of a changed conversion threshold -
then the segments holding the converted data are destroyed, rendering
the pointers submitted as parameters to samples_added invalid.
Once the signal queue is processed, those invalid pointers will be
accessed and PV segfaults.
Since the signal queue can neither be emptied nor flushed, this
leaves only two sensible choices:
1) Signal samples_added less often, thereby reducing the chance of
signals being queued
2) Supply the segment ID instead of the segment instance as that's
essentially the only thing we currently care about - in fact, the
only user of samples_added (ViewBase::on_samples_added) uses the
instance to query only this
As #1 is only a band-aid and not a waterproof solution, I chose
to go with #2.
Uwe Hermann [Sat, 10 Feb 2018 21:01:26 +0000 (22:01 +0100)]
MinGW: Fix a compile error due to a missing #include.
In file included from [...]/pv/globalsettings.cpp:20:0:
[...]/pv/globalsettings.hpp:31:12: error: 'std::function' has not been declared
using std::function;
^
test/CMakeFiles/pulseview-test.dir/build.make:88: recipe for target 'test/CMakeFiles/pulseview-test.dir/__/pv/globalsettings.cpp.obj' failed
make[2]: *** [test/CMakeFiles/pulseview-test.dir/__/pv/globalsettings.cpp.obj] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 5%] Building CXX object CMakeFiles/pulseview.dir/pv/globalsettings.cpp.obj
In file included from [...]/pv/globalsettings.cpp:20:0:
[...]/pv/globalsettings.hpp:31:12: error: 'std::function' has not been declared
using std::function;
^
Add #include <functional> everywhere where std::function is used. Only
the occurence in globalsettings.hpp was causing an actual build failure
on MinGW, though.
Gerhard Sittig [Sun, 4 Feb 2018 13:54:32 +0000 (14:54 +0100)]
MainBar: fixup file extension filter in "Import File" dialog
The previous implementation used a "*" filter when a file of any other
format than srzip got imported. This happened to be a duplicate of
"All files", and ignored the list of filename extensions provided by
the input formats.
This change does respect the input format's file extensions, and copes
with the lack of such a list (raw binary), as well as lists that have
one (most formats), or multiple extensions (raw analog).
This fixes bug #1039.
Another byproduct of the change is that extensions and their decoration
(separators, parentheses) move outside of tr() calls. These technical
details shall not concern translators, and translations for human
languages shall not break the filter mechanism.
This implementation might be "too complex, computationally expensive".
But it works, and fixes an issue, and the code path executes seldom and
waits for user interaction anyway. Cost reduction can get applied later.
Gerhard Sittig [Sun, 28 Jan 2018 20:02:54 +0000 (21:02 +0100)]
DecodeSignal: only pass non-zero sample rate to decoders
As reported in bug #1118 not all input sources provide a samplerate, and
decoder instances may not cope with a rate spec of 0. Only pass non-zero
sample rates to the decoder stack. This improves robustness in addition
to the specific fix for #1118 in the decoders' implementations.
Gerhard Sittig [Wed, 24 Jan 2018 20:11:50 +0000 (21:11 +0100)]
main: introduce -D cmdline option, don't auto-scan for devices
Add a -D command line option which skips auto-detection of devices upon
startup. This can speedup program startup for setups with known devices,
and allows to skip the scan for troubled drivers which might break the
startup phase.
This -D option can be combined with -d specs, either presence or absence
of -d is acceptable when -D is specified. Users still can interactively
scan for and use devices after program startup.
Cenkron [Fri, 12 Jan 2018 18:43:27 +0000 (12:43 -0600)]
win32: Use -mwindows only for non-Debug targets.
Direct cmake to apply the -mwindows linker switch based on a cmake
command line argument rather than by using a patch file. The command
line argument is -DCMAKE_BUILD_TYPE=xxxxx and applies the linker switch
only to WIN32 builds that are not Debug.
Soeren Apel [Tue, 2 Jan 2018 10:07:36 +0000 (11:07 +0100)]
SignalBase: Don't terminate conversion when there's no data
Instead of terminating, we wait instead.
We do this because SignalBase::on_samples_added() somehow doesn't
reliably see that there's no conversion thread active anymore.
conversion_thread_.joinable() returns true when the thread was
already terminated for whatever reason, resulting in on_samples_added()
trying to notify a non-existant thread.
Soeren Apel [Wed, 27 Dec 2017 09:31:30 +0000 (10:31 +0100)]
DecodeSignal: Restructure metadata handling
Instead of handling the metadata separately from the mux/decode segments,
it's much neater to handle both together. Doing this also allows us to
remove the need for query_input_metadata() since we're taking the metadata
from the muxed logic segments.
Adjust trace view header width when signal names change
This change is primarily needed because before, newly
created decode signals had a name assigned to them at time
of the constructor call. This changed, and now the name
is empty upon creation, breaking the previously working
header size adjustment.
Fix #1024 by changing decode channel assigment to PDs
When assigning the decoder stack channels to the libsrd
instance's channels, channels that had no signal assigned
to them were still assigned anyway. This patch fixes this bug.
After doing this, another subtle bug became apparent:
The mapping between channels and bits in the data stream sent
to the PD was done via DecodeChannel->id. This is however
insufficient as the channels of the decoder stack have
IDs that may or may not match the ID needed for the data
stream. Example:
A PD has 4 channels: A, B, C and D. In PV, those channels
have the IDs 0, 1, 2 and 3. If the user only assigns A and D,
Decoder::create_decoder_inst() will use the IDs 0 and 3 as
the bit positions of those signals in the data stream sent
to libsrd. This is obviously wrong.
Hence, we now use a separate bit_id for this purpose.
Soeren Apel [Mon, 7 Aug 2017 19:41:11 +0000 (21:41 +0200)]
AnalogSignal: Draw analog thresholds differently
Instead of using a patterned region on top of the trace,
show the thresholds by using different background colors
for the individual areas: green/grey/red.
Soeren Apel [Sat, 5 Aug 2017 20:38:45 +0000 (22:38 +0200)]
View: Update ruler after restoring session
If we don't do this, the ruler is out-of-sync with the rest
of the view until the session is loaded and goes into stopped
state. At that point, the ruler is updated, which is too late.
Soeren Apel [Wed, 2 Aug 2017 16:42:34 +0000 (18:42 +0200)]
SignalBase: Default to dynamic conversion preset, not custom values
The reason for this change is that when you initially select a
conversion from the channel config popup dialog, the threshold
will be set to "0.0V" or "0.0V/0.0V", respectively.
This is of course not what we want and the root cause is that
when no preset is selected, NoPreset is assumed instead of
DynamicPreset. This patch changes this.
Soeren Apel [Wed, 2 Aug 2017 07:15:18 +0000 (09:15 +0200)]
Move delayed conversion starter to SignalBase
This way, we can use the same mechanism for changing
min/max as well, preventing multiple successive starts
of the conversion algorithm.
Preventing this is necessary because it makes the UI
stop updating for a significant amount of time, which
we obviously don't want.
Two issues here:
1) it's bad style to have an event handler for an event
that was triggered in the same class
2) supplying the current hover point along with the event
is a sensible thing to do
Uwe Hermann [Fri, 21 Jul 2017 05:08:06 +0000 (07:08 +0200)]
INSTALL/CMakeLists.txt: Bump libsigrokdecode requirement to >= 0.6.0.
PulseView now relies on e.g. the fact that multiple libsigrokdecode
calls from different threads don't cause issues (which has not been the
case prior to libsigrokdecode 0.6.0).