Commit Graph

4886 Commits

Author SHA1 Message Date
Uwe Hermann d828b05e65 scpi-pps: Rigol DP71x: Make OVP/OCP threshold listable. 2018-06-01 15:47:48 +02:00
Frank Stettner 1c8901f744 scpi: Use locale independent sr_vsnprintf_ascii() and sr_vsprintf_ascii() functions. 2018-06-01 15:46:17 +02:00
Frank Stettner 7ca40d2d1c tests: Tests for the locale independent sr_vsprintf_ascii() function. 2018-06-01 15:46:17 +02:00
Frank Stettner 21ef355e50 strutil: Locale independent sprintf() and vsprintf() functions 2018-06-01 15:46:17 +02:00
Frank Stettner 49a468ed8b scpi-pps: Add listable OVP/OCP threshold for HP 66xxx and prepared all other 2018-06-01 15:46:17 +02:00
Frank Stettner a61c8cce01 scpi-pps: Add HP 6631B, HP 66332A, HP 6633B and HP 6634B power supplies 2018-06-01 15:46:17 +02:00
Frank Stettner 7e381bfc3c scpi-pps: Add missing functionality for the HP 6632B power supply. 2018-06-01 15:46:17 +02:00
Frank Stettner 17a82e83ff scpi-pps: Reimplemention of switching channel groups (PSU channels)
Acquisition won't work correctly in a multi-threaded environment, when
config_set() and config_get() are called with a channel group.
The channel switching itself has moved to scpi/scpi.c, to be able to
handle switching in a thread safe way.
2018-06-01 15:46:17 +02:00
Frank Stettner fa2ce8c762 scpi-pps: Use thread safe SCPI functions, return float not double.
Use of the thread safe SCPI functions, so no write+read operation is
interruped.

Also return float values instead of double value in acquisition mode.
This is related to bug #779.
2018-06-01 15:46:17 +02:00
Frank Stettner fd20e59caa scpi: Synchronize read, write and write+read operations.
This ensures that SCPI read/write/write+read operations are thread safe.
F.e.: If a write operation expects a return value (in other words: a
read operation), it is not allowed to be interrupted by another write
operation.

To simplify things, the SCPI helper functions are moved from
scpi/helpers.c to scpi/scpi.c and also are renamed to fit the naming
scheme.

libgpib in particular will abort the program execution in case of
concurrent operations.
2018-06-01 15:46:17 +02:00
Uwe Hermann 1c5adc5ff7 scpi.c: Drop an unneeded log message.
The IDN string is already logged by sr_scpi_get_string().
2018-06-01 14:43:10 +02:00
Uwe Hermann 0c8aedb543 scpi_serial.c: Improve an error message. 2018-06-01 14:43:10 +02:00
Uwe Hermann 0261956fab scpi_serial.c: Drop an unneeded log message.
The number of bytes read is already logged by the serial backend:

  sr: [00:00.072857] scpi_serial: Read 1 bytes into buffer.
  sr: [00:00.073884] serial: Read 1/2008 bytes.
  sr: [00:00.073900] scpi_serial: Read 1 bytes into buffer.
  sr: [00:00.074896] serial: Read 1/2007 bytes.
  sr: [00:00.074905] scpi_serial: Read 1 bytes into buffer.
  sr: [00:00.075949] serial: Read 1/2006 bytes.
2018-06-01 14:43:10 +02:00
Uwe Hermann 319fe9cea6 scpi-pps: Add support for the Rigol DP711/DP712. 2018-06-01 14:43:10 +02:00
Gerhard Sittig 13ac09279a input/chronovu_la8: claim responsibility for LA16 files, devel comments
The chronovu_la8 input module is capable of handling either file type,
generated by LA8 or LA16 vendor software. Automatic detection is not
available, but user provided channel counts work fine.

Adjust the input module's name and description, and claim support for
.kdt as well as .kd1 files.

Add developer notes on implementation details, the file content's
constraints, and potential future adjustment.
2018-05-25 23:21:43 +02:00
Gerhard Sittig e8eb24222c input/chronovu_la8: only send data to the session, don't send the header
The file format is funny, a data part is leading (fixed size) and a
"header" part follows. The previous implementation sent the header part
to the session, too, pretending it was part of the data. This change
limits the number of samples that get sent to the session.

