This patch fixes a bug in the sigrok command-line interface error reporting
when an invalid frame limit is selected for the Hameg/Rohde&Schwarz HMO
mixed-signal oscilloscope driver (hameg-hmo).
Gerhard Sittig [Tue, 15 May 2018 19:18:08 +0000 (21:18 +0200)]
input: make read from stdin work with the presence of -I specs
The previous implementation supported reading from stdin, but only when
-I was not specified (i.e. with auto detectable input formats). Accept
stdin also when -I was specified, i.e. with the full set of supported
input formats (given they can get streamed).
Uwe Hermann [Wed, 25 Apr 2018 05:53:42 +0000 (07:53 +0200)]
Bugfix in order to make sr_session_stop() actually work.
The sr_session_stop() calls were previously invoked with the session
pointer being NULL, which didn't actually stop the session. This could
lead to samples still being processed and (e.g.) passed to libsigrokdecode
for decoding, even though the session should have been stopped.
Fix this by passing the session pointer along in the
sr_session_datafeed_callback_add() function, so that the callbacks
can make use of it.
Uwe Hermann [Mon, 16 Apr 2018 22:23:19 +0000 (00:23 +0200)]
input: Increase chunk size from 16KB to 4MB.
This not only slightly speeds up loading files, but more importantly leads
to larger chunks being passed to input modules (and later potentially output
modules), some of which can have a large performance penalty for small chunks.
In the specific case of e.g. binary input and an .sr output file this change
can lead to a speedup of 220x or more (due to larger chunks for srzip).
Vincent Palatin [Tue, 24 Oct 2017 12:00:29 +0000 (14:00 +0200)]
Force backup analog traces only if needed
With the current conditions, when using the 'srzip' output module with
device generating SR_DF_ANALOG packets, they are processed both by
'srzip' and the backup 'analog' module (as 'out' is always null for
srzip which does its own file operation).
For a moderately fast continuous analog capture (e.g. 2.4MSamples/s),
the overhead of the 'analog' module is important (e.g. 80% of the whole
processing of my workstation) while we are not using its output,
so disable it when the user actually selected an output format/file
but the module doesn't generate text output.
Also remove the second part of the condition as 'opt_output_format'
never seems to be null or at least not in the case where the user has
omitted output parameters.
Tested with a device generating analog packets both with '-o test.sr'
and no output option.
Gerhard Sittig [Sun, 9 Jul 2017 12:09:31 +0000 (14:09 +0200)]
decode: Always print colon after protocol decoder ID
Remove the "bug compatibility" support. It's assumed that the omission
of the colon after the protocol decoder ID in log level 3 was less of a
design choice, but instead a byproduct of the redundancy in a previous
implementation (multiple code paths that got out of sync).
Gerhard Sittig [Sun, 9 Jul 2017 11:56:45 +0000 (13:56 +0200)]
decode: Optionally print sample numbers with protocol decoder annotations
Introduce the "--protocol-decoder-samplenum" command line option (no
short form available), which emits sample numbers with textual output
from protocol decoder annotations, regardless of a log level value.
This shall increase usability of sigrok-cli output with external
postprocessors, as the option exclusively adds sample numbers to the
output but does not affect the presence or layout of any other line.
This commit prepends "text" and "meta" annotations with sample number
information. It does not change "binary" output.
Gerhard Sittig [Sun, 9 Jul 2017 11:44:39 +0000 (13:44 +0200)]
decode: Rework logic for text output of protocol decoder annotations
Fold the previous three code paths which formatted text output for
annotations into one code path, which inspects the flags that were
determined before the actual output, and then always formats the fields
in identical ways regardless of why a field is shown.
Remove the assert checks that were introduced in a previous commit. The
logic for the field selection was proven to be identical to the previous
behaviour.
Gerhard Sittig [Sun, 9 Jul 2017 11:10:31 +0000 (13:10 +0200)]
decode: Prepare to rework text output for protocol decoder annotations
When the current implementation receives a protocol decoder annotation,
one out of several code paths prints one of several different variations
of text layout. The current implementation exclusively checks the active
log level to determine the layout variant.
Prepare to rework that text layout logic. Separate the determination of
which fields to display from the logic which does emit those fields in a
specific format.
This commit does not yet adjust the print statements. It is supposed to
verify that the "which fields to display?" logic results in identical
behaviour to the previous implementation.
Gerhard Sittig [Sat, 17 Jun 2017 16:19:34 +0000 (18:19 +0200)]
session: Adjust scan for non-demo device
The "demo?" condition is a property of the driver not a device instance.
Adjust the check accordingly, by not passing the 'sdi' when retrieving
the list of options. Rename the involved variable to reflect its purpose.
Adjust an error message text.
Uwe Hermann [Thu, 8 Jun 2017 21:16:18 +0000 (23:16 +0200)]
Fix various clang warnings.
../show.c:668:30: warning: variable 'q' is uninitialized when used here [-Wuninitialized]
s = sr_period_string(p, q);
^
../show.c:324:30: note: initialize the variable 'q' to silence this warning
const uint64_t *uint64, p, q, low, high;
^
= 0
../show.c:668:27: warning: variable 'p' is uninitialized when used here [-Wuninitialized]
s = sr_period_string(p, q);
^
../show.c:324:27: note: initialize the variable 'p' to silence this warning
const uint64_t *uint64, p, q, low, high;
^
= 0
../show.c:458:58: warning: variable 'high' is uninitialized when used here [-Wuninitialized]
printf(" Maximum number of samples: %"PRIu64"\n", high);
^~~~
../show.c:324:41: CC input.o
note: initialize the variable 'high' to silence this warning
const uint64_t *uint64, p, q, low, high;
^
= 0
../show.c:589:33: warning: variable 'low' is uninitialized when used here [-Wuninitialized]
printf("%"PRIu64"-%"PRIu64, low, high);
^~~
../show.c:324:35: note: initialize the variable 'low' to silence this warning
const uint64_t *uint64, p, q, low, high;
^
= 0
Soeren Apel [Mon, 5 Jun 2017 15:16:30 +0000 (17:16 +0200)]
Installer: Add "sigrok-cli" to uninstaller/Zadig links.
Windows 10 merges all links of the same vendor ("sigrok" here) into one
section in the Start menu. If PulseView and sigrok-cli are installed,
there will be two "Uninstall" links and the user will not know which one
uninstalls which program.
It might be surprising when the sigrok-cli(1) program does nothing (yet
spends user noticable time) before quitting while it spews the --help
text to the screen. Expand the builtin help text, explicitly mention
that either of --samples or --frames or --time or --continuous are
essentially required for data acquisition.
Karl Palsson [Tue, 29 Nov 2016 16:21:30 +0000 (16:21 +0000)]
Show annotations based on decoder ID
Originally, decoder ID was equal to decoder instance ID, so it didn't
matter what you were comparing with. However, with distinct decoder
instances, this assumption fails. Because instance IDs can't be known
in advance, and because it would make the CLI arguments even more
complex, we simply let the -A option continue to be per decoder, not per
instance. This maintains compatibility with prior behaviour, but
doesn't allow the full flexibility possible with the library.
Behaviour preserved:
Single PD, no -A flag => all annotations from PD
Single PD, -A pdid => all annotations from PD
Single PD, -A pdid=annX => annX from PD
Behaviour now added:
Duplicate PDs, no -A flag => all annotations from all PDs
Duplicate PDs, -A pdid => all annotations from all PDs of type pdid
Duplicate PDs, -A pdid=annX => all annX from all PDs of type pdid
Karl Palsson [Tue, 29 Nov 2016 13:19:46 +0000 (13:19 +0000)]
Include decoder instance ID in normal outputs
Without this, it's nigh impossible to determine what lines of output are
from what decoder. While -l 4 and above will include this information,
this feels like something that is essential even at the basic level.
Old:
System Realtime: active sensing
System Realtime: active sensing
System Realtime: active sensing
UNHANDLED DATA: 0x00
Channel 1: note on (note = 51 'D#3', velocity = 70)
System Realtime: active sensing
System Realtime: active sensing
System Realtime: active sensing
System Realtime: active sensing
UNHANDLED DATA: 0x00
Channel 1: note on (note = 51 'D#3', velocity = 70)
System Realtime: active sensing
New:
midi1: System Realtime: active sensing
midi1: System Realtime: active sensing
midi1: System Realtime: active sensing
midi1: UNHANDLED DATA: 0x00
midi1: Channel 1: note on (note = 51 'D#3', velocity = 70)
midi1: System Realtime: active sensing
midi2: System Realtime: active sensing
midi2: System Realtime: active sensing
midi2: System Realtime: active sensing
midi2: UNHANDLED DATA: 0x00
midi2: Channel 1: note on (note = 51 'D#3', velocity = 70)
midi2: System Realtime: active sensing
Karl Palsson [Fri, 25 Nov 2016 16:28:17 +0000 (16:28 +0000)]
Support multiple protocol decoder stacks
Requires libsigrokdecode changes to actually work.
This allows multiple -P options to be specified, each of which is
registered as a full stack with libsigrokdecode.
At this point, there's no way to specify annotations per instance, the
annotations are simply global per decoder (as before) rather than per
instance.
Karl Palsson [Thu, 24 Nov 2016 12:29:09 +0000 (12:29 +0000)]
Drop -S stack option
The -P option already stacks. The -S option was only used for changing the
stacking order. Simply require the correct order with -P. This reduces
the confusion in stacking.
Uwe Hermann [Fri, 17 Feb 2017 08:24:18 +0000 (09:24 +0100)]
sigrok-cli_cross.nsi.in: Use Python 3.4 (Windows XP support).
The last Python version to officially support Windows XP was 3.4.x.
We'll keep the Windows installers at that version for the time being,
until Windows XP support is no longer feasible (e.g. because important
sigrok requirements such as Qt, glib, or libusb drop XP suppport).
Gerhard Sittig [Sun, 16 Oct 2016 16:25:30 +0000 (18:25 +0200)]
show: print binary classes as well in protocol decoder details
The output of `sigrok -P <decoder> --show` omitted the binary classes,
users could not learn which specs are available for the -B option. Add
a "Binary classes:" section after the list of annotations.
Daniel Elstner [Fri, 9 Oct 2015 16:33:14 +0000 (18:33 +0200)]
build: Require GLib 2.32.0
This is needed for the G_SOURCE_REMOVE symbolic constant. Although
it would be trivial to make do without it, there is no reason not to
bump the requirement since libsigrok depends on GLib 2.32.0 anyway.
Daniel Elstner [Fri, 9 Oct 2015 16:26:00 +0000 (18:26 +0200)]
anykey: Use GLib I/O channel watch
Watch for input on a GLib I/O channel using the standard GLib main
loop API instead of injecting an FD event source into the sigrok
session loop.
Also run the session in a main loop created by sigrok-cli instead
of using sr_session_run(). This is mainly for demonstration; the
GLib I/O watch change would work even with sr_session_run() since
it is using the same main context in this case.
Daniel Elstner [Sun, 13 Sep 2015 20:42:51 +0000 (22:42 +0200)]
Build: Include <config.h> first in all source files
Since Autoconf places some important feature flags only into the
configuration header, it is necessary to include it globally to
guarantee a consistent build.
Aurelien Jacobs [Thu, 12 Feb 2015 16:08:33 +0000 (17:08 +0100)]
show: pass NULL parameter to config_key_has_cap() instead of uninitialized cg.
It doesn't make sense to pass a cg to this config_key_has_cap() call
as it is trying to retrieve the device's global SR_CONF_LIMIT_SAMPLES.
This fixes the following warning:
show.c: In function ‘show_dev_detail’:
show.c:392:8: warning: ‘cg’ may be used uninitialized in this function [-Wmaybe-uninitialized]
&& config_key_has_cap(driver, sdi, cg, key, SR_CONF_LIST)) {
^
opt_to_gvar: print an error message for unsupported data types
Unsupported data types are silently ignored in opt_to_gvar() switch
statement. This leads to confusion as sigrok-cli just exits without
giving the user any hint on what's the reason for not setting the option
properly.