]> sigrok.org Git - libsigrok.git/log
libsigrok.git
3 years agotests: extend endianess conversion tests to also cover inline routines
Gerhard Sittig [Wed, 27 May 2020 17:53:09 +0000 (19:53 +0200)]
tests: extend endianess conversion tests to also cover inline routines

Cover the recently introduced inline routines which back the preprocessor
macros for endianess conversion. Add test sequences for read and write
routines for different data types of different sizes, different endianess
formats and signedness, and include those routines which increment the
read/write position.

3 years agolibsigrok-internal.h: add 24bit little endian reader helper
Gerhard Sittig [Tue, 12 May 2020 21:16:05 +0000 (23:16 +0200)]
libsigrok-internal.h: add 24bit little endian reader helper

Add another endianess conversion helper which reads 24bit values in
little endian format.

3 years agolibsigrok-internal.h: rephrase endianess conversion helpers
Gerhard Sittig [Sat, 2 May 2020 16:31:48 +0000 (18:31 +0200)]
libsigrok-internal.h: rephrase endianess conversion helpers

Address style, robustness, and usability nits in the common endianess
conversion helpers in the libsigrok-internal.h header file. Rephrase
preprocessor macros as static inline C language functions to eliminate
side effects, and improve data type safety. Provide macros under the
previous names for backwards compatibility, so that call sites can
migrate to the routines at their discretion (or not at all).

Performance is not affected. Inline routines are identically accessible
to compiler optimizers as preprocessor macros with their text expansion
are. Resulting machine code should be the same.

Introduce variants which also increment the read or write position in
the byte stream after data transfer. This reduces more redundancy at
call sites.

3 years agotests: also cover endianess conversion helpers
Gerhard Sittig [Sun, 10 May 2020 20:37:29 +0000 (22:37 +0200)]
tests: also cover endianess conversion helpers

Introduce a new tests/conv.c source file which exercises the endianess
conversion macros. It's assumed that some use cases may break their
operation, fortunately these edge cases were not seen before, or the
unreliable operation went unnoticed. This test raises awareness of the
implementation's constraints.

This is a start, the test sequence will benefit from adding some more
cases to increase coverage.

3 years agohp-3478a: Fix glib variant ref count in SET MQ request.
Frank Stettner [Sun, 3 May 2020 09:55:05 +0000 (11:55 +0200)]
hp-3478a: Fix glib variant ref count in SET MQ request.

3 years agoscpi-dmm: Fix coding style.
Frank Stettner [Sun, 3 May 2020 08:57:35 +0000 (10:57 +0200)]
scpi-dmm: Fix coding style.

3 years agoserial-dmm: Added support for Metex ME-21 multimeters
Tobias Faeth [Tue, 26 May 2020 19:07:42 +0000 (21:07 +0200)]
serial-dmm: Added support for Metex ME-21 multimeters

3 years agoudev: Add FTDI FT4232 VID/PID.
Uwe Hermann [Sat, 2 May 2020 14:20:32 +0000 (16:20 +0200)]
udev: Add FTDI FT4232 VID/PID.

3 years agoftdi-la: Add FT4232H PID:VID.
Sergey Rzhevsky [Sun, 12 Apr 2020 20:52:38 +0000 (23:52 +0300)]
ftdi-la: Add FT4232H PID:VID.

3 years agorigol-ds: Added support for the DS1202Z-E
Richard [Fri, 17 Apr 2020 13:30:13 +0000 (13:30 +0000)]
rigol-ds: Added support for the DS1202Z-E

3 years agohameg-hmo: use common helper to setup description of an analog value
Gerhard Sittig [Wed, 18 Mar 2020 14:54:29 +0000 (15:54 +0100)]
hameg-hmo: use common helper to setup description of an analog value

Replace an open coded sequence of assignments to an aggregate of several
related structures. Prefer the common sr_analog_init() routine instead.

3 years agouni-t-ut32x: drop redundant close and free at end of scan
Gerhard Sittig [Sat, 14 Dec 2019 08:27:15 +0000 (09:27 +0100)]
uni-t-ut32x: drop redundant close and free at end of scan

The UT32x driver requires a user spec for the connection. The device
cannot get identified, that's why successful open/close for the port
will suffice. Lack of an input spec as well as failure in the early
scan phase will terminate the scan routine early.

When we reach the end of the scan which creates the device instance
and registers it with the list of found devices, the port already
is closed and the list of devices will never be empty. Remove the
redundant close call and the dead branch which frees the serial port.

3 years agoscpi-dmm: fix glib variant ref count in SET MQ request
Gerhard Sittig [Mon, 16 Dec 2019 10:26:56 +0000 (11:26 +0100)]
scpi-dmm: fix glib variant ref count in SET MQ request

3 years agoFix compiler warnings related to -Wcast-function-type.
Uwe Hermann [Sat, 2 May 2020 14:11:42 +0000 (16:11 +0200)]
Fix compiler warnings related to -Wcast-function-type.

This fixes bug #1297.