Comment on the file layout and header fields while we are here. This
information got lost in commit 02e24c0ce0 when the input module got
converted from do-it-yourself file operations to having intrinsic
handler routines invoked from common logic which handles the file.
2018-05-25 23:07:28 +02:00
Gerhard Sittig 20358f90b4 input/logicport: unobfuscate 64-bit-clean bit mask literals
Prefer the more portable UINT64_C() macro over the UL suffix when a
literal needs to span "more than 31 bit positions". Adjust other
locations for consistency across the source file.
2018-05-21 20:15:48 +02:00
Gerhard Sittig 67765e465a input/trace32_ad: fix potential buffer overflow for unexpected input data
Commit 8c4bff1d25 introduced a routine which prints what mostly should
be text, and avoids non-printable characters. This implementation used an
incorrect format string, which could result in data getting written past
the end of a buffer. Fix the format string.
2018-05-21 20:13:27 +02:00
Uwe Hermann 090f1e1e54 hwdriver.c: Fix two scan-build warnings.
src/hwdriver.c: In function ‘log_key’:
  src/hwdriver.c:648:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    opstr = op == SR_CONF_GET ? "get" : op == SR_CONF_SET ? "set" : "list";
               ^~
  src/hwdriver.c: In function ‘check_key’:
  src/hwdriver.c:681:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    opstr = op == SR_CONF_GET ? "get" : op == SR_CONF_SET ? "set" : "list";
               ^~
2018-05-19 22:23:16 +02:00
Uwe Hermann b4580cb9d0 siglent-sds: Fix multiple scan-build warnings.
src/hardware/siglent-sds/api.c:596:3: warning: Argument to g_free() is the address of a global variable, which is not memory allocated by malloc()
                  g_free(cmd);
                  ^~~~~~~~~~~
  src/hardware/siglent-sds/api.c:641:3: warning: Argument to g_free() is the address of a global variable, which is not memory allocated by malloc()
                  g_free(cmd);
                  ^~~~~~~~~~~
2018-05-19 22:01:28 +02:00
Uwe Hermann d5db6ea7e1 lecroy-xstream: Fix a potential memory leak.
Reported by scan-build:

  src/hardware/lecroy-xstream/protocol.c:680:12: warning: Potential leak of memory pointed to by 'analog.data'
                                  return SR_ERR;
                                         ^~~~~~
2018-05-19 22:01:26 +02:00
Uwe Hermann 4fc4b8e7aa hameg-hmo: Fix two potential memory leaks.
Reported by scan-build:

  src/hardware/hameg-hmo/api.c:533:12: warning: Potential leak of memory pointed to by 'pod_enabled'
                                  return SR_ERR;
                                         ^~~~~~
2018-05-19 22:01:21 +02:00
Uwe Hermann 24801f4e80 input/logicport: Fix outdated format_match().
Reported by scan-build:

  src/input/logicport.c:1186:18: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
    .format_match = format_match,
                    ^~~~~~~~~~~~
2018-05-19 22:01:18 +02:00
Gerhard Sittig 092843eb42 bindings: wrap sr_input_scan_file() in the C++ language binding
Allow C++ applications to have the input format automatically detected,
and get a corresponding InputFormat instance. This makes the format match
logic available to PulseView.
2018-05-17 22:31:27 +02:00
Gerhard Sittig c83bdde9da input: provide accessor routine for (struct sr_input *)->module
Add a public API routine which allows applications to query the
sr_input_module from an sr_input.
2018-05-17 22:31:27 +02:00
Gerhard Sittig 83df004be1 input/trace32_ad: data type nits, log verbosity in header parsing
Log determined header format when parsing trace32 file headers. Keep
another log message during regular processing, but silence it during
format match.

Use more appropriate data types for local and instance variables. Adjust
format strings accordingly.
2018-05-17 22:30:44 +02:00
Gerhard Sittig 80430d4d20 input/trace32_ad: rephrase the header parse logic
There were several issues with the previous implementation of the logic
which parses trace32 input files: A string comparison was inverted, and
compared a seven character literal to a five character copy of the input.
One more character was trimmed before CTRL-Z (the CP/M EOF), which often
is SPACE in input files, but might be excessive on other input files.

