Soeren Apel [Tue, 22 May 2018 07:24:13 +0000 (09:24 +0200)]
Session: Allow an SR_DF_META packet to override the samplerate
Otherwise, the sample rate determined by the read_config() call
in Session::sample_thread_proc() will be kept even if it's wrong
and the driver wants to submit the correct one.
Uwe Hermann [Mon, 21 May 2018 14:38:13 +0000 (16:38 +0200)]
tracegroup.cpp: Fix a potential unintended integer division.
Reported by Coverity (CID 279773):
Result is not floating-point (UNINTENDED_INTEGER_DIVISION)
integer_division: Dividing integer expressions -5 and 2, and then
converting the integer quotient to type double. Any remainder, or
fractional part of the quotient, is ignored.
Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN)
overflow_before_widen: Potentially overflowing expression 1 << power
with type int (32 bits, signed) is evaluated using 32-bit arithmetic,
and then used in a context that expects an expression of type
uint64_t const (64 bits, unsigned).
Uwe Hermann [Sat, 19 May 2018 17:31:59 +0000 (19:31 +0200)]
logicsegment.cpp: Add missing config.h #include.
Without this #include, HAVE_UNALIGNED_LITTLE_ENDIAN_ACCESS was not
available and thus the faster path in LogicSegment::unpack_sample() and
LogicSegment::pack_sample() was never used.
Gerhard Sittig [Sat, 12 May 2018 06:31:52 +0000 (08:31 +0200)]
DecodeSignal: avoid specifying a zero samplerate to libsigrokdecode
When the sample rate is not known, avoid claiming the value would be
zero and calling setup routines in backend libraries. Although the call
is not strictly fatal, this simple check avoids potential log messages
at callee's for this unexpected condition.
Gerhard Sittig [Mon, 14 May 2018 18:25:41 +0000 (20:25 +0200)]
session: apply input format match to interactively loaded files, too
Move the format match logic from load_init_file() to load_file(), so
that it transparently takes effect on each "opened" file. Users still
can choose to "import" files and specify options when required. In the
case of lookup miss, sigrok session is assumed as before.
Gerhard Sittig [Sun, 13 May 2018 06:59:02 +0000 (08:59 +0200)]
session: add support to auto detect input format (for init file)
Extend the Session::load_init_file() method, to have the input format
automatically detected in the absence of an -I spec upon startup.
This fixes part of bug 1015. Input files specified at the command line
when pulseview gets invoked are handled. Files that interactively get
loaded while pulseview is running are not handled yet.
DecodeTrace: Use qreal instead of int for annotation drawing
This is to prevent "blinking" of annotations when they would merge into
blocks and break off of them again, noticeable when zooming in and out
using a track pad or touchscreen.
Issue #1: As decoding happens while the trace is drawn, the
annotations may actually overlap with the bar because the number
of decoded samples is outdated.
Issue #2: The bar is a little too low and off-center.
Uwe Hermann [Sat, 14 Apr 2018 20:23:52 +0000 (22:23 +0200)]
inputfile: Increase chunk size from 16KB to 4MB.
Use a 4MB chunk size for reading a file into memory. Larger values don't
seem to provide any substancial performance improvements, but can cause
UI lag and a visually "stuttering" display of the data currently loading.
Channels: Don't use flat buttons and add vertical spacer
With the buttons being flat, users may not recognize the labels as
buttons intuitively. Hence, make the buttons explicitly appear as
such. To make the dialog more aesthetically pleasing, we add some
vertical space between the check boxes and the buttons.
Uwe Hermann [Sun, 1 Apr 2018 17:26:16 +0000 (19:26 +0200)]
CMakeLists.txt: Set CMake policy CMP0054 to NEW.
This prevents the following warnings upon a second cmake run:
CMake Warning (dev) at /usr/share/cmake-3.10/Modules/CMakePushCheckState.cmake:65 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run "cmake --help-policy CMP0054" for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Quoted variables like "HAVE_CXX_ATOMICS_WITHOUT_LIB" will no longer be
dereferenced when the policy is set to NEW. Since the policy is not set
the OLD behavior will be used.
Call Stack (most recent call first):
CMakeLists.txt:123 (cmake_push_check_state)
CMakeLists.txt:139 (check_working_cxx_atomics)
This warning is for project developers. Use -Wno-dev to suppress it.
Gerhard Sittig [Tue, 2 Jan 2018 19:03:56 +0000 (20:03 +0100)]
DecodeSignal: Reset and re-use existing decoder sessions
Instead of destroying and re-creating decoder sessions, re-use
previously created sessions by just terminating their current work and
resetting internal state.
This implementation most proboably is incomplete in respect of changes
to the stack hierarchy or individual decoders' properties. This needs
more attention. When the stack is kept but its configuration has changed,
the involved properties need to get "somehow applied to" the stack's
instances before re-using it with new input data will yield correct results.
Dan Horák [Fri, 23 Mar 2018 20:33:18 +0000 (21:33 +0100)]
fix catching polymorphic types by value
Compiling with GCC 8 produces a new warning about catching polymorphic
types by value. Proper way is to use references instead.
/home/sharkcz/projects/pulseview/main.cpp: In function ‘int main(int, char**)’:
/home/sharkcz/projects/pulseview/main.cpp:229:22: error: catching polymorphic type ‘class std::exception’ by value [-Werror=catch-value=]
} catch (exception e) {
^
cc1plus: all warnings being treated as errors
Soeren Apel [Thu, 8 Mar 2018 23:28:42 +0000 (00:28 +0100)]
Fix #1125 by adding a missing typecast
Without this typecast, the return type of get_sample_count() is
a uint64_t, which doesn't go well when it's 0 and we subtract 1
from it. Assigning the result of this underflow to an int64_t
doesn't help, it's too late.
Soeren Apel [Mon, 12 Mar 2018 14:58:06 +0000 (15:58 +0100)]
SignalBase: Speed up conversion and prevent leaving samples unconverted
Unconverted samples can happen due to a race condition: being notified
of new samples coming in is ignored when the thread is already executing.
If these notifications however were the last ones sent out because the
segment was completed right after, the currently ongoing conversion
will finish but not be restarted with the final sample range.
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.