3 years agosiglent-sds: Fix various compiler warnings.
Uwe Hermann [Sat, 2 May 2020 13:39:26 +0000 (15:39 +0200)]
siglent-sds: Fix various compiler warnings.

  src/hardware/siglent-sds/protocol.c: In function 'siglent_sds_get_digital':
  src/hardware/siglent-sds/protocol.c:382:35: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          if (data_low_channels->len <= samples_index) {
                                     ^
  src/hardware/siglent-sds/protocol.c:391:36: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          if (data_high_channels->len <= samples_index) {
                                      ^
  src/hardware/siglent-sds/protocol.c:417:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for (long index = 0; index < tmp_samplebuf->len; index++) {
                                  ^
  In file included from src/hardware/siglent-sds/protocol.c:37:0:
  src/hardware/siglent-sds/protocol.c: In function 'siglent_sds_receive':
  src/hardware/siglent-sds/protocol.h:28:20: warning: format '%li' expects argument of type 'long int', but argument 3 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
   #define LOG_PREFIX "siglent-sds"
                      ^
  ./src/libsigrok-internal.h:815:41: note: in expansion of macro 'LOG_PREFIX'
   #define sr_dbg(...) sr_log(SR_LOG_DBG,  LOG_PREFIX ": " __VA_ARGS__)
                                           ^
  src/hardware/siglent-sds/protocol.c:564:6: note: in expansion of macro 'sr_dbg'
        sr_dbg("Requesting: %li bytes.", devc->num_samples - devc->num_block_bytes);
        ^
  src/hardware/siglent-sds/protocol.c: In function 'siglent_sds_get_dev_cfg_horizontal':
  src/hardware/siglent-sds/protocol.h:28:20: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'uint64_t {aka long long unsigned int}' [-Wformat=]
   #define LOG_PREFIX "siglent-sds"
                      ^
  ./src/libsigrok-internal.h:815:41: note: in expansion of macro 'LOG_PREFIX'
   #define sr_dbg(...) sr_log(SR_LOG_DBG,  LOG_PREFIX ": " __VA_ARGS__)
                                           ^
  src/hardware/siglent-sds/protocol.c:933:2: note: in expansion of macro 'sr_dbg'
    sr_dbg("Current memory depth: %lu.", devc->memory_depth_analog);
    ^

4 years agobt/bt_bluez: Implement retry if rfcomm sockets are busy
Andreas Sandberg [Mon, 24 Feb 2020 22:46:35 +0000 (22:46 +0000)]
bt/bt_bluez: Implement retry if rfcomm sockets are busy

There are cases where the connect() call returns EBUSY when trying to
connect to a device. This has been observed when sampling an RDTech
UM24C. In this case, scanning the device works fine. However, when
sampling the device, Sigrok first scans the device, then closes the
connection and re-opens it to sample the device. If the close/open
calls happen in close successions, the Bluetooth stack sometimes
returns EBUSY.

Work around this issue by retrying if the connect() returns EBUSY.

Signed-off-by: Andreas Sandberg <redacted>
4 years agomodbus: Close device after scan
v1ne [Wed, 8 Apr 2020 15:05:16 +0000 (17:05 +0200)]
modbus: Close device after scan

Since the device should be closed after the scan, close it in sr_modbus_scan.
Alternatively, every single driver could close the device after calling
sr_modbus_scan. This causes duplicated code, is prone to forgetting it and it
wasn't the calling driver who opened the device in the first place.

This change unbreaks maynuo-m97 and rdtech-dps.

4 years agoscpi-pps: fixed out-of-bounds array access...
Florian Schmidt [Wed, 8 Apr 2020 10:24:48 +0000 (12:24 +0200)]
scpi-pps: fixed out-of-bounds array access...

when accessing devc->device->channels in config_list().
this array has to be accessed via the "hw_output_idx"

This fixes bug #1533.

4 years agocenter-3xx: Fix incorrect values due to endianness issue.
Uwe Hermann [Thu, 9 Apr 2020 21:51:16 +0000 (23:51 +0200)]
center-3xx: Fix incorrect values due to endianness issue.

Replace RL16S with RB16S, the values are big-endian.

This is related to the recently-fixed bug #1463.

4 years agoUse std_session_send_df_frame_begin()/_end() where possible.
Uwe Hermann [Wed, 8 Apr 2020 21:49:38 +0000 (23:49 +0200)]
Use std_session_send_df_frame_begin()/_end() where possible.

4 years agostd: Rename std_session_send_frame_begin/_end().
Uwe Hermann [Wed, 8 Apr 2020 21:35:44 +0000 (23:35 +0200)]
std: Rename std_session_send_frame_begin/_end().

4 years agoUse std_session_send_df_trigger() where possible.
Uwe Hermann [Wed, 8 Apr 2020 21:21:39 +0000 (23:21 +0200)]
Use std_session_send_df_trigger() where possible.

4 years agostd: Factor out send_df_without_payload() helper.
Uwe Hermann [Wed, 8 Apr 2020 21:11:15 +0000 (23:11 +0200)]
std: Factor out send_df_without_payload() helper.

4 years agostd: Add std_session_send_df_trigger().
Uwe Hermann [Wed, 8 Apr 2020 21:02:04 +0000 (23:02 +0200)]
std: Add std_session_send_df_trigger().

4 years agozeroplus-logic-cube: Fix an issue when changing triggers.
Uwe Hermann [Wed, 8 Apr 2020 20:46:23 +0000 (22:46 +0200)]
zeroplus-logic-cube: Fix an issue when changing triggers.

Changing triggers (e.g. from low to high) would sometimes cause the
acquisition to seemingly "hang" due to missing variable initializations
(in reality the device would wait for incorrect triggers and/or on
incorrect channels).

This fixes bug #1535.

4 years agozeroplus-logic-cube: Enable edge-triggering capabilities.
Jan Metzger [Fri, 14 Feb 2020 07:38:27 +0000 (08:38 +0100)]
zeroplus-logic-cube: Enable edge-triggering capabilities.

This fixes bug #1334.

4 years agokorad-kaxxxxp: Add support for RND KA3005P V5.5 power supply
Christian Fruth [Sun, 5 Apr 2020 09:26:35 +0000 (11:26 +0200)]
korad-kaxxxxp: Add support for RND KA3005P V5.5 power supply

4 years agokorad-kaxxxxp: Add support for TENMA 72-2540 V5.2 power supply
Peter van der Perk [Mon, 6 Apr 2020 12:14:06 +0000 (14:14 +0200)]
korad-kaxxxxp: Add support for TENMA 72-2540 V5.2 power supply

4 years agoudev: Add TIAO USB Multi Protocol Adapter (TUMPA) VID/PID.
Uwe Hermann [Mon, 6 Apr 2020 22:53:46 +0000 (00:53 +0200)]
udev: Add TIAO USB Multi Protocol Adapter (TUMPA) VID/PID.

4 years agoftdi-la: add TUMPA VID:PID and JTAG pin names
Tom Matthews [Mon, 30 Mar 2020 17:32:12 +0000 (18:32 +0100)]
ftdi-la: add TUMPA VID:PID and JTAG pin names

4 years agordtech-dps: Make it work in SmuView
v1ne [Fri, 3 Apr 2020 01:51:09 +0000 (03:51 +0200)]
rdtech-dps: Make it work in SmuView

Without the mutex, concurrent reception from the ModBus port leads to CRC
errors.

4 years agocenter-3xx: use common signed LE16 conversion for temperature value
Gerhard Sittig [Mon, 23 Dec 2019 16:00:13 +0000 (17:00 +0100)]
center-3xx: use common signed LE16 conversion for temperature value

Prefer the common conversion helper for little endian 16bit signed data.
The previous local implementation only worked for positive values, and
yielded incorrect results for negative temperatures.

This fixes bug #1463.

4 years agoserial-dmm/uni-t-dmm: Add UNI-T UT804 DMM definitions
Elen Eisendle [Sat, 8 Feb 2020 20:24:23 +0000 (21:24 +0100)]
serial-dmm/uni-t-dmm: Add UNI-T UT804 DMM definitions

4 years agoinput/trace32_ad: Fix pod_data uninitialised warning
Andreas Sandberg [Mon, 24 Feb 2020 23:03:25 +0000 (23:03 +0000)]
input/trace32_ad: Fix pod_data uninitialised warning

Signed-off-by: Andreas Sandberg <redacted>
4 years agogwinstek-gpd: Fix use of uninitialized variable
Andreas Sandberg [Wed, 25 Mar 2020 09:16:31 +0000 (09:16 +0000)]
gwinstek-gpd: Fix use of uninitialized variable

Signed-off-by: Andreas Sandberg <redacted>
4 years agobindings/cxx: Include missing header file
Juan M. Bello-Rivas [Mon, 30 Mar 2020 02:27:24 +0000 (19:27 -0700)]
bindings/cxx: Include missing header file

Including the `functional` header is necessary in order to use `std::function` in the definition of `LogCallbackFunction` when compiling with gcc 7.3.0.

4 years agobindings/ruby: Disable Ruby bindings until we have a fix for #1526.
Uwe Hermann [Sat, 4 Apr 2020 20:14:48 +0000 (22:14 +0200)]
bindings/ruby: Disable Ruby bindings until we have a fix for #1526.

The Ruby bindings currently don't build (at least with Ruby 2.7
and/or SWIG 4.x). Disable them as a temporary workaround until we
have a more permanent fix.

4 years agoconfigure.ac: Also check for "swig4.0".
Uwe Hermann [Sat, 4 Apr 2020 20:00:17 +0000 (22:00 +0200)]
configure.ac: Also check for "swig4.0".

4 years agobindings/java: Fix build issue with SWIG 4.x.
Uwe Hermann [Sat, 4 Apr 2020 19:54:13 +0000 (21:54 +0200)]
bindings/java: Fix build issue with SWIG 4.x.

Tested with SWIG 3.x and SWIG 4.x.

This fixes bug #1527.

4 years agoDoxygen: Fix various warnings.
Uwe Hermann [Wed, 25 Mar 2020 19:11:06 +0000 (20:11 +0100)]
Doxygen: Fix various warnings.

  src/resource.c:414: warning: unbalanced grouping commands

  conversion.c:81: warning: argument 'lo_thr' from the argument list of sr_a2l_schmitt_trigger has multiple @param documentation sections

  src/analog.c:611: warning: return value 'SR_ERR_ARG' of sr_rational_div has multiple documentation sections

  src/device.c:205: warning: explicit link request to 'TRUE' could not be resolved
  src/device.c:205: warning: explicit link request to 'FALSE' could not be resolved
  src/device.c:231: warning: explicit link request to 'TRUE' could not be resolved
  src/device.c:231: warning: explicit link request to 'FALSE' could not be resolved

  src/serial.c:246: warning: explicit link request to 'NULL' could not be resolved

  src/strutil.c:602: warning: explicit link request to 'NULL' could not be resolved

  src/device.c:94: warning: unable to resolve reference to 'sr_channel_free()' for \ref command

  src/strutil.c:597: warning: unable to resolve reference to 'sr_hexdump_free()' for \ref command
  src/strutil.c:622: warning: unable to resolve reference to 'sr_hexdump_new()' for \ref command

  src/device.c:430: warning: The following parameters of sr_dev_inst_channel_add(struct sr_dev_inst *sdi, int index, int type, const char *name) are not documented: parameter 'sdi'

  src/session.c:163: warning: The following parameters of fd_source_new(struct sr_session *session, void *key, gintptr fd, int events, int timeout_ms) are not documented: parameter 'events'

4 years agoDoxygen: Properly mark a few symbols as private.
Uwe Hermann [Tue, 24 Mar 2020 19:09:02 +0000 (20:09 +0100)]
Doxygen: Properly mark a few symbols as private.

(otherwise these end up in the API docs)

Remove all @internal markings, only use @private where needed.

4 years agobindings/python/Doxyfile: Set OPTIMIZE_OUTPUT_JAVA to NO.
Uwe Hermann [Tue, 24 Mar 2020 21:38:21 +0000 (22:38 +0100)]
bindings/python/Doxyfile: Set OPTIMIZE_OUTPUT_JAVA to NO.

4 years agoDoxyfile_internal: Fix various settings and paths.
Uwe Hermann [Tue, 24 Mar 2020 18:42:29 +0000 (19:42 +0100)]
Doxyfile_internal: Fix various settings and paths.

4 years agoDoxyfile: Predefine HAVE_SERIAL_COMM for serial docs.
Uwe Hermann [Wed, 25 Mar 2020 18:37:23 +0000 (19:37 +0100)]
Doxyfile: Predefine HAVE_SERIAL_COMM for serial docs.

Without this, src/serial.c API docs won't be generated.

4 years agoDoxyfile: Fix/update path and file references.
Uwe Hermann [Tue, 24 Mar 2020 18:31:26 +0000 (19:31 +0100)]
Doxyfile: Fix/update path and file references.

4 years agoDoxyfile: Bring back the workaround for bug #1422.
Uwe Hermann [Tue, 24 Mar 2020 19:17:31 +0000 (20:17 +0100)]
Doxyfile: Bring back the workaround for bug #1422.

4 years agoAll Doxyfile files: Update file template to doxygen 1.8.16.
Uwe Hermann [Sun, 22 Mar 2020 14:15:09 +0000 (15:15 +0100)]
All Doxyfile files: Update file template to doxygen 1.8.16.

This is done semi-automatically by running "doxygen -u Doxyfile".

4 years agoAll Doxyfile files: Set CREATE_SUBDIRS to NO.
Uwe Hermann [Sun, 22 Mar 2020 14:11:52 +0000 (15:11 +0100)]
All Doxyfile files: Set CREATE_SUBDIRS to NO.

4 years agomanson-hcs-3xxx: Support device IDs with and without "HCS-" prefix.
Uwe Hermann [Tue, 24 Mar 2020 20:07:08 +0000 (21:07 +0100)]
manson-hcs-3xxx: Support device IDs with and without "HCS-" prefix.

Since we've now seen lots of devices in the wild that come with the
"HCS-" prefix in the ID, it's probably safe to assume all of them
could have it.

This fixes bug #1530.

4 years agoasix-sigma: Drop duplicate error message prefixes.
Uwe Hermann [Tue, 24 Mar 2020 18:22:11 +0000 (19:22 +0100)]
asix-sigma: Drop duplicate error message prefixes.

The sr_err() call automatically adds a prefix to all messages, in
this specific case "asix-sigma: " will be added.

4 years agoasix-sigma: move DRAM line buffer allocation closer to its use
Daniel Trnka [Thu, 12 Mar 2020 11:08:35 +0000 (12:08 +0100)]
asix-sigma: move DRAM line buffer allocation closer to its use

Move the allocation of the DRAM line buffer in the sample download code
path closer to the location where that buffer is used and gets released.

4 years agoasix-sigma: check for successful register access in sample download
Daniel Trnka [Thu, 12 Mar 2020 11:08:35 +0000 (12:08 +0100)]
asix-sigma: check for successful register access in sample download

The previous implementation got stuck in an infinite loop when data
acquisition started, but the device got disconnected before the data
acquisition terminates. An implementation detail ignored communication
errors, and never saw the expected condition that was required to
continue in the sample download sequence. Unbreak that code path.

4 years agokorad-kaxxxxp: Fix max. possible current for all devices.
Uwe Hermann [Sun, 22 Mar 2020 15:58:54 +0000 (16:58 +0100)]
korad-kaxxxxp: Fix max. possible current for all devices.

Even though the devices/websites/manuals usually say 0..30V, the
hardware actually accepts up to 31V, both via serial as well as by
simply rotating the knob on the device (and our driver already
reflects that).

The same is true for current, it's usually 0..5A as per docs, but many
(probably all) devices accept 5.1A via serial and knob.

Thus, set the max current of all devices to 5.1A (or 3.1A for 3A
devices). We're assuming they all have this property, and we've seen
this in practice on at least three different versions of the device.

4 years agokorad-kaxxxxp: Add a new ID for KORAD KA3005P V4.2 power supply
David Sastre Medina [Sat, 21 Mar 2020 14:22:28 +0000 (15:22 +0100)]
korad-kaxxxxp: Add a new ID for KORAD KA3005P V4.2 power supply

On a recently acquired Korad KA3005P power supply, the ID supplied by the
device is not known by libsigrok.

$ sigrok-cli --driver=korad-kaxxxxp:conn=/dev/ttyACM0 --scan
sr: korad-kaxxxxp: Unknown model ID 'KORAD KA3005P V4.2' detected, aborting.

This fixes bug #1522.

Thanks to bitaround@gmail.com for the amperage fix.

4 years agorigol-ds: Rigol DS1152E-EDU support fix
jirjirjir [Fri, 17 Jan 2020 13:28:55 +0000 (16:28 +0300)]
rigol-ds: Rigol DS1152E-EDU support fix

4 years agoFix #1509 by providing alternate sample format scales
Soeren Apel [Fri, 28 Feb 2020 21:49:57 +0000 (22:49 +0100)]
Fix #1509 by providing alternate sample format scales

4 years agopython: Apply typemap for VariantBase to VariantContainerBase.
Martin Ling [Sun, 5 Jan 2020 18:25:13 +0000 (18:25 +0000)]
python: Apply typemap for VariantBase to VariantContainerBase.

Fixes #1480.

4 years agoagilent-dmm: Add Agilent U1237AX (completely untested).
Uwe Hermann [Fri, 27 Dec 2019 20:22:18 +0000 (21:22 +0100)]
agilent-dmm: Add Agilent U1237AX (completely untested).

4 years agoagilent-dmm: U127x: Fix mode switch event handling.
Uwe Hermann [Fri, 27 Dec 2019 19:59:04 +0000 (20:59 +0100)]
agilent-dmm: U127x: Fix mode switch event handling.

The DMMs report as an event to which mode the user switched (by turning the
rotary switch): "*0", "*1", etc.

Most other DMMs have few modes, but the U127x DMMs have up to 11 different
modes (i.e., "*10" is a valid event).

4 years agoMakefile.am: Add missing src/serial_hid.h.
Uwe Hermann [Tue, 24 Dec 2019 15:39:01 +0000 (16:39 +0100)]
Makefile.am: Add missing src/serial_hid.h.

4 years agosrc/serial_hid.h: Include guard consistency fix.
Uwe Hermann [Tue, 24 Dec 2019 15:38:56 +0000 (16:38 +0100)]
src/serial_hid.h: Include guard consistency fix.

4 years agoinput/csv: Set default "header" option value to true.
Uwe Hermann [Sun, 22 Dec 2019 22:50:22 +0000 (23:50 +0100)]
input/csv: Set default "header" option value to true.

This makes re-opening files that were saved via the libsigrok CSV
output module slightly more convenient.

4 years agooutput/csv: Set default "time" option value to false.
Uwe Hermann [Sun, 22 Dec 2019 22:49:08 +0000 (23:49 +0100)]
output/csv: Set default "time" option value to false.

4 years agomanson-hcs-3xxx: support new HCS-3200 / PPS-13610 model string.
Uwe Hermann [Sun, 22 Dec 2019 22:18:24 +0000 (23:18 +0100)]
manson-hcs-3xxx: support new HCS-3200 / PPS-13610 model string.

This fixes bug #1441.

4 years agomastech-ms6514: Add missing string.h #include.
Uwe Hermann [Sun, 22 Dec 2019 20:06:46 +0000 (21:06 +0100)]
mastech-ms6514: Add missing string.h #include.

4 years agoREADME.devices: Document MASTECH MS6514 interface enabling.
Uwe Hermann [Sun, 22 Dec 2019 14:52:46 +0000 (15:52 +0100)]
README.devices: Document MASTECH MS6514 interface enabling.

4 years agoconfigure.ac: mastech-ms6514: Add serial_comm flag.
Uwe Hermann [Sun, 22 Dec 2019 14:33:45 +0000 (15:33 +0100)]
configure.ac: mastech-ms6514: Add serial_comm flag.

4 years agoInitial support for MASTECH MS6514 thermometer
Dave Buechi [Sat, 17 Aug 2019 21:36:14 +0000 (23:36 +0200)]
Initial support for MASTECH MS6514 thermometer

4 years agoinput/csv: Consistently use a newline before the last return statement.
Uwe Hermann [Sun, 22 Dec 2019 13:42:34 +0000 (14:42 +0100)]
input/csv: Consistently use a newline before the last return statement.

4 years agoinput/csv: style nits, drop @brief and DIAG in debug output
Gerhard Sittig [Sun, 22 Dec 2019 13:11:15 +0000 (14:11 +0100)]
input/csv: style nits, drop @brief and DIAG in debug output

The @brief keyword is not needed since JAVADOC_AUTOBRIEF is enabled in the
Doxygen configuration. Remove a remaining "DIAG" prefix in a debug
message, the output already is filtered according to the log level, and
prefixed by the module name.

4 years agoinput/csv: re-calculate samplerate after file re-import
Gerhard Sittig [Sat, 19 Oct 2019 19:20:36 +0000 (21:20 +0200)]
input/csv: re-calculate samplerate after file re-import

Don't clobber the user provided samplerate (specified by input module
options). This allows to re-determine the samplerate from a potentially
changed file on disk upon reload.

4 years agoinput/csv: expand cleanup (resource release) and unbreak file reload
Gerhard Sittig [Sat, 19 Oct 2019 14:09:15 +0000 (16:09 +0200)]
input/csv: expand cleanup (resource release) and unbreak file reload

The list of previously created channels is kept across file reloads. We
also need to keep (or re-create) the list of channels that are used for
datafeed submission of analog data.

Release more allocated resources in the .cleanup() routine, and do reset
internal state such that a .reset() thus .cleanup() then .receive() call
sequence will work. This code path is taken for re-import of files (see
bug #1241, CSV was affected).

4 years agoinput/csv: improve reliabilty of text line isolation
Gerhard Sittig [Sat, 19 Oct 2019 09:47:45 +0000 (11:47 +0200)]
input/csv: improve reliabilty of text line isolation

Slightly unobfuscate the "end of current input chunk" marker in the data
processing loop. Make the variable's identifier reflect that it's not a
temporary, but instead something worth keeping around until needed again.

Unbreak the calculation of line numbers in those situations where input
chunks (including previously accumulated unprocessed data) happens to
start with a line termination. This covers input files which start with
empty lines, as well as environments with mutli-byte line termination
sequences (CR/LF) and arbitrary distribution of bytes across chunks.

This fixes bug #968.

Accept when there is no line termination in the current input chunk. We
cannot assume that calling applications always provide file content in
large enough chunks to span complete lines. And any arbitrary chunk size
which applications happen to use can get exceeded by input files (e.g.
for generated files with wide data or long comments).

4 years agoinput/csv: update developer comments and TODO list
Gerhard Sittig [Fri, 18 Oct 2019 23:14:29 +0000 (01:14 +0200)]
input/csv: update developer comments and TODO list

Mention the required synchronization of default option values and format
match logic in a prominent location where options are discussed.

Update the TODO list for the CSV input module. Mixed signal handling got
fixed by rearranging channel creation. Samplerate can get determined
from timestamp columns already. The double data type for analog data
remains.

4 years agoinput/csv: move channel creation to after format parsing
Gerhard Sittig [Fri, 18 Oct 2019 23:07:28 +0000 (01:07 +0200)]
input/csv: move channel creation to after format parsing

The previous implementation incompletely handled arbitrary data type
oders in mixed signal input files. Rearrange the logic such that all
format specs get parsed first, then all channel creation details get
determined, then all channels get created. It appears to be essential
that all logic channels get created first, resulting in index numbers
starting at 0 and addressing the correct position in bitfields. The
analog channels get created after all logic channels exist. Adjacent
number ranges for channel types also results in more readable logic in
other locations.

This was tested with -I csv:column_formats=t,2a,l,a,x4,a,-,b3 example
data, and works as expected.

4 years agoinput/csv: add automatic format match support
Gerhard Sittig [Fri, 18 Oct 2019 20:26:22 +0000 (22:26 +0200)]
input/csv: add automatic format match support

Implement .format_match() support in the CSV input module. Simple
multi-column files will automatically load without an "-I csv" spec.
Non-default option values still do require the module selection before
options can get passed to the module.

4 years agoinput/csv: another stab at option help texts
Gerhard Sittig [Fri, 18 Oct 2019 05:48:41 +0000 (07:48 +0200)]
input/csv: another stab at option help texts

Try to balance a compact format and completeness/accuracy of content for
builtin help texts for the CSV input module's options. Assume a technical
audience (this is signal analysis software after all).

Rename a few internal identifiers which help organize the list of options
and their help texts. Too short names became obscure.

4 years agoinput/csv: add support for timestamp columns, auto detect samplerate
Gerhard Sittig [Thu, 17 Oct 2019 23:11:26 +0000 (01:11 +0200)]
input/csv: add support for timestamp columns, auto detect samplerate

Accept 't' format specs for timestamp columns. Automatically derive the
samplerate from input data when timestamps are available and the user
did not provide a rate. Stick with a simple approach for robustness
since automatic detection is easy to override when it fails. This
feature is mostly about convenience.

4 years agoinput/csv: robustness nits in column format dispatching
Gerhard Sittig [Thu, 17 Oct 2019 21:54:02 +0000 (23:54 +0200)]
input/csv: robustness nits in column format dispatching

The previous implementation open coded type checks by comparing an enum
value against specific constants. Which was especially ugly since there
are multiple types which all are logic, and future column types neither
get ignored nor have channels associated with them.

Improve readability and robustness by adding helpers which check classes
(ignore, logic, analog) instead of the multitude of -/x/o/b|l/a variants
within the classes.

Also comment on the order of channel creation, and how to improve it.

4 years agoinput/csv: update comments/helptext for analog input data
Gerhard Sittig [Thu, 17 Oct 2019 20:14:04 +0000 (22:14 +0200)]
input/csv: update comments/helptext for analog input data

Expand the developer comment that's inline in the source file. There is
enough room to explain things. Try to come up with a "one-line" help text
that is precise yet compact, and does inform the user of available format
choices including modifiers. Chances are that longer descriptions start
reducing the usefulness of the help or the visibility of options when
users are in a hurry. Those who care can access the manual.

Mark more options as obsolete, and mention more default values in the
builtin help text. Also tweak a comment on getting channel names from
header lines.

4 years agoinput/csv: work around undesired logic/analog group "bleeding"
Gerhard Sittig [Thu, 17 Oct 2019 19:52:50 +0000 (21:52 +0200)]
input/csv: work around undesired logic/analog group "bleeding"

Support for mixed signal CSV input data is desirable and should be
possible. The current implementation just happens to not fully cope with
arbitrary mixes of data types in columns yet. Add a quick workaround,
but also a TODO item to properly address the topic later.

4 years agoinput/csv: accept user provided analog resolution in column formats
Gerhard Sittig [Thu, 17 Oct 2019 18:53:41 +0000 (20:53 +0200)]
input/csv: accept user provided analog resolution in column formats

Stick with the (arbitrary) default of 3 digits for analog data. Accept
user specified digit counts in the column_formats= option, like "a4".

4 years agoinput/csv: add support for analog input data
Gerhard Sittig [Wed, 16 Oct 2019 22:20:56 +0000 (00:20 +0200)]
input/csv: add support for analog input data

Extend the CSV input module which was strictly limited to logic data so
far. Add support for analog data types. Implement the 'a' column format,
and feed analog data to the session bus.

This implementation feeds data of individual analog channels to the
session bus in separate packets each. This approach was found to work
most reliably, not all recipients support the submission of multiple
samples for multiple channels in a single packet.

A fixed 'digits' value is used. This needs to get addressed later.

Local experiments suggest that the 'double' data type for analog data
can result in erroneous visual presentation (observed with sigrok-cli).
Use 'float' for now, until the issue is understood and got fixed.
Support for double is prepared internally and is easily enabled.

4 years agoinput/csv: address unassorted nits
Gerhard Sittig [Wed, 16 Oct 2019 20:19:24 +0000 (22:19 +0200)]
input/csv: address unassorted nits

Address several minor nits. Eliminate unneeded variables. Update text to
number conversion comments including wildcard handling. Remove empty
lines in init() which used to spill out a set of lines which all do the
same thing (evaluate a set of options) and shall belong together.

4 years agoinput/csv: move channel creation to column processing details creation
Gerhard Sittig [Wed, 16 Oct 2019 20:16:24 +0000 (22:16 +0200)]
input/csv: move channel creation to column processing details creation

Move the creation of logic channels to the location where formats fields
get iterated, and column processing details get derived. This reduces a
lot of redundancy, and simplifies the addition of more data formats.

4 years agoinput/csv: update TODO comments
Gerhard Sittig [Wed, 16 Oct 2019 18:50:03 +0000 (20:50 +0200)]
input/csv: update TODO comments

Update the list of TODO items at the top of the CSV input module's
source. Text line handling (counting line numbers) got fixed. Adding
support for analog channels was prepared, as are timestamp columns.

4 years agoinput/csv: rework user accessible options for consistency
Gerhard Sittig [Wed, 16 Oct 2019 18:40:36 +0000 (20:40 +0200)]
input/csv: rework user accessible options for consistency

Rename the CSV input module's option keywords. To better reflect their
purpose, and for consistency across the rather complex set of options
and how they interact. Rearrange the list of options (not that the order
matters from the outside, but it's good to have during maintenance).

Update builtin help texts which will show up in applications, as well as
the source code comments which discuss these options in greater detail.
Would be nice to have a "general" help text for input modules which is
not tied to one single option, to provide an overview or use examples.
Arrange the option keys, short and long help texts such that the source
better reflects the applications' screen layout. To better support
future maintenance, again.

Consistently separate multi-work keywords for improved readability.
Prefer underscores over dashes for consistency with common keys in
shared infrastructure in other project sources (device options, MQ
items, etc).

4 years agoinput/csv: extend column-formats support for backwards compatibility
Gerhard Sittig [Wed, 16 Oct 2019 15:57:46 +0000 (17:57 +0200)]
input/csv: extend column-formats support for backwards compatibility

Extend the "column-formats" option support in the CSV input module to
also support wildcards and automatic channel count detection. Move the
format string interpretation to the location where the first data line
or the optional header line are seen. Map the simple options (single
column number and channel count, or first column number and optional
channel count) to a format string, to unify internal code paths. Remove
code paths for the previous specific yet limited scenarios.

Rephrase the condition which keeps executing the "initial receive"
phase. The text line termination sequence gets derived from the first
complete text line, but other essential information is only gathered
later, potentially after skipping a large (user specified) amount of
input data. Keep checking for this essential setup data until data or
the header actually were seen, before regular processing of input data
starts.

4 years agoinput/csv: introduce column-formats option (flexible logic import)
Gerhard Sittig [Tue, 15 Oct 2019 21:39:59 +0000 (23:39 +0200)]
input/csv: introduce column-formats option (flexible logic import)

Extend the CSV input module, introduce support for the "column-formats="
option. This syntax can express the previous single- and multi-column
semantics, as well as any arbitrary order of to-get-ignored, and single-
and multi-bit columns in several formats.

The previous "simple" keywords for single and multi column modes still
are in place, it's yet to get determined whether to axe them. Depends on
whether users can handle the format strings for these simple cases.

4 years agoinput/csv: fixup input file line number handling
Gerhard Sittig [Tue, 15 Oct 2019 19:43:55 +0000 (21:43 +0200)]
input/csv: fixup input file line number handling

The previous implementation allowed CSV input files to use any line
termination in either CR only, LF only, or CR/LF format. The first EOL
was searched for and was recorded, but then was not used. Instead any of
CR or LF were considered a line termination. "Raw data processing" still
was correct, but line numbers in diagnostics were way off, and optional
features like skipping first N lines were not effective. Fix that.

Source code inspection suggests the "startline" feature did not work at
all. The user provided number was used in the initial optional search
for the header line (to get signal names) or auto-determination of the
number of columns. But then was not used when the file actually got
processed.

4 years agoinput/csv: unassorted adjustment, mostly "column processing" related
Gerhard Sittig [Tue, 15 Oct 2019 19:11:28 +0000 (21:11 +0200)]
input/csv: unassorted adjustment, mostly "column processing" related

Reduce "state" in the CSV input module's context. Stick with variables
that are local to routines when knowledge of details need not be global.
Really base the processing of a column's input text on the column's
processing information which was gathered in the setup phase.

Rename few identifiers, to explicitly refer to logic channels (the only
currently supported data type of the CSV input module). Cease feeding
logic data to the session bus when there are no logic channels at all
(currently not really an option). Prepare for simpler dispatching of
parse routines should more data types get added in a future version.

Reduce some "clutter" (overly fragmented stuff that should go together
since it forms logical groups and is not really standalone). Address a
few more minor style nits (sizeof() redundancy, "seemingly inverse"
string comparison phrases).

4 years agoinput/csv: improve "channel name from header line" logic
Gerhard Sittig [Tue, 15 Oct 2019 16:27:34 +0000 (18:27 +0200)]
input/csv: improve "channel name from header line" logic

Improve the code paths which determine logic channels' names from an
optional CSV file header line. Strip optional quotes from the column's
input text (re-use a SCPI helper routine for that). Also use the channel
name for multi-bit fields, append [0] etc suffixes in that case. Comment
on the manipulation of input data, which is acceptable since that very
data won't get processed another time in another code path.

4 years agoinput/csv: introduce generic "column processing" support
Gerhard Sittig [Mon, 14 Oct 2019 21:43:11 +0000 (23:43 +0200)]
input/csv: introduce generic "column processing" support

Rephrase the CSV input module's implementation such that generic support
to "process a column" becomes available. All columns of an input file's
text line get inspected, a column can either get ignored, or converted
to logic data. A future version can then remove the current limitations
of single- and multi-column modes (either one single multi-bit cell, or
multiple single-bit cells which must be adjacent).

Combine the bin/oct/hex parse routines into one routine which handles up
to four bits per input number digit with common logic. Availability of
more data than channels (according to user specs) is not fatal.

Drop the counter intuitive "first-channel" option, use "first-column"
instead. Warn when comment leader and column separator are identical
(was silent before, may be unexpected). Extend diagnostics and address
minor readability nits, update comments. Rephrase logic channel name
assignment.

Use simple scalar options to derive generic processing details: Either
'single-column' and 'numchannels' are required, with an optional
'format' spec (resulting in single-column mode). Or 'first-column' with
an optional 'numchannels' (multi-column mode with fixed format, using
all available columns by default). The default is multi-column mode with
one logic channel per column and spanning all columns on a text line.

4 years agoinput/csv: improve robustness of "use header for channel names"
Gerhard Sittig [Mon, 14 Oct 2019 17:33:29 +0000 (19:33 +0200)]
input/csv: improve robustness of "use header for channel names"

Don't clobber the value of the user provided 'header' option. Use a
separate flag to track whether the header line was seen before, or
needs to get skipped when it passes by.

4 years agoinput/csv: move samplerate meta packet to logic data feed submission
Gerhard Sittig [Sun, 13 Oct 2019 15:51:35 +0000 (17:51 +0200)]
input/csv: move samplerate meta packet to logic data feed submission

Move the communication of the samplerate meta packet to the very spot
where logic sample data gets sent. This allows to optionally determine
late the samplerate, potentially from input data instead of user specs.

4 years agoinput/csv: rearrange text to logic data conversion and datafeed
Gerhard Sittig [Sun, 13 Oct 2019 15:33:53 +0000 (17:33 +0200)]
input/csv: rearrange text to logic data conversion and datafeed

Move the helper routines which arrange for the data feed to an earlier
spot, so that references resolve without forward declarations. Rename
routines to reflect that they deal with logic data.

Slightly unobfuscate column text to logic data conversion, and reduce
redundancy. Move sample data preset to a central location.

Rephrase error messages, provide stronger hints as to why the input text
for a conversion was considered invalid.

4 years agoinput/csv: stricter input data test for multi column mode
Gerhard Sittig [Sun, 13 Oct 2019 15:20:16 +0000 (17:20 +0200)]
input/csv: stricter input data test for multi column mode

The previous implementation assumed that in multi-column mode each cell
communicates exactly one bit of input (a logic channel). But only the
first character got tested. Tighten the check, to cover the whole input
text. This rejects fully invalid input, as well as increases robustness
since multi-bit input like "100" was mistaken as a value of 1 before.

4 years agoinput/csv: slightly shuffle text routines, add bin/hex/oct doc
Gerhard Sittig [Sun, 13 Oct 2019 15:14:49 +0000 (17:14 +0200)]
input/csv: slightly shuffle text routines, add bin/hex/oct doc

Add documentation to the bin/hex/oct text parse routines, and move the
bin/hex/oct dispatcher to the location where its invoked routines are.
Stick with a TODO comment for parse_line() to reduce the diff size.

4 years agoinput/csv: unobfuscate text line to column splitting
Gerhard Sittig [Sun, 13 Oct 2019 14:39:51 +0000 (16:39 +0200)]
input/csv: unobfuscate text line to column splitting

The parse_line() routine is rather complex, optionally accepts an upper
limit for the number of columns, but unconditionally assumes a first one
and drops preceeding fields. The rather generic n and k identifiers are
not helpful.

Use the 'seen' and 'taken' names instead which better reflect what's
actually happening. Remove empty lines which used to tear apart groups
of instructions which are strictly related. This organization neither
was helpful during maintenance.

4 years agoinput/csv: trim whitespace after eliminating comments
Gerhard Sittig [Sun, 13 Oct 2019 14:28:39 +0000 (16:28 +0200)]
input/csv: trim whitespace after eliminating comments

Accept when comments are indented, trim the whitespace from text lines
after stripping off the comment. This avoids the processing of lines
which actually are empty, and improves robustness (avoids errors for a
non-fatal situation). Also results in more appropriate diagnostics at
higher log levels.