Replace a DIY character search while we are here. Use symbolic names for
special characters. Factor out a test and memory release, to simplify
error code paths in the remaining logic. Extend comments.
2018-05-17 22:30:44 +02:00
Gerhard Sittig 8c4bff1d25 input/trace32_ad: silence format match logging, improve robustness
There is not much point in log messages about format mismatch in the
auto detect phase, where each module gets queried in turn and most are
supposed to not match.

Do not print non-printable characters in log messages. Those could occur
in the format detection phase, or in the regular processing of input
files that either are unexpected or invalid (or is there a binary header
format variant even?).
2018-05-17 22:30:44 +02:00
Gerhard Sittig f54a55da2d input/chronovu_la8: address file size data type nits
Although the file format handled by this input module appears to be of
fixed size (8MiB plus 5 more bytes), it's more reliable to use a data
type for the file size that is larger than "an int". Although off_t
would be most portable, use uint64_t to match the code which passes the
parameter to the input module.
2018-05-17 22:25:40 +02:00
Gerhard Sittig 0dabb880af input: pass larger buffer to auto format detection
The previous implementation already was inconsistent (used to allocate
255 bytes and claimed that 128 bytes were sufficient). While existing
formats already required more than a few bytes of input (regular VCD
files' header sections exceed 255 bytes length).

Increase the buffer size that gets passed to input modules' match
method. Use 4MiB for consistency with other locations. Do not enforce a
minimum size, as there are valid input files which are shorter than 128
bytes. Auto-detection failed on those.

This addresses part of bug #1200.
2018-05-17 22:25:40 +02:00
Gerhard Sittig 54ee427df0 input: add confidence (detection strength) to format_match()
When users don't specify the input format, applications can try to have
the format auto-detected. Some of the tests were weak and could result
in false positives.

Add a 'confidence' parameter to the input modules' format_match()
method. Claim high confidence (1) for those formats which can check
magic strings or the presence of essential keywords (vcd, wav). Claim
medium confidence (10) for those formats which happened to mis-detect
inputs in the past (trace32_ad). Claim weak confidence (100) for those
formats which totally lack reliable conditions and rather guess than
detect (chronovu_la8).

Prefer the best match in public scan routines. Return at most one module
to callers even if multiple modules matched, to keep the current API.

This addresses part of bug #1200.
2018-05-17 22:23:35 +02:00
Uwe Hermann 7102443a4a input/logicport: Drop some unneeded allocation checks. 2018-05-17 21:09:48 +02:00
Gerhard Sittig e1b115bd4d input/logicport: introduce input module for LogicPort File (*.lpf)
Implement an input module for .lpf files, the "LogicPort File" format of
the Intronix LA1034 vendor software. This version supports wires with
enabled and inverted state, compressed samples, signal names, signal
groups (but not multiple assignment), and automatic format detection.

The logic which determines whether "the file header" was completely
received, and sample data can get sent to the session, implements an
assumption in the absence of a better and more reliable condition.

Invalid input gets rejected, but diagnostics is rather limited. Since
all channels get to be the member of a channel group, either specified
by the user in the input file, or arranged for in the input module, the
"missing separator" part of bug 1186 has become obsolete.
2018-05-17 21:07:42 +02:00
Uwe Hermann 3601d50e26 libsigrok.h: Fix multiple compiler warnings (-Wshift-overflow=2).
../include/libsigrok/libsigrok.h:653:19: warning: result of ‘1 << 31’ requires 33 bits to represent, but ‘int’ only has 32 bits [-Wshift-overflow=]
    SR_CONF_GET = (1 << 31),
                     ^~

[...]
2018-05-16 23:57:58 +02:00
Uwe Hermann 0519db864b sr_analog_to_float(): Fix multiple compiler warnings (-Wshadow).
src/analog.c:205:23: warning: declaration of ‘i’ shadows a previous local [-Wshadow]
       for (unsigned int i = 0; i < count; i++) {
                         ^
  src/analog.c:178:18: note: shadowed declaration is here
    unsigned int b, i, count;
                    ^
[...]
2018-05-16 23:57:58 +02:00
Uwe Hermann 741bcf503d sr_analog_to_float(): Fix a compiler warning (-Wshadow).
src/analog.c: In function ‘sr_analog_to_float’:
  src/analog.c:194:9: warning: declaration of ‘offset’ shadows a previous local [-Wshadow]
   float offset = analog->encoding->offset.p / (float)analog->encoding->offset.q;
         ^~~~~~
  src/analog.c:177:8: note: shadowed declaration is here
  float offset;
        ^~~~~~
2018-05-16 22:48:35 +02:00
Gerhard Sittig 53ea24610e demo: optionally accept frame limit spec at scan time
Allow developers to specify the (default) number of frames at compile
time (default to "off" as before). Accept the frame limit spec at scan()
time as well. This is useful when applications don't run config_set() at
runtime.

Tested with:
$ pulseview -d demo:logic_channels=0:analog_channels=1:limit_frames=4
2018-05-13 20:03:21 +02:00
Gerhard Sittig fb193945b6 demo: make frame generation (and maximum frame count) a runtime option
The previous implementation supported the generation of frames as a
compile time option. This change lets users adjust the feature at
runtime.

In the absence of a frame count limit no frame begin/end markers get
sent (the default behaviour of the previous implementation). When a
frame count limit is specified, the respective number of frames gets
sent and acquisition stops.

The fixed amount of 1000 samples per frame is an arbitrary choice. This
compile time option is easily adjusted in the source code.
2018-05-13 20:03:21 +02:00
Gerhard Sittig 0373343046 demo: introduce graycode generator mode
Introduce support for the "graycode" logic pattern. Generate up to
64 bits of graycode output (all logic lines, no repetition, not limited
by the generator's internal pattern buffer). The implementation was
tested with 16 channels.
2018-05-13 19:45:46 +02:00
Gerhard Sittig 015f09702a demo: add convenient bit mask for "all logic channels"
Keep a context variable around with a bit mask for all logic channels.
This is convenient in setup and generation routines, to avoid garbage
in unassigned bit positions of session feed packets.
2018-05-13 19:40:00 +02:00
Gerhard Sittig 817e759ddc demo: data type nits in the device context (enum, unsigned int)
Move the declaration of codes for pattern types before the declaration
of the context container such that the latter can reference the former.
Add 'int' to an unsigned variable that omitted the base type.
2018-05-13 19:27:51 +02:00
Gerhard Sittig cdb134eb19 input/trace32_ad: silence format errors during input format match
When auto-detection tries to find the input module that can handle a
file, unexpected input format should be considered non-fatal. Only emit
error messages when process_header() got invoked from process_buffer()
after initialization. Emit debug messages in early stages where no input
module context exists yet.
2018-04-28 23:42:42 +02:00
Uwe Hermann 55bcd7ad45 dreamsourcelab-dslogic: Properly set initial voltage threshold.
The initial voltage threshold in dev_open() was being set to a
default value in the devc->cur_threshold variable but not actually set
in the device itself.

Patch by Jörg Alpers <jalpers@gmx.net>, thanks a lot!
2018-04-28 23:39:59 +02:00
Uwe Hermann 8a14fc0828 dmm/ms8250d: Fix two log messages. 2018-04-27 00:07:21 +02:00
Mandl 67070942cc Add support for the MASTECH MS8250D multimeter 2018-04-27 00:07:21 +02:00
Uwe Hermann 2bd5d17c70 hantek-4032l: Emit FPGA version log message. 2018-04-24 21:09:42 +02:00
Uwe Hermann eca9772971 soft-trigger: Fix an issue causing triggers to not work. 2018-04-24 16:56:07 +02:00
Uwe Hermann ce97fc3f6a rigol-ds: Fix an issue causing only one channel to be acquired.
This fixes bug #1018.
2018-04-22 18:36:12 +02:00
Uwe Hermann 350501d0c3 rigol-ds: Make two log messages more specific.
Slightly modified version of a suggested change by Aleksander Alsekseev.
2018-04-22 16:49:33 +02:00
Andrej Valek a5b9880eb2 hantek-4032l: Add option to abort acquisition.
Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-04-22 11:16:34 +02:00