]> sigrok.org Git - libsigrok.git/log
libsigrok.git
6 years agodemo: Retain the default of 8 digital channels for now.
Uwe Hermann [Sun, 21 May 2017 16:35:21 +0000 (18:35 +0200)]
demo: Retain the default of 8 digital channels for now.

6 years agodemo: support up to 128 logic channels, enable the lower 8 by default
Gerhard Sittig [Fri, 5 May 2017 21:20:43 +0000 (23:20 +0200)]
demo: support up to 128 logic channels, enable the lower 8 by default

Bump the number of supported logic channels from 8 to 128. This is
mostly motivated to test the 64 channels limit which some of the
components/subprojects of the sigrok project might have (input/output
modules, user interfaces).

Only automatically enable the first 8 of the 128 total logic channels,
i.e. default to the previous behaviour. Prepare to only enable part of
the set of analog channels, but stick with their being active by default
as well.

Factor out the choice for the default logic pattern, too. This allows
for easier adjustment of the default configuration, when settings are
concentrated in a single spot.

6 years agodemo: add "cable squid" logic waveform (works-with logo, many channels)
Gerhard Sittig [Fri, 5 May 2017 20:35:38 +0000 (22:35 +0200)]
demo: add "cable squid" logic waveform (works-with logo, many channels)

Extend the demo driver, add another waveform choice for logic channels.
Create a "cable squid" logo representation which occupies a large number
of channels.

This pattern occupies 128x128 pixels. Unlike the 'sigrok' pattern it
gets repeated when more channels are involved, but is not shifted in the
repetition.

6 years agout71x: Fix float printing issue in a debug message.
Uwe Hermann [Sun, 21 May 2017 14:34:41 +0000 (16:34 +0200)]
ut71x: Fix float printing issue in a debug message.

Old:
ut71x: Applying exponent -12, new value is 0.000000.
P1: 1.500 nF AUTO
P1: 1.500 nF AUTO

New:
ut71x: Applying exponent -12, new value is 1.5e-09.
P1: 1.500 nF AUTO
P1: 1.500 nF AUTO

This fixes bug #700.

6 years agoVirtual session: Workaround for SR_CONF_CAPTUREFILE (#944)
Soeren Apel [Sun, 21 May 2017 15:10:38 +0000 (17:10 +0200)]
Virtual session: Workaround for SR_CONF_CAPTUREFILE (#944)

This is a (hopefully temporary) workaround for the
SR_CONF_CAPTUREFILE mechanism. The value for
vdev->capturefile is set by this, however only once
via stream_session_data().
During stream processing in stream_session_data(),
capturefile may receive new values - e.g. when there
are multiple logic files or if there is analog data.
With that, the initially set capturefile is overwritten.

When re-loading the file, we are then running into
issues because we don't know what the initial value was.
As all .sr files use "logic-1" by default and, we
simulate the behavior of stream_session_data() and
assign this name to capturefile if there are logic
channels present.

With this change, all three kinds of files reload
as expected: logic only, analog only and mixed signal.
For this reason, it's a short-term fix for #944.

6 years agoVirtual session: rename num_channels to num_logic_channels
Soeren Apel [Sun, 21 May 2017 07:20:42 +0000 (09:20 +0200)]
Virtual session: rename num_channels to num_logic_channels

6 years agohantek-6xxx: Only list DC coupling once.
Uwe Hermann [Tue, 16 May 2017 23:07:56 +0000 (01:07 +0200)]
hantek-6xxx: Only list DC coupling once.

Avoid incorrect indexing and the follow-up segfault.

This fixes bug #822.

6 years agorigol-ds: Handle digital channels correctly for MSO2000A series.
Martin Ling [Tue, 16 May 2017 23:04:07 +0000 (00:04 +0100)]
rigol-ds: Handle digital channels correctly for MSO2000A series.

The handling of the digital channels for this series is somewhere
between that of the DS1000D series (PROTOCOL_V2) and the MSO1000Z
(PROTOCOL_V4).

The :LA command set is similar to that of V4, but the LA data has to be
requested with :WAV:SOUR:LA and arrives in interleaved form like V2.

None of these changes should affect other models. They only affect the
case of PROTOCOL_V3 with digital channels, which occurs only for the
MSO2000A series.

6 years agohantek-6xxx: Fix coupling selection.
Uwe Hermann [Tue, 16 May 2017 20:23:24 +0000 (22:23 +0200)]
hantek-6xxx: Fix coupling selection.

Due to an uninitialized variable, switching to/from AC/DC coupling
(on models that support this) was not working.

This fixes bug #836.

6 years agorigol-ds: Add model entries for MSO2000A series.
Martin Ling [Mon, 15 May 2017 15:16:00 +0000 (16:16 +0100)]
rigol-ds: Add model entries for MSO2000A series.

This should be sufficient to fully support these models, unless there
are protocol differences for the digital channels.

This fixes bug #778.

6 years agooutput/csv: get proper index for input channels
Wolfram Sang [Thu, 11 May 2017 11:51:10 +0000 (13:51 +0200)]
output/csv: get proper index for input channels

'j' is the loop variable for channels, not 'ch'.

This fixes parts of bug #844.

Signed-off-by: Wolfram Sang <redacted>
6 years agooutput/csv: fix a minor leak
Wolfram Sang [Thu, 11 May 2017 11:51:09 +0000 (13:51 +0200)]
output/csv: fix a minor leak

Signed-off-by: Wolfram Sang <redacted>
6 years agooutput/csv: fix segfault with logic channels
Wolfram Sang [Thu, 11 May 2017 11:51:08 +0000 (13:51 +0200)]
output/csv: fix segfault with logic channels

'i' was iterating in steps of unitsize. However, the destination array
was also indexed with it, but it is of u8 type. Let 'i' run bytewise and
only multiply with unitsize when we need it.

This fixes parts of bug #844.

Signed-off-by: Wolfram Sang <redacted>
6 years agooutput/csv: fix segfault when naming logic channels
Wolfram Sang [Thu, 11 May 2017 11:51:07 +0000 (13:51 +0200)]
output/csv: fix segfault when naming logic channels

'j' is the loop variable for channels, not 'i'.

This fixes parts of bug #844.

Reported-by: Maxim Sloyko <redacted>
Signed-off-by: Wolfram Sang <redacted>
6 years agooutput/csv: Fix a compiler warning.
Uwe Hermann [Sat, 18 Mar 2017 19:55:20 +0000 (20:55 +0100)]
output/csv: Fix a compiler warning.

src/output/csv.c: In function 'dump_saved_values':
src/output/csv.c:461:6: warning: format '%lu' expects argument of
type 'long unsigned int', but argument 3 has type 'uint64_t' [-Wformat=]
      ctx->sample_time, ctx->value);
      ^

6 years agorigol-ds: Send *OPC? after commands that don't return a value.
Martin Ling [Tue, 9 May 2017 23:33:58 +0000 (00:33 +0100)]
rigol-ds: Send *OPC? after commands that don't return a value.

Fixes #933.

We'd already had this problem elsewhere and thus have this wrapper function
that does this where necessary. It just wasn't in use on these two call sites,
which was causing timing problems when used over tcp-raw or VXI transports.

6 years agohameg-hmo: Add support for Hameg HMO3524
Johannes Römer [Sun, 7 May 2017 15:21:47 +0000 (17:21 +0200)]
hameg-hmo: Add support for Hameg HMO3524

6 years agooutput/vcd: minor nit, remove unused variable
Gerhard Sittig [Sun, 16 Apr 2017 14:47:03 +0000 (16:47 +0200)]
output/vcd: minor nit, remove unused variable

6 years agominor nit, fixup whitespace in libsigrok.h
Gerhard Sittig [Sun, 16 Apr 2017 15:17:27 +0000 (17:17 +0200)]
minor nit, fixup whitespace in libsigrok.h

6 years agoDe-init vdev->capturefile when done
Soeren Apel [Thu, 4 May 2017 16:40:39 +0000 (18:40 +0200)]
De-init vdev->capturefile when done

Without doing this, re-reading the input file
results in a segfault as the internal state
machine becomes confused.

6 years agoopenbench-logic-sniffer: fix acquisition restart with trigger enabled
Gwenhael Goavec-Merou [Sun, 30 Apr 2017 13:57:40 +0000 (15:57 +0200)]
openbench-logic-sniffer: fix acquisition restart with trigger enabled

With trigger enabled, and with PulseView, a second (or more) acquisition
starts immediately instead of blocking. It's mandatory to try several times
to have a correct behavior.

According to http://mygizmos.org/ols/Logic-Sniffer-FPGA-Spec.pdf section 2.3.1
p.8, the Openbench Logic Sniffer must be reset before each arm command.

This fixes bug #809.

Signed-off-by: Gwenhael Goavec-Merou <redacted>
6 years agoopenbench-logic-sniffer: add a function to handle reset command
Gwenhael Goavec-Merou [Sun, 30 Apr 2017 13:57:39 +0000 (15:57 +0200)]
openbench-logic-sniffer: add a function to handle reset command

Openbench Logic Sniffer reset is a little more complex than a simple send.
To avoid code duplication, this patch adds a new function dedicated to
this task.

Signed-off-by: Gwenhael Goavec-Merou <redacted>
7 years agoREADME: Fix incorrect gcc/clang minimum versions.
Uwe Hermann [Fri, 31 Mar 2017 17:47:18 +0000 (19:47 +0200)]
README: Fix incorrect gcc/clang minimum versions.

https://gcc.gnu.org/projects/cxx-status.html#cxx11
https://clang.llvm.org/cxx_status.html

7 years agoscpi-pps: Add initial support for R&S HMC8043
Marc Schink [Wed, 29 Mar 2017 16:33:36 +0000 (18:33 +0200)]
scpi-pps: Add initial support for R&S HMC8043

7 years agocontrib/z60_libsigrok.rules: Use 660 permissions.
Uwe Hermann [Mon, 27 Mar 2017 06:55:17 +0000 (08:55 +0200)]
contrib/z60_libsigrok.rules: Use 660 permissions.

It doesn't really make sense to allow anyone to read (but not write)
USB devices.

This fixes parts of bug #665.

7 years agocontrib/udev: add note on required name for systemd
Karl Palsson [Wed, 1 Mar 2017 21:11:57 +0000 (21:11 +0000)]
contrib/udev: add note on required name for systemd

Systemd needs the file to be numbered the right way, document this
properly.

See also:
https://lists.debian.org/debian-devel-announce/2016/11/msg00008.html
http://openocd.zylin.com/2804

This fixes parts of bug #665.

Signed-off-by: Karl Palsson <redacted>
7 years agocontrib/udev: add TAG+="uaccess" for systemd
Karl Palsson [Wed, 1 Mar 2017 21:09:35 +0000 (21:09 +0000)]
contrib/udev: add TAG+="uaccess" for systemd

Instead of replacing the group=plugdev, simply add the TAG as well.
This allows (in most cases) the same file to be used happily on systemd
and older group based systems. Some systems may produce warnings about
non-existant groups, but it remains functional. Approach inspired by
that taken by the OpenOCD project.

This fixes parts of bug #665.

Signed-off-by: Karl Palsson <redacted>
7 years agouni-t-ut32x: Accept SR_CONF_CONN, fixing scan.
Bert Vermeulen [Tue, 21 Mar 2017 19:45:46 +0000 (20:45 +0100)]
uni-t-ut32x: Accept SR_CONF_CONN, fixing scan.

7 years agosession_driver.c: Increase chunk size for slightly better performance.
Uwe Hermann [Thu, 16 Mar 2017 22:59:58 +0000 (23:59 +0100)]
session_driver.c: Increase chunk size for slightly better performance.

Increasing the chunk size from 512ksamples to 4Msamples leads to
slightly faster session file loading from sigrok session (*.sr) files
in frontends, while not looking too "chunky".

The performance increase is not really massive, but still noticeable.
A further increase to, say, 10 or 100Msamples shows no further
noticeable improvements.

7 years agofx2lafw: Only sample/send analog data if analog channels are enabled.
Uwe Hermann [Wed, 15 Mar 2017 01:31:09 +0000 (02:31 +0100)]
fx2lafw: Only sample/send analog data if analog channels are enabled.

7 years agofx2lafw: Drop unused devc->ch_enabled.
Uwe Hermann [Wed, 15 Mar 2017 00:45:27 +0000 (01:45 +0100)]
fx2lafw: Drop unused devc->ch_enabled.

7 years agofx2lafw: Use wide_sampling only if necessary.
Jan Losinski [Thu, 12 Jan 2017 03:45:08 +0000 (04:45 +0100)]
fx2lafw: Use wide_sampling only if necessary.

This changes the fx2lafw code to only enable the wide_sampling (16bit)
method, if at least one of the higher eight channels is enabled. This
has the benefit, that we can use higher samplerates on 16bit LA
devices if we use only the first eight channels.

The wide sampling is also enabled if we have one or more analog
channels.

Signed-off-by: Jan Losinski <redacted>
7 years agoSCPI: add sr_scpi_write_data()
Sven Schnelle [Mon, 13 Feb 2017 17:48:52 +0000 (18:48 +0100)]
SCPI: add sr_scpi_write_data()

Can be used to send raw data on a SCPI connection.

Signed-off-by: Sven Schnelle <redacted>
7 years agoFix obsolete code comments.
Uwe Hermann [Fri, 10 Mar 2017 06:37:05 +0000 (07:37 +0100)]
Fix obsolete code comments.

"Probe groups" are called "channel groups" now.

7 years agosr_scpi_free(): Allow NULL as argument.
Uwe Hermann [Wed, 8 Mar 2017 18:47:54 +0000 (19:47 +0100)]
sr_scpi_free(): Allow NULL as argument.

7 years agosr_scpi_hw_info_free(): Allow NULL as argument.
Uwe Hermann [Wed, 8 Mar 2017 18:45:23 +0000 (19:45 +0100)]
sr_scpi_hw_info_free(): Allow NULL as argument.

7 years agosr_usbtmc_dev_inst_free(): Allow NULL as argument.
Uwe Hermann [Wed, 8 Mar 2017 18:33:18 +0000 (19:33 +0100)]
sr_usbtmc_dev_inst_free(): Allow NULL as argument.

7 years agosr_usb_dev_inst_new(): Allow NULL as argument.
Uwe Hermann [Wed, 8 Mar 2017 18:31:22 +0000 (19:31 +0100)]
sr_usb_dev_inst_new(): Allow NULL as argument.

(documentation fix, the function always handled NULL fine)

7 years agosr_serial_dev_inst_free(): Allow NULL as argument.
Uwe Hermann [Wed, 8 Mar 2017 18:27:25 +0000 (19:27 +0100)]
sr_serial_dev_inst_free(): Allow NULL as argument.

7 years agosr_dev_inst_free(): Allow NULL as argument.
Uwe Hermann [Wed, 8 Mar 2017 18:18:17 +0000 (19:18 +0100)]
sr_dev_inst_free(): Allow NULL as argument.

7 years agoscope drivers: More consistent config key ordering.
Uwe Hermann [Tue, 7 Mar 2017 21:39:47 +0000 (22:39 +0100)]
scope drivers: More consistent config key ordering.

7 years agorigol-ds: Fix capabilities listing in config_list()
Soeren Apel [Sun, 26 Feb 2017 20:07:46 +0000 (21:07 +0100)]
rigol-ds: Fix capabilities listing in config_list()

7 years agolecroy-xstream: Fix capabilities listing in config_list()
Soeren Apel [Sun, 26 Feb 2017 20:01:26 +0000 (21:01 +0100)]
lecroy-xstream: Fix capabilities listing in config_list()

This fixes bug #913.

7 years agoFix sr_period_string() Doxygen comments.
Uwe Hermann [Wed, 8 Mar 2017 00:10:19 +0000 (01:10 +0100)]
Fix sr_period_string() Doxygen comments.

7 years agoRework sr_period_string
Soeren Apel [Sat, 25 Feb 2017 21:19:42 +0000 (22:19 +0100)]
Rework sr_period_string

7 years agopce-322a: Adding support for reading memory from PCE-322A SPL
Matthieu Guillaumin [Sat, 3 Dec 2016 19:33:32 +0000 (20:33 +0100)]
pce-322a: Adding support for reading memory from PCE-322A SPL

7 years agoconfigure summary: Show linker flags.
Uwe Hermann [Sun, 5 Mar 2017 15:38:48 +0000 (16:38 +0100)]
configure summary: Show linker flags.

7 years agoconfigure summary: Show whether shared/static build is enabled.
Uwe Hermann [Sat, 4 Mar 2017 17:20:38 +0000 (18:20 +0100)]
configure summary: Show whether shared/static build is enabled.

7 years agolecroy-xstream: Drop some unneeded "lecroy_" prefixes.
Uwe Hermann [Thu, 2 Mar 2017 19:30:23 +0000 (20:30 +0100)]
lecroy-xstream: Drop some unneeded "lecroy_" prefixes.

For the time being this driver only handles LeCroy devices, so those
prefixes are not needed.

7 years agolecroy-xstream: Drop prototypes for non-existing functions.
Uwe Hermann [Thu, 2 Mar 2017 19:20:19 +0000 (20:20 +0100)]
lecroy-xstream: Drop prototypes for non-existing functions.

7 years agolecroy-xstream: Minor whitespace and consistency fixes.
Uwe Hermann [Thu, 2 Mar 2017 19:05:52 +0000 (20:05 +0100)]
lecroy-xstream: Minor whitespace and consistency fixes.

7 years agolecroy-xstream: Use sr_period_string()
Soeren Apel [Sat, 25 Feb 2017 17:41:47 +0000 (18:41 +0100)]
lecroy-xstream: Use sr_period_string()

7 years agolecroy-xstream: Fix compiler warnings
Soeren Apel [Sat, 25 Feb 2017 16:49:19 +0000 (17:49 +0100)]
lecroy-xstream: Fix compiler warnings

7 years agolecroy-xstream: Don't send custom SCPI command to the probed device
Soeren Apel [Sat, 25 Feb 2017 16:46:00 +0000 (17:46 +0100)]
lecroy-xstream: Don't send custom SCPI command to the probed device

7 years agolecroy-xstream: Change human-readable name
Soeren Apel [Mon, 27 Feb 2017 09:44:33 +0000 (10:44 +0100)]
lecroy-xstream: Change human-readable name

7 years agolecroy-xstream: Add the actual driver implementation
Sven Schnelle [Sun, 12 Feb 2017 19:18:16 +0000 (20:18 +0100)]
lecroy-xstream: Add the actual driver implementation

Signed-off-by: Sven Schnelle <redacted>
7 years agolecroy-xstream: Initial driver skeleton.
Sven Schnelle [Sun, 12 Feb 2017 19:18:15 +0000 (20:18 +0100)]
lecroy-xstream: Initial driver skeleton.

Signed-off-by: Sven Schnelle <redacted>
7 years agorohde-schwarz-sme-0x: Add support for SR_CONF_SIGNAL_GENERATOR.
Uwe Hermann [Thu, 2 Mar 2017 13:38:19 +0000 (14:38 +0100)]
rohde-schwarz-sme-0x: Add support for SR_CONF_SIGNAL_GENERATOR.

7 years agoAdd SR_CONF_SIGNAL_GENERATOR.
Uwe Hermann [Thu, 2 Mar 2017 13:35:17 +0000 (14:35 +0100)]
Add SR_CONF_SIGNAL_GENERATOR.

7 years agorohde-schwarz-sme-0x: Drop prototypes for non-existing functions.
Uwe Hermann [Thu, 2 Mar 2017 13:25:27 +0000 (14:25 +0100)]
rohde-schwarz-sme-0x: Drop prototypes for non-existing functions.

7 years agorohde-schwarz-sme-0x: Minor whitespace and consistency fixes.
Uwe Hermann [Thu, 2 Mar 2017 13:23:07 +0000 (14:23 +0100)]
rohde-schwarz-sme-0x: Minor whitespace and consistency fixes.

7 years agorohde-schwarz-sme-0x: Coding style fixes
Soeren Apel [Thu, 23 Feb 2017 16:33:47 +0000 (17:33 +0100)]
rohde-schwarz-sme-0x: Coding style fixes

7 years agorohde-schwarz-sme-0x: Initial device support
Vlad Ivanov [Thu, 27 Oct 2016 13:22:55 +0000 (09:22 -0400)]
rohde-schwarz-sme-0x: Initial device support

Signed-off-by: Vlad Ivanov <redacted>
7 years agohwdriver: Drop unneeded debug message.
Uwe Hermann [Sun, 26 Feb 2017 14:43:35 +0000 (15:43 +0100)]
hwdriver: Drop unneeded debug message.

The logs already show scan attempts per-driver, no need to also log the
init per-driver, since that's always happening and cannot (normally) fail.

7 years agoFix analog output display
Sven Schnelle [Sat, 11 Feb 2017 19:16:59 +0000 (20:16 +0100)]
Fix analog output display

I've seen the following output from sigrok-cli:

CH1: 478.720 mV
CH1: -514 mV
CH1: -0 V

I added some debug, and it seems like the digits value isn't reset
to the actual value after calling sr_analog_si_prefix_friendly():

using 6 digits
value2 0.478720 digits 6
value2 -0.513536 digits 3
value2 -0.487424 digits 0

This commit fixes this by resetting the value to the actual value before.

Signed-off-by: Sven Schnelle <redacted>
7 years agoFix initial sample value for demo driver
Sven Schnelle [Tue, 14 Feb 2017 22:30:13 +0000 (23:30 +0100)]
Fix initial sample value for demo driver

devc->step is not reset on acquistion start, so acquisition
starts with a different value every time. Thats annoying when
using the demo driver to debug sigrok, so lets make sure that
it's reset to 0.

Signed-off-by: Sven Schnelle <redacted>
7 years agoBuild: fix #865 yet again
Marcus Comstedt [Wed, 1 Feb 2017 17:50:26 +0000 (18:50 +0100)]
Build: fix #865 yet again

It appears that the symmetry changes of setting CC and CFLAGS correctly
for C code compilation in commit 104f02f broke things for people using
some other version of setuptools which uses those vars instead of
CXX and CXXFLAGS when compiling C++ code. In order to make this work
everywhere, set _both_ sets of variables as required for C++ compilation.
No C code is compiled by the python binding module anyway.

7 years agoREADME.devices: Update hantek-6xxx entry.
Uwe Hermann [Fri, 27 Jan 2017 00:14:02 +0000 (01:14 +0100)]
README.devices: Update hantek-6xxx entry.

7 years agoz60_libsigrok.rules: Add Hantek 6022BL.
Uwe Hermann [Fri, 27 Jan 2017 00:11:50 +0000 (01:11 +0100)]
z60_libsigrok.rules: Add Hantek 6022BL.

7 years agoAdd support for Hantek 6022BL
Sebastian Tabares Amaya [Wed, 28 Dec 2016 03:41:17 +0000 (22:41 -0500)]
Add support for Hantek 6022BL

7 years agoagilent-dmm: Add support for U124xC.
Aurelien Jacobs [Mon, 16 Jan 2017 10:53:11 +0000 (11:53 +0100)]
agilent-dmm: Add support for U124xC.

7 years agoagilent_dmm: Split generic part of recv_log_u128x() to recv_log().
Aurelien Jacobs [Mon, 16 Jan 2017 10:47:42 +0000 (11:47 +0100)]
agilent_dmm: Split generic part of recv_log_u128x() to recv_log().

7 years agoagilent-dmm: Add support for Vsense (Non-Contact Voltage).
Aurelien Jacobs [Tue, 17 Jan 2017 22:42:18 +0000 (23:42 +0100)]
agilent-dmm: Add support for Vsense (Non-Contact Voltage).

7 years agoagilent-dmm: Fix handling of the 2nd channel of 2 channels models.
Aurelien Jacobs [Tue, 17 Jan 2017 23:54:29 +0000 (00:54 +0100)]
agilent-dmm: Fix handling of the 2nd channel of 2 channels models.

The 2nd channel of those models is not limited to temperature,
so it is necessary to query CONF? @2.

7 years agoagilent-dmm: Set correct length in strncmp().
Aurelien Jacobs [Mon, 16 Jan 2017 10:45:20 +0000 (11:45 +0100)]
agilent-dmm: Set correct length in strncmp().

7 years agolibsigrok.h: Add SR_MQ_HARMONIC_RATIO.
Aurelien Jacobs [Mon, 16 Jan 2017 10:44:22 +0000 (11:44 +0100)]
libsigrok.h: Add SR_MQ_HARMONIC_RATIO.

7 years agoscpi_serial: Convert 'got_newline' variable to gboolean.
Uwe Hermann [Sat, 21 Jan 2017 14:17:35 +0000 (15:17 +0100)]
scpi_serial: Convert 'got_newline' variable to gboolean.

7 years agoscpi: Do not block when reading header of definite length blocks
Stefan Brüns [Fri, 13 Jan 2017 22:10:41 +0000 (23:10 +0100)]
scpi: Do not block when reading header of definite length blocks

When using SCPI over serial (over USB), we want the header without waiting
for the terminating newline, as otherwise the transfer may time out.
sr_scpi_get_data() will block until the message is complete.

7 years agoscpi_serial: Get rid of intermediate buffer, do not strip newline
Stefan Brüns [Sun, 8 Jan 2017 17:32:05 +0000 (18:32 +0100)]
scpi_serial: Get rid of intermediate buffer, do not strip newline

Lowlevel access functions should not alter the data. sr_scpi_get_string(),
which is called by most highlevel access functions, strips newlines
in a central place, and is only fed with data which contains newlines
as a final terminator.
IEEE 488.2 definite length blocks may contain arbitrary data, thus the
payload up to the provided length should be passed unaltered.

Track if the last received character is a newline, which can be used
by sr_scpi_get_string() and its callers to determine if the response
is complete.

7 years agoscpi: Query current time just once, use microseconds for timeout
Stefan Brüns [Thu, 12 Jan 2017 00:20:17 +0000 (01:20 +0100)]
scpi: Query current time just once, use microseconds for timeout

g_get_monotonic_time() returns current time in microseconds, use the same
granularity for storing the read timeout.
There is also no need to check the timeout if data has just been read.

7 years agoyokogawa-dlm: Mostly fix dumping of current timebase
Stefan Brüns [Sat, 14 Jan 2017 19:56:08 +0000 (20:56 +0100)]
yokogawa-dlm: Mostly fix dumping of current timebase

sr_period_string takes the frequency as its argument, i.e. the reciprocal
of the timebase. Obviously this will not work for frequencies less than
1Hz / timebases greater than 1 second, but at least is correct for all
other available timebases.

7 years agohameg_hmo: Mostly fix dumping of current timebase
Stefan Brüns [Wed, 11 Jan 2017 23:29:03 +0000 (00:29 +0100)]
hameg_hmo: Mostly fix dumping of current timebase

sr_period_string takes the frequency as its argument, i.e. the reciprocal
of the timebase. Obviously this will not work for frequencies less than
1Hz / timebases greater than 1 second, but at least is correct for all
other available timebases.

7 years agotests/strutil: Check output of sr_period_string
Stefan Brüns [Sat, 14 Jan 2017 19:50:12 +0000 (20:50 +0100)]
tests/strutil: Check output of sr_period_string

7 years agostrutil: Fix sr_period_string output
Stefan Brüns [Sat, 14 Jan 2017 19:48:08 +0000 (20:48 +0100)]
strutil: Fix sr_period_string output

The output was wrong for all frequencies but 1 Hz, 1 kHz, 1 MHz and 1 GHz.
With this changes, the output may still be off due to rounding, but will
be correct as to the shown accuracy.

7 years agoscpi: Don't process received data of zero length
Gerhard Sittig [Fri, 30 Dec 2016 12:16:04 +0000 (13:16 +0100)]
scpi: Don't process received data of zero length

When nothing was received in a read attempt, we need not adjust the
buffered data's read position nor the glib string object's size. Skip
any processing for empty input, just keep checking for timeouts.

7 years agoscpi: Rephrase buffer resize for free space during SCPI read, add comments
Gerhard Sittig [Sat, 7 Jan 2017 12:08:12 +0000 (13:08 +0100)]
scpi: Rephrase buffer resize for free space during SCPI read, add comments

Routine sr_scpi_get_data() checks for free space in the receive buffer,
and resizes the buffer when free space drops below a threshold. The
previous logic assumed that the resize and the read logic would interact
in some specific way to achieve the desired operation.

Adjust the buffer resize such that more free space is pre-allocated, yet
the payload size of the buffer is not affected. This eliminates the
dependency of the optional resize logic from subsequent activity for
reception of data that is non-optional.

Add comments while we are here, outline the steps taken in the
sr_scpi_get_data() routine.

7 years agohameg-hmo: Rephrase the channel constraints check (analog vs digital)
Gerhard Sittig [Fri, 6 Jan 2017 21:00:28 +0000 (22:00 +0100)]
hameg-hmo: Rephrase the channel constraints check (analog vs digital)

Phrase the logic which checks the use of analog channels and digital
pods in more generic terms. Place a comment about the contraints' being
potentially dependent on the specific HMO model. This implementation
should lend itself better to future adjustment (HMO1002?).

7 years agohameg-hmo: Map logic data from second digital pod to channels D8-D15
Gerhard Sittig [Fri, 6 Jan 2017 19:53:50 +0000 (20:53 +0100)]
hameg-hmo: Map logic data from second digital pod to channels D8-D15

An internal libsigrok implementation detail prevents partial submission
of logic data for different channel groups in multiple calls. Instead
one logic packet needs to be sent in a single call, which combines data
for all channels.

Introduce a logic data storage which folds samples from several channel
groups that were received at different points in time into a combined
memory layout of larger unitsize. Stick with the former shortcut of
passing on the input bytes directly when only the first digital pod is
used during acquisition.

This change correctly maps data from the second pod to channels D8-D15.

7 years agohameg-hmo: Do read from second digital pod during acquisition
Gerhard Sittig [Fri, 6 Jan 2017 17:56:40 +0000 (18:56 +0100)]
hameg-hmo: Do read from second digital pod during acquisition

The previous implementation only added one of the digital channels to
the list of enabled channels that are involved in the acquisition (the
first one that was found). This means that when the set of used digital
channels spans more than one pod/group, the second pod will never be
read from.

Make sure to enable one digital channel per pod/group, such that
acquisition will retrieve data from all involved input sources.

Add comments while we are here. Mention how the different setup, check,
start, and receive routines which are spread across several files do
interact to achieve acquisition.

7 years agohameg-hmo: Send exactly one sigrok frame per scope frame
Gerhard Sittig [Fri, 6 Jan 2017 17:12:55 +0000 (18:12 +0100)]
hameg-hmo: Send exactly one sigrok frame per scope frame

The previous implementation used to put FRAME_BEGIN and FRAME_END
markers around each received chunk of samples, while those chunks
correspond to a single channel (analog) or a group of eight channels
(digital) each. In other words, the hameg-hmo driver had provided a
multiple of the requested frames, and those frames were incomplete.

Make sure to only send FRAME_BEGIN before the first channel's data,
and FRAME_END after the last channel's data of a frame. Thus make
sigrok frames exactly match the scope's frames.

Add some comments on the frame marker and the acquisition stop logic
while we are here.

7 years agohameg-hmo: Use the host's endianess to read analog channel data via SCPI
Gerhard Sittig [Fri, 30 Dec 2016 22:46:27 +0000 (23:46 +0100)]
hameg-hmo: Use the host's endianess to read analog channel data via SCPI

Configure the scope to the host's native endianess before downloading
acquisition data from analog channels. This unbreaks operation on those
models which default to a representation which differs from the host.

7 years agoRevert "hameg-hmo: Support BE format for SCPI sample downloads"
Gerhard Sittig [Sat, 7 Jan 2017 20:15:00 +0000 (21:15 +0100)]
Revert "hameg-hmo: Support BE format for SCPI sample downloads"

Undo the change which queries the scope's endianess and has the floats
converted after reception. An alternative implementation will perform
better.

7 years agoRevert "scpi: Don't process received data of zero length"
Gerhard Sittig [Sat, 7 Jan 2017 20:16:33 +0000 (21:16 +0100)]
Revert "scpi: Don't process received data of zero length"

Undo the change which skips management activities when no data was
received. This change breaks the current implementation, and needs to
get deferred until a delicate interaction between the resize and the
read logic has been eliminated.

7 years agolicense: remove FSF postal address from boiler plate license text
Gerhard Sittig [Thu, 20 Oct 2016 07:57:25 +0000 (09:57 +0200)]
license: remove FSF postal address from boiler plate license text

Remove the FSF postal address as it might change (it did in the past).
Reference the gnu.org website instead which is more stable.

7 years agoasyc-ii: Rephrase "exponent" logic when parsing packets
Gerhard Sittig [Sat, 31 Dec 2016 13:25:07 +0000 (14:25 +0100)]
asyc-ii: Rephrase "exponent" logic when parsing packets

Replace a C library strcspn(3) call with the more portable glib
g_strstr_len(3) routine. This is possible since a single separator
is searched for, no actual "set of characters" is involved.

As a byproduct, this eliminates a "late" reference to 'cnt' at the
bottom of the routine, after the value was assigned in a rather distant
location at the top of the routine. The cost of strlen() should be
acceptable for a buffer with a single digit total length.

7 years agoasyc-ii: Prefer more portable and common string routines
Gerhard Sittig [Sat, 31 Dec 2016 11:54:39 +0000 (12:54 +0100)]
asyc-ii: Prefer more portable and common string routines

Replace C language string operations with their glib incarnations for
improved portability. Prefer a common sigrok float conversion routine
over a DIY implementation.

7 years agoasyc-ii: Unobfuscate a comment on packet parse constraints
Gerhard Sittig [Sat, 31 Dec 2016 11:48:59 +0000 (12:48 +0100)]
asyc-ii: Unobfuscate a comment on packet parse constraints

The specific packet layout puts constraints on the parse logic (case
sensitive comparison, order of comparison). Fix a comment that made no
sense before, and better reflect that there are two constraints.

7 years agoscpi: Rephrase length logic in data block reception, comment/group code
Gerhard Sittig [Fri, 30 Dec 2016 12:27:29 +0000 (13:27 +0100)]
scpi: Rephrase length logic in data block reception, comment/group code

Slightly rephrase the SCPI code which parses the responses that carry
(binary) data blocks. Be explicit about NUL termination when parsing the
leading length spec in the response, obsoleting the array initializer.
Add lots of comments and group source code lines to better reflect
what's happening from the protocol's perspective.

Fix the returned error code in the path which reads responses of
excessive length in chunks. The previous implementation detected errors
but always returned code 0 (success).

7 years agoscpi: Don't process received data of zero length
Gerhard Sittig [Fri, 30 Dec 2016 12:16:04 +0000 (13:16 +0100)]
scpi: Don't process received data of zero length

When nothing was received in a read attempt, we need not adjust the
buffered data's read position nor the glib string object's size. Skip
any processing for empty input, just keep checking for timeouts.

7 years agoscpi: Minor style nits
Gerhard Sittig [Fri, 30 Dec 2016 12:11:59 +0000 (13:11 +0100)]
scpi: Minor style nits

Drop an initial assignment to a variable which never takes effect.
Add braces around the body of a more complex if block. Separate routines
from each other by exactly one empty line.