]> sigrok.org Git - libsigrok.git/log
libsigrok.git
3 months agooutput/csv: use intermediate time_t var, silence compiler warning master github/master
Gerhard Sittig [Mon, 1 Jan 2024 13:37:50 +0000 (14:37 +0100)]
output/csv: use intermediate time_t var, silence compiler warning

There are platforms where timeval and time_t disagree on the width of
the data type of the field which holds seconds. Passing a pointer to an
unexpected type results in warnings (and probably unreliable execution).

Assign the value which is gotten from a timeval to an intermediate
time_t variable, so that the ctime() invocation becomes portable.

3 months agoinput/protocoldata: silence build warnings, adjust printf formats
Gerhard Sittig [Mon, 1 Jan 2024 13:26:25 +0000 (14:26 +0100)]
input/protocoldata: silence build warnings, adjust printf formats

Properly use %zu for size_t, and %PRIu64 for uint64_t data types. This
silences build warnings which previously went unnoticed because their
occurance depends on the target platform.

3 months agooutput/srzip: reduce text line length, remove "dead code"
Gerhard Sittig [Fri, 29 Dec 2023 11:39:05 +0000 (12:39 +0100)]
output/srzip: reduce text line length, remove "dead code"

Move an instruction to reduce its text line length. Also happens to put
the calculation of remaining buffer space and the current write position
in closer proximity, improving maintainability in the process.

Remove an assignment after appending to the archive and before iterating
the input samples loop again. Eliminates code that never took effect.
The value gets determined at the loop body's start anyway.

3 months agooutput/srzip: accept arbitrary input and output unit sizes
Gerhard Sittig [Fri, 29 Dec 2023 11:32:45 +0000 (12:32 +0100)]
output/srzip: accept arbitrary input and output unit sizes

Commit c03aaf342c3f introduced a check and refused to store sample data
when the feed would not exactly match an expected width that was derived
from the device's or input's total count of logic channels. Earlier
versions assumed the match but never checked (immediately forwarded
session feed content to the ZIP archive). Existing applications may not
be prepared to process the resulting archive where meta data and samples
disagree on essential properties. The fatal condition aborted execution,
which was perceived as a regression. A message was added later to
communicate that the condition was hit, but its WARN severity was
misleading, and its meaning still was obscure to users.

This commit extends the reception of sample data in the session feed and
its accumulation in the local buffer before ZIP archive appends. Any
combination of input and output unit sizes are accepted. It's perfectly
legal for sources to not communicate data for disabled channels, as well
as to communicate wider data images than strictly necessary to simplify
their support for a variety of input formats or device models. Details
are available to users at higher log levels (INFO). Default levels only
communicate fatal conditions (which should be implementation flaws now
exclusively).

The issue reproduces especially well with input formats that are rather
flexible, or device drivers which support a range of devices with many
configurations or models of differing capabilities. The issue was most
recently reported for the OLS driver and an Arduino SUMP firmware. Given
how many input modules and device drivers can feed into a few output
modules, it's assumed that addressing the general issue in a common
location is preferrable over local adjustment of individual input
modules or device drivers. Adjusting both places doesn't harm either,
increases overall robustness.

The implementation results in a negligable runtime overhead for the
regular case of matching unit sizes (a few integer checks). And an
acceptable overhead when the session feed is wider than the srzip
archive's unit size (multiple memcpy() calls where previously was only
one which would have been incorrect without the consistency check). The
code path which needs to apply padding to the output is most expensive,
but the implementation is only as expensive as it needs to be. The added
cost only occurs in the case of mismatches, which were not handled at
all before this change. The combination of extensive diagnostics and
internal consistency checks shall increase robustness and help during
future maintenance.

Reported-By: Pavel Fedin <redacted>
3 months agooutput/srzip: rename variables for samples counts
Gerhard Sittig [Fri, 29 Dec 2023 11:24:06 +0000 (12:24 +0100)]
output/srzip: rename variables for samples counts

The srzip output module deals with a number of samples that are of a
given width (unit size). Rename variables to better tell item counts
from byte counts. See a word diff for review.

3 months agooutput/srzip: rename variable for archive unit size
Gerhard Sittig [Fri, 29 Dec 2023 11:17:31 +0000 (12:17 +0100)]
output/srzip: rename variable for archive unit size

The srzip output module needs to deal with two unit sizes. One that got
derived from the device's or input's logic channels' total count, and
will end up being used in the ZIP archive. And one which is seen when
the session feed provides sample data.

Rename the identifier to reflect this distinction. See a word diff for
the essence of the change.

Also rephrase the zip_append_queue() invocation for improved
readability. Use line breaks to illustrate parameter sets which are
related, and separate them from other parameters which are unrelated.

3 months agoscpi/serial: Add USB VID/PID for R&S HMC808x series
Marc Schink [Wed, 26 Apr 2023 08:50:49 +0000 (10:50 +0200)]
scpi/serial: Add USB VID/PID for R&S HMC808x series

Signed-off-by: Marc Schink <redacted>
3 months agocontrib: Add udev rule for R&S HMC804x series (USBTMC)
Marc Schink [Mon, 5 Dec 2022 13:12:26 +0000 (14:12 +0100)]
contrib: Add udev rule for R&S HMC804x series (USBTMC)

Signed-off-by: Marc Schink <redacted>
3 months agoscpi-pps: Add support for R&S HMC8042
Marc Schink [Wed, 12 Apr 2023 05:13:55 +0000 (07:13 +0200)]
scpi-pps: Add support for R&S HMC8042

Signed-off-by: Marc Schink <redacted>
3 months agoscpi-pps: Add OCP support for R&S HMC8043
Marc Schink [Thu, 20 Apr 2023 17:28:19 +0000 (19:28 +0200)]
scpi-pps: Add OCP support for R&S HMC8043

Signed-off-by: Marc Schink <redacted>
3 months agoscpi-pps: Add support for SR_CONF_OVER_CURRENT_PROTECTION_DELAY
Marc Schink [Thu, 20 Apr 2023 17:25:58 +0000 (19:25 +0200)]
scpi-pps: Add support for SR_CONF_OVER_CURRENT_PROTECTION_DELAY

Prepare the driver for the 'over-current protection delay' feature. For
now, this feature is disabled for all currently supported devices.

Signed-off-by: Marc Schink <redacted>
3 months agohwdriver: Add SR_CONF_OVER_CURRENT_PROTECTION_DELAY
Marc Schink [Thu, 20 Apr 2023 17:21:13 +0000 (19:21 +0200)]
hwdriver: Add SR_CONF_OVER_CURRENT_PROTECTION_DELAY

This config key allows to specify the delay before the over-current
protection triggers.

Signed-off-by: Marc Schink <redacted>
3 months agogreatfet: feed the session with constant width sample data
Gerhard Sittig [Thu, 21 Dec 2023 20:24:33 +0000 (21:24 +0100)]
greatfet: feed the session with constant width sample data

Rename identifiers to tell the sigrok session feed's width and the width
of sample data in device firmware communication apart. Always feed the
session with sample data of a width which corresponds to the device's
channels count. Some output modules and applications may not be prepared
to handle different cases.

3 months agotests: adjust test coverage for power of two and input value 0
Gerhard Sittig [Thu, 21 Dec 2023 20:22:43 +0000 (21:22 +0100)]
tests: adjust test coverage for power of two and input value 0

An input value 0 for the sr_next_power_of_two() routine is not invalid
any longer. Remove the test case that is expected to fail. Add a regular
case to cover that code path instead.

3 months agostrutil: support special case in power of two calculation
Gerhard Sittig [Thu, 21 Dec 2023 20:20:55 +0000 (21:20 +0100)]
strutil: support special case in power of two calculation

The sr_next_power_of_two() helper routine rejected input value 0
(an index), considered this case invalid. It is not, requires 1 bit
to hold the value. Return a "power of two" value of 1 for that input,
callers expect that result.

4 months agohantek-dso: eliminate the "forced trigger" option value
Gerhard Sittig [Mon, 27 Nov 2023 18:12:11 +0000 (19:12 +0100)]
hantek-dso: eliminate the "forced trigger" option value

Commit c93f113879a0 introduced a hack on top of an unfortunate choice.
It seems counter intuitive to open code a default trigger source on an
arbitrary channel, and have users override it with the "forced" value
to _not_ use a trigger.

The normal approach would be to specify a trigger when a trigger should
be used, and to not specify a trigger when no trigger should be used.

Eliminate the "forced" choice in the trigger_sources[] list. Start with
a not-set value. Accept when a value is specified (a "genuine" choice).
Don't bother adding support to "un-set" the previously specified choice.

This leaves the intuitive support for trigger specs that shall be used,
and only uses triggers when they were specified. Does not provide means
to "un-set" an earlier specified trigger config as the implementation
did before the 2023-09 change, which would be the 2021-02 status.

If the approach implemented here should be considered undesirable, then
a "none" option value should be introduced, something that much better
communicates to users what's happening and what the consequence of a
config choice would be.

This commit also adjusts the "ugh" code path which differed from the
"capture empty" code path. Fixes a resource leak in the config set path.
The "set trigger source" and "set trigger and samplerate" commands don't
agree on the phrase for the trigger source in the wire format. But have
been doing that before the forced trigger introduction, behaviour
remains unchanged here.

4 months agosiglent-sds: incorrect g_array_free call
fenugrec [Mon, 20 Nov 2023 22:30:48 +0000 (17:30 -0500)]
siglent-sds: incorrect g_array_free call

Since we are not keeping the array's data, arg must be TRUE to free it.

reported by Fr3ya on github as PR #207

4 months agosiglent-sds: reduce indentation
fenugrec [Mon, 20 Nov 2023 22:27:36 +0000 (17:27 -0500)]
siglent-sds: reduce indentation

[ see a word diff for review ]

4 months agodrivers: assign driver_list with g_array_free()
fenugrec [Mon, 20 Nov 2023 22:19:39 +0000 (17:19 -0500)]
drivers: assign driver_list with g_array_free()

To make it clear we are free'ing the array while keeping its data, use
the return value from g_array_free(). Keep the cast since ret type
is a gchar*.

5 months agocontrib: add udev rule for Voltcraft DSO2020
Thomas Emmert [Sun, 28 Nov 2021 20:52:49 +0000 (21:52 +0100)]
contrib: add udev rule for Voltcraft DSO2020

[ gsi: fixup commit message ]

5 months agohantek-6xxx: add support for Voltcraft DSO2020
Thomas Emmert [Sun, 28 Nov 2021 20:40:30 +0000 (21:40 +0100)]
hantek-6xxx: add support for Voltcraft DSO2020

[ gsi: fixup whitespace and commit message ]

5 months agogreatfet: support capture of the upper pin bank (first pin 8)
Gerhard Sittig [Sun, 29 Oct 2023 16:40:16 +0000 (17:40 +0100)]
greatfet: support capture of the upper pin bank (first pin 8)

Present all 16 channels to users. By default lower channels are enabled
and upper channels are disabled. Support the configuration where users
capture upper channels after disabling lower channels. Device firmware
provides the "first pin" feature and only communicates pin states for
the upper bank to the host.

This mode of operation can be useful to inspect different signal sets
without physically moving probes. Upper bank capture combines well with
higher rates at lower pin counts.

This implementation in theory also covers 16 channel captures, though
the firmware does not officially support multi-bank captures. Emit a
warning when this setup gets detected, but don't refuse operation and
attempt a best effort capture.

This commit also improves reliability in paths where failed acquisition
starts shutdown the operation, before another request gets serviced.

5 months agogreatfet: don't print misleading "unknown" libusb error text
Gerhard Sittig [Sun, 29 Oct 2023 16:37:59 +0000 (17:37 +0100)]
greatfet: don't print misleading "unknown" libusb error text

Only lookup libusb error messages for negative return values which
communicate error codes. Positive return values are transmission counts
and are not an error.

The "UNKNOWN" messages only were seen at higher log levels. Users were
not affected by the issue.

5 months agocontrib: add udev rule for GreatFET One by Great Scott Gadgets
Gerhard Sittig [Fri, 6 Oct 2023 14:38:47 +0000 (16:38 +0200)]
contrib: add udev rule for GreatFET One by Great Scott Gadgets

5 months agogreatfet: first operational GreatFET One driver implementation
Gerhard Sittig [Fri, 6 Oct 2023 16:09:58 +0000 (18:09 +0200)]
greatfet: first operational GreatFET One driver implementation

This sigrok driver for the GreatFET One device as a logic analyzer is
based on https://github.com/Qyriad/libsigrok and was massaged to use
common infrastructure where appropriate, and adjust coding style to
match the sigrok.org project's code base.

This implementation supports the acquisition of 8 channels at rates up
to 40.8MHz, and higher rates up to 204MHz for reduced channel counts.
Soft triggers are not supported in this implementation, ideally common
support would cover this more transparently in the future.

Tested with v2021.2.1 firmware as available via 'pip install greatfet'.

Support for 16 channels is prepared but disabled by default. Requires
firmware support which is not officially available.

5 months agogreatfet: Initial driver skeleton.
Gerhard Sittig [Fri, 6 Oct 2023 14:40:04 +0000 (16:40 +0200)]
greatfet: Initial driver skeleton.

5 months agoanalog: Get GString content from proper API call
Marek Vasut [Sat, 28 Oct 2023 07:12:48 +0000 (09:12 +0200)]
analog: Get GString content from proper API call

Use the g_string_free() routine's return value instead of pulling the
string content out of the buffer structure bypassing the library's API.

Signed-off-by: Marek Vasut <redacted>
5 months agools: Get GString content from proper API calls
Marek Vasut [Sat, 28 Oct 2023 07:12:48 +0000 (09:12 +0200)]
ols: Get GString content from proper API calls

Use the g_string_free() routine's return value instead of pulling the
string content out of the buffer structure bypassing the library's API.
This improves portability and readability, also happens to silence an
"ignoring return value" warning which is seen with GCC 13.2.0.

See https://docs.gtk.org/glib/method.String.free.html#return-value for
a discussion of the g_string_free() return value.

Signed-off-by: Marek Vasut <redacted>
6 months agooutput/srzip: decorate read pointer as const for awareness
Gerhard Sittig [Tue, 17 Oct 2023 19:28:16 +0000 (21:28 +0200)]
output/srzip: decorate read pointer as const for awareness

Recipients of sample data as received from the data feed should consider
this data read-only, they are handed a reference to a message which is
also sent to other recipients.

Add the 'const' decoration in the output/srzip module to raise awareness
during future maintenance.

6 months agoyokogawa-dlm: silence compiler warning (passing an empty array)
Gerhard Sittig [Tue, 17 Oct 2023 19:25:00 +0000 (21:25 +0200)]
yokogawa-dlm: silence compiler warning (passing an empty array)

Rephrase the config_list() routine such that it does not attempt to
access the first item in an empty array. Be explicit about the digital
channel group's devopts being empty by design, add a comment.

The compiler warning could have been a false positive, but phrasing the
source code differently doesn't harm either, eliminates uncertainty.

6 months agotests: implement strutil test cases for power-of-two calculation
Gerhard Sittig [Tue, 17 Oct 2023 19:22:32 +0000 (21:22 +0200)]
tests: implement strutil test cases for power-of-two calculation

Add the "calc" section to the strutil tests, and implement test cases
which cover the power-of-two calculation routine. Cover small values
which are the immediate use case and the motivation for introducing the
helper routine.

6 months agostrutil: introduce power-of-two calculation routine
Gerhard Sittig [Tue, 17 Oct 2023 19:20:56 +0000 (21:20 +0200)]
strutil: introduce power-of-two calculation routine

Introduce the sr_next_power_of_two() routine which determines how many
bits are required to store a value. Decorate it as SR_API because some
applications may want it, but more importantly to make it available to
the test suite.

6 months agosw_limits: touch up documentation, address minor style nits
Gerhard Sittig [Mon, 16 Oct 2023 20:12:27 +0000 (22:12 +0200)]
sw_limits: touch up documentation, address minor style nits

Touch up Doxygen comments, add discussion of missing parameters. Group
and alpha-sort header files. Break long lines in more useful locations.

6 months agojuntek-jds6600: speedup serial communication, reduce timeouts
Gerhard Sittig [Sun, 15 Oct 2023 10:07:16 +0000 (12:07 +0200)]
juntek-jds6600: speedup serial communication, reduce timeouts

Wire traffic captures for serial-over-USB communication between the host
and the signal generator suggests that: Device firmware's reponses are
immediate. The 115200 UART is the limiting factor, USB FS adds little.

Comment on these findings for later reference. Reduce timeouts and
remove delays where appropriate. This dramatically speeds up the scan
for the device, and subsequent communication. Identification and getting
the current configuration takes a total of 70ms after this change.

6 months agoinput/protocoldata: improve use of feed queue API
Gerhard Sittig [Sun, 15 Oct 2023 08:31:15 +0000 (10:31 +0200)]
input/protocoldata: improve use of feed queue API

Improve feed queue related calls in the submission of capture start/end
idle phases, inter-frame idle phases, and bit time quanta of generated
protocol traffic. The submit-one API call accepts a repeat count which
eliminates caller's loops.

This also happens to eliminate a misguided yet harmless wrong use of the
feed queue API. An earlier implementation assumed "data pointer, and
data size" as arguments, and looped around that at the caller's. While
it's "data pointer, and repeat count". Used to work because sizeof(u8)
"was mistaken" as repeat count 1, so this flaw went unnoticed.

Propagate errors as they are seen, an earlier implementation silently
ignored them for frame payloads.

6 months agofeed_queue: add API to submit multiple sample values at once
Gerhard Sittig [Sun, 15 Oct 2023 08:22:20 +0000 (10:22 +0200)]
feed_queue: add API to submit multiple sample values at once

Extend the common feed queue support API. Add a routine which accepts
multiple sample values that correspond to multiple sample points. This
eliminates the necessity for buffer handling and flush semantics at call
sites. And reduces overhead when callers previously had to submit one
sample value per API call when only single value submission existed.

6 months agofeed_queue: rename routines for submission of a single sample value
Gerhard Sittig [Sun, 15 Oct 2023 08:08:11 +0000 (10:08 +0200)]
feed_queue: rename routines for submission of a single sample value

Common feed queue support originated from input module RLE compression.
Its API would accept a single sample value and optionally repeat that
value several times.

Rename the routines and its parameter for improved awareness. Adjust
existing callers: The asix-omega, atorch, kingst-la, rdtech-tc, and
rdtech-um acquisition device drivers, as well as the protocoldata,
stf, and vcd input modules.

See a word diff for the essence of the change.

6 months agokingst-la2016: rephrase 'sdi' resource release during scan
Gerhard Sittig [Thu, 5 Oct 2023 16:11:18 +0000 (18:11 +0200)]
kingst-la2016: rephrase 'sdi' resource release during scan

Eliminate an incomplete local copy of sdi resource release code in an
error path of scan/probe. Use common code instead to free the sdi.

Assign opaque pointers to intermediate variables before passing their
values to other routines. Should slightly increase readability and
data type safety. Also close the USB handle if it's open at this time.

6 months agobindings/python: rephrase for Python 3.9 deprecation (call API)
Gerhard Sittig [Mon, 2 Oct 2023 16:33:08 +0000 (18:33 +0200)]
bindings/python: rephrase for Python 3.9 deprecation (call API)

The PyEval_CallObject() routine was deprecated in Python 3.9, use
PyObject_CallObject() instead which has existed since at least 3.0.

There are also PyEval_InitThreads() deprecation warnings, but these
originate from SWIG generated code and are outside of our control.
Requires SWIG version 4.1 to silence these.

Tested-By: Sascha Silbe <redacted>
6 months agojuntek-jds6600: fix leaks, improve style, extend documentation
Gerhard Sittig [Thu, 12 Oct 2023 17:05:30 +0000 (19:05 +0200)]
juntek-jds6600: fix leaks, improve style, extend documentation

Address several robustness/reliability and style issues in the JDS6600
support code. Extend existing documentation to help future maintenance.
This work is based on review feedback that I received by user fenugrec
via IRC.

- Fix resource leaks in the scan/probe code path. Respond earlier to
  failed communication during that startup phase after previous comms
  worked.
- Adjust printf(3) format specifiers. Use more appropriate integer
  formats for sr_atoul_base() results. "%lf" is not needed for doubles.
- More thorough argument checks at the start of routines. Be explicit
  about narrow value ranges when wide data types are involved (function
  code only uses a small part of the size typed variable's range).
- Quote example requests and responses in protocol.c so that readers can
  match generating and processing code paths to wire traffic, without
  having access to the device or its protocol description. Extend
  diagnostics messages to optionally provide the full content of raw
  communication, including the end-of-line condition and non-printables.
  Regular sr_log() calls would strip these details, users could not
  notice.
- Provide more comments on motivation and implementation details.
- Prettify the protocol.h context declaration. Put struct members on
  their individual source code lines.

6 months agozeroplus-logic-cube: address minor style nits
Gerhard Sittig [Thu, 28 Sep 2023 19:11:54 +0000 (21:11 +0200)]
zeroplus-logic-cube: address minor style nits

Prefer size types for indices and length specs. Separate function calls
from result inspection from flow control, to improve readability. Trim
text line length in complex expressions. Eliminate redundant data types
in malloc calls. Eliminate else after return. Remove dead code.

6 months agozeroplus-logic-cube: move USB VID:PID check in scan before device access
Gerhard Sittig [Thu, 28 Sep 2023 18:53:26 +0000 (20:53 +0200)]
zeroplus-logic-cube: move USB VID:PID check in scan before device access

Getting USB strings from faulty devices can be troublesome. Users report
segfaults when unrelated(!) devices get accessed during scan for certain
measurement devices.

Move the VID:PID check during scan before the USB string access. This
avoids access to unrelated devices.

Rephrase the check whether a USB device is a supported model. The
previous implementation's operation is questioned, the loop condition
looked suspicious.

Reported-By: Marek Antoniak <redacted> [the early check]
6 months agochronovu-la: rephrase the USB vendor check during scan
Gerhard Sittig [Thu, 28 Sep 2023 18:35:00 +0000 (20:35 +0200)]
chronovu-la: rephrase the USB vendor check during scan

Provide more information in the source code comment on the motivation to
only inspect a given USB VID during scan for ChronoVu LA devices. Use a
different identifier for the expected VID, the previous implementation
was rather misleading.

6 months agochronovu-la: rephrase conn= checking in the scan routine
Gerhard Sittig [Thu, 28 Sep 2023 18:21:24 +0000 (20:21 +0200)]
chronovu-la: rephrase conn= checking in the scan routine

Prefer common support over DIY code to get the SR_CONF_CONN spec.
Simplify the check during USB enumeration whether a user provided
conn= spec applies. Sort local var decls to match their use. Setup
resulting 'devices' early.

6 months agojuntek-jds6600: implement device support, tested with Joy-IT JDS6600
Gerhard Sittig [Thu, 5 Oct 2023 15:21:07 +0000 (17:21 +0200)]
juntek-jds6600: implement device support, tested with Joy-IT JDS6600

Implement support for the essential signal generator part of the device,
tested with a 60MHz Joy-IT JDS6600 model: Two channels, enable/disable,
waveform, frequency, amplitude, offset, duty cycle selection, phase
between channels.

This version does not support external signals and frequency measurement
nor counting. Upload/download of arbitrary waveforms could work from the
serial communication's perspective, but sigrok lacks infrastructure/API
for waveform exchange or communication of blobs.

Tested with sigrok-cli and getters/setters. Quickly tested with SmuView.

6 months agojuntek-jds6600: Initial driver skeleton.
Gerhard Sittig [Thu, 5 Oct 2023 15:18:16 +0000 (17:18 +0200)]
juntek-jds6600: Initial driver skeleton.

6 months agolibsigrok-internal.h: factor out logger decl's printf format attribute
Gerhard Sittig [Fri, 6 Oct 2023 16:00:37 +0000 (18:00 +0200)]
libsigrok-internal.h: factor out logger decl's printf format attribute

Provide a common ATTR_FMT_PRINTF() macro which hides individual
platforms' details. Use it in one common sr_log() declaration.

This also allows re-use in other locations across the project.

6 months agodevantech-eth008: add more supported models, variable DI width, doc cleanup
Gerhard Sittig [Mon, 2 Oct 2023 16:34:30 +0000 (18:34 +0200)]
devantech-eth008: add more supported models, variable DI width, doc cleanup

Add support for differing DI (digital input) response sizes depending
on the model. Declare support for more models, including WIFI (their
feature set and protocol are identical, only their model ID differs).

Rework developer notes, keep the API slim and concentrate most stuff
in the implementation. Discuss USB CDC protocols and other potential
TODO items. Modbus most probably remains out of that driver's scope.

This implementation should cover most Ethernet (and Wifi) models, and
support their complete feature set from the sigrok perspective. The
most important limitation is missing support for channels' interaction
(when a pin can be any of AI and DI and DO).

6 months agoconfigure: declare raspberry-pico dependency on serial communication
Gerhard Sittig [Thu, 28 Sep 2023 11:47:05 +0000 (13:47 +0200)]
configure: declare raspberry-pico dependency on serial communication

Unbreak builds by properly declaring dependencies. This transparently
disables the driver when infrastructure is missing.

6 months agordtech-dps: rephrase how model specific ranges are handled
Gerhard Sittig [Thu, 28 Sep 2023 10:49:12 +0000 (12:49 +0200)]
rdtech-dps: rephrase how model specific ranges are handled

Commit 02a4f485de76 implemented ranges support such that _all_ models
including every RD as well as DPS device announced ranges, it's just
that most of them happen to support a single range.

Use this fact, accept any zero based index, and drop the "normalization"
to strict 0/1 values except for one RD specific code path when getting
the current state of multi-range supporting devices. Tell models with
"effectively no ranges" from devices which "support multile ranges".
This shall increase robustness and improve maintainability. Simplifies
future extensions when more ranges are involved.

6 months agordtech-dps: clear the "acquisition started" condition
Gerhard Sittig [Thu, 28 Sep 2023 10:48:10 +0000 (12:48 +0200)]
rdtech-dps: clear the "acquisition started" condition

The 'acquisition_started' condition was set when the first acquisition
attempted to start, but was never cleared. Adjust error paths in the
acquisition start and the stop code path to update that variable.

6 months agordtech-dps: address simple style issues
Gerhard Sittig [Thu, 28 Sep 2023 10:40:48 +0000 (12:40 +0200)]
rdtech-dps: address simple style issues

Coding style nits: Use const data for model lists. Prefer size types.
Link sdi and devc immediately after allocation. Skip unused wire fields
by reading them too, avoid breaking the reviewer's flow.

Cosmetics, readability: Do place trailing commas in initializers. Reduce
text line length. Break long lines in more appropriate locations that
are more readable. Eliminate unmotivated pre-increment operators.

6 months agordtech-dps: undo undesired register re-read logic change
Gerhard Sittig [Thu, 28 Sep 2023 10:37:51 +0000 (12:37 +0200)]
rdtech-dps: undo undesired register re-read logic change

Commit 02a4f485de76 snuck in a change that should not have gone there.
Revert the logic which re-reads Modbus registers several times before
declaring failure. Use the previous implementation as intended.

6 months agordtech-dps: touch up comments
Gerhard Sittig [Thu, 28 Sep 2023 10:30:05 +0000 (12:30 +0200)]
rdtech-dps: touch up comments

Address style issues in comments. Extend and rephrase some for improved
readability and awareness during maintenance. Move comments to before
the code which they relate to.

6 months agordtech-dps: adjust header includes (config.h is not a system header)
Gerhard Sittig [Thu, 28 Sep 2023 10:28:50 +0000 (12:28 +0200)]
rdtech-dps: adjust header includes (config.h is not a system header)

6 months agohameg-hmo: separate RTH002 and RTH004 model declarations
Gerhard Sittig [Thu, 28 Sep 2023 10:22:01 +0000 (12:22 +0200)]
hameg-hmo: separate RTH002 and RTH004 model declarations

Commit 10e6dfd1f921 introduced differing trigger sources for RTH1002 and
RTH1004, but shared a single scope_models[] entry with identical data for
both devices.

Use separate scope_models[] entries for RTH1002 and RTH1004, reference
their respective capabilities which differ among models.

Move the RTH1004 trigger sources next to RT1002, the declarations appear
to not assume a specific order anyway.

6 months agordtech-dps: Prevent null pointer exception
Soeren Apel [Thu, 28 Sep 2023 10:18:30 +0000 (12:18 +0200)]
rdtech-dps: Prevent null pointer exception

6 months agochronovu-la: Add checking of VendorId
Marek Antoniak [Fri, 3 Dec 2021 12:50:21 +0000 (13:50 +0100)]
chronovu-la: Add checking of VendorId

6 months agohameg-hmo: Add support for R&S RTH100x
xandinator [Sat, 12 Feb 2022 23:45:56 +0000 (00:45 +0100)]
hameg-hmo: Add support for R&S RTH100x

6 months agohantek-dso: add "forced" trigger source
Miroslav Sustek [Tue, 19 Apr 2022 18:47:40 +0000 (20:47 +0200)]
hantek-dso: add "forced" trigger source

This special trigger source mimics the trigger mode that is called
"Auto" in the original Hantek's "DSO2090 Software" and in
https://github.com/OpenHantek/OpenHantek6022 open-source project.
In the original https://github.com/OpenHantek/openhantek open-source
project the trigger mode is called "Wait/Force".

This feature can be used to immediately capture a single frame.
Example usage with sigrok-cli:
```
sigrok-cli --driver hantek-dso --frames 1 --config triggersource=forced
```

This enables us to use the oscilloscope for data logging in scripts.

Only after I implemented this I realized that if you have an extra probe,
you can set the triggersource to "EXT" and connect the EXT input
to the 1kHz calibration signal output on the back of the device
and that will trigger every millisecond. However, I still think that
the "forced" trigger source can be useful.

6 months agocontrib/60-libsigrok.rules: Add other Saleae devices.
Petr Hodina [Tue, 9 Aug 2022 07:46:29 +0000 (09:46 +0200)]
contrib/60-libsigrok.rules: Add other Saleae devices.

These PIDs and VIDs are based on udev rules from Logic 2 app. I can confirm the
one for Saleae Logic Pro 8.

6 months agoagilent-dmm: Fix compatibility with Agilent U1242A
Alex Hornung [Fri, 9 Sep 2022 13:56:05 +0000 (14:56 +0100)]
agilent-dmm: Fix compatibility with Agilent U1242A

The U1242A sends conf responses as follows,

    CONF? response '"VOLT +1.000000E+00,+1.000000E-04"

    CONF? response '"TEMP:ENV CEL"'

So update the regex patterns to cope with these.

6 months agodmm/bm??x: Add Wayback Machine links to brymen documentation
François Revol [Tue, 27 Sep 2022 22:58:06 +0000 (00:58 +0200)]
dmm/bm??x: Add Wayback Machine links to brymen documentation

6 months agordtech-dps: add support for RD6006P, RD6012P and RD6024
Mikael Djurfeldt [Mon, 16 Jan 2023 22:43:44 +0000 (23:43 +0100)]
rdtech-dps: add support for RD6006P, RD6012P and RD6024

RD6012P has two current ranges, so support for getting/setting/listing
range is added. This also means that the model table is reorganized to
support multiple ranges.

In order for the range setting and the current multiplier to be up to
date, the function rdtech_dps_update_range is called when
required. This function reads the range register of the device.

6 months agorigol-ds: Fix #1831 by supporting DS1xxxZ Plus & RPL1116 logic ports
AristarchosOfSamos [Thu, 16 Mar 2023 08:20:14 +0000 (10:20 +0200)]
rigol-ds: Fix #1831 by supporting DS1xxxZ Plus & RPL1116 logic ports

The DS1xxxZ Plus models are MSO ready, they contain the connector to attach a RPL1116 16 port digital head.
Having a DS1xxxZ Plus and a connected RPL1116 effectively the instrument becomes a MSO1xxxZ.

But that "CH_INFO(4, false)" means 4 analog channels and NO digital channels.
As said though, the DS1xxxZ Plus variants got the D0..D15 digital ports abilities already so this line treats the DS1xxxZ Plus as a plain DS1xxxZ without the digital ports.

A very simple remedy is to change the CH_INFO(4, false) to CH_INFO(4, true)
So those two lines should be changed
from
{SERIES(DS1000Z), "DS1074Z Plus", {5, 1000000000}, CH_INFO(4, false), std_cmd},
{SERIES(DS1000Z), "DS1104Z Plus", {5, 1000000000}, CH_INFO(4, false), std_cmd},
to
{SERIES(DS1000Z), "DS1074Z Plus", {5, 1000000000}, CH_INFO(4, true), std_cmd},
{SERIES(DS1000Z), "DS1104Z Plus", {5, 1000000000}, CH_INFO(4, true), std_cmd},
and the problem will be solved.

6 months agoscpi-pps: Add support for OWON SPE6103
Sahaj Sarup [Sun, 27 Aug 2023 05:56:14 +0000 (11:26 +0530)]
scpi-pps: Add support for OWON SPE6103

Signed-off-by: Sahaj Sarup <redacted>
6 months agoscpi-dmm: add support for OWON XDM1041
Sahaj Sarup [Sun, 27 Aug 2023 11:00:47 +0000 (16:30 +0530)]
scpi-dmm: add support for OWON XDM1041

Signed-off-by: Sahaj Sarup <redacted>
6 months agoraspberrypi-pico: protocol.c cleanup
Soeren Apel [Wed, 27 Sep 2023 20:48:47 +0000 (22:48 +0200)]
raspberrypi-pico: protocol.c cleanup

6 months agoraspberrypi-pico: protocol.h cleanup
Soeren Apel [Wed, 27 Sep 2023 19:44:42 +0000 (21:44 +0200)]
raspberrypi-pico: protocol.h cleanup

6 months agoraspberrypi-pico: api.c cleanup
Soeren Apel [Wed, 27 Sep 2023 19:38:20 +0000 (21:38 +0200)]
raspberrypi-pico: api.c cleanup

6 months agoraspberrypi-pico: Change %llu to %lu where needed
Soeren Apel [Wed, 27 Sep 2023 17:53:12 +0000 (19:53 +0200)]
raspberrypi-pico: Change %llu to %lu where needed

6 months agoraspberrypi-pico: Formatting; support force_detect, analog sizes
AC0BI [Fri, 13 Jan 2023 14:36:44 +0000 (07:36 -0700)]
raspberrypi-pico: Formatting; support force_detect, analog sizes

6 months agoraspberrypi-pico: Comment clean up, support a more general use case model
AC0BI [Tue, 20 Dec 2022 16:54:26 +0000 (09:54 -0700)]
raspberrypi-pico: Comment clean up, support a more general use case model

6 months agoraspberrypi-pico: Rev2 updates
AC0BI [Wed, 13 Apr 2022 03:26:42 +0000 (21:26 -0600)]
raspberrypi-pico: Rev2 updates

6 months agoraspberrypi-pico: Fix serial comm parameters
pico-coder [Mon, 14 Mar 2022 20:57:21 +0000 (14:57 -0600)]
raspberrypi-pico: Fix serial comm parameters

6 months agoraspberrypi-pico: Cleanup whitespace, add a serial_close to api.c scan function
AC0BI [Wed, 2 Mar 2022 04:44:26 +0000 (21:44 -0700)]
raspberrypi-pico: Cleanup whitespace, add a serial_close to api.c scan function

6 months agoraspberrypi-pico: First release of raspberry pi pico driver code
AC0BI [Tue, 1 Mar 2022 15:31:43 +0000 (08:31 -0700)]
raspberrypi-pico: First release of raspberry pi pico driver code

6 months agoraspberrypi-pico: Initial driver skeleton.
AC0BI [Tue, 1 Mar 2022 04:22:47 +0000 (21:22 -0700)]
raspberrypi-pico: Initial driver skeleton.

6 months agorigol-ds: Add DS4014
ldashing [Thu, 20 Jul 2023 21:35:56 +0000 (23:35 +0200)]
rigol-ds: Add DS4014

6 months agotcp: check for poll(2) and select(2), workaround for shutdown(2) API
Gerhard Sittig [Wed, 27 Sep 2023 15:15:02 +0000 (17:15 +0200)]
tcp: check for poll(2) and select(2), workaround for shutdown(2) API

The poll(2) API is not universally available. Check for its presence
before referencing it. Fallback to select(2) in its absence. Check for
the availability of select(2) as well. If neither is available, there
is no (portable) way of checking a file descriptor's readability.

The SHUT_RDWR identifier is not available in winsock. But a different
symbol with identical meaning is available. Use it as a fallback.

This amends commit fcab496c12b2 which introduced common TCP support.

6 months agodevantech-eth008: make request for digital output optional
Gerhard Sittig [Mon, 25 Sep 2023 12:38:58 +0000 (14:38 +0200)]
devantech-eth008: make request for digital output optional

This is for consistency with other optional features like digital input
and analog input. Only transmit digital output related requests to the
firmware when the model supports it.

See whitespace ignoring diff for the essence.

6 months agodevantech-eth008: support digital and analog input channels
Gerhard Sittig [Mon, 25 Sep 2023 12:28:59 +0000 (14:28 +0200)]
devantech-eth008: support digital and analog input channels

Implement support for digital input and analog input on those models
which provide these features beyond digital output (relays).

This was written without access to the hardware, and is untested.

This completes support for the cards' features. Other models (ETH1610)
could get added when their model ID is known. WLAN enabled cards are
assumed to share model IDs with their Ethernet counterparts.

6 months agodevantech-eth008: declare more models, still digital-output only
Gerhard Sittig [Mon, 25 Sep 2023 12:18:55 +0000 (14:18 +0200)]
devantech-eth008: declare more models, still digital-output only

Add the ETH002, ETH484, and ETH8020 items to the list of supported
models. Adjust driver code paths for the differing DO image sizes of
these models (up to 20 relays which span up to three bytes width).
Support the R5..R8 gap for ETH484.

This was written without access to the hardware, and is untested.

6 months agodevantech-eth008: first driver implementation, relay output only
Gerhard Sittig [Sun, 24 Sep 2023 09:05:08 +0000 (11:05 +0200)]
devantech-eth008: first driver implementation, relay output only

Implement common support code to communicate raw binary requests and
responses over TCP sockets, and ETH008 specific requests to control
up to 8 relays as well as getting the card's supply voltage.

Other cards with differing channel counts, and with features beyond
relay control, have not been available during creation of this driver.
Their addition is prepared but untested. Password protection is not
implemented, but outlined in developer comments.

6 months agodevantech-eth008: Initial driver skeleton.
Gerhard Sittig [Sun, 24 Sep 2023 09:04:44 +0000 (11:04 +0200)]
devantech-eth008: Initial driver skeleton.

6 months agoserial: introduce support for raw TCP communication (send/recv bytes)
Gerhard Sittig [Sun, 24 Sep 2023 08:27:31 +0000 (10:27 +0200)]
serial: introduce support for raw TCP communication (send/recv bytes)

Add support for "conn=tcp-raw/<ip>/<port>" specs for serial transports.
This is consistent with previously existing SCPI transports, and is
compatible because there has not been TCP communication outside of SCPI
so far.

This implementation supports blocking mode and attempts to communicate
the very caller specified amount of data. Also suports non-blocking mode
and read timeouts, which can result in short reads.

Support for source add/remove exists, so that receive callbacks can
execute when receive data has become available. Other serial transport
methods are missing. There is no support for bitrate configuration,
flow control, flushing, UART frame formats, etc.

6 months agoscpi_tcp: use common TCP support in SCPI transport (tcp-raw, tcp-rigol)
Gerhard Sittig [Sun, 24 Sep 2023 08:42:00 +0000 (10:42 +0200)]
scpi_tcp: use common TCP support in SCPI transport (tcp-raw, tcp-rigol)

Use the recently added sr_tcp_dev_inst approach to TCP communication in
the tcp-raw and tcp-rigol SCPI transports. Eliminates redundancy in the
implementation.

Address style nits in the process: Use size types for length specs. Be
explicit about bytes and character conversions: Bytes are sent across
the TCP socket, while SCPI exchange typically involves text messages.
The previously used send(2) and recv(2) calls just passed void pointers.

Comment on the specific semantics of Rigol length specs that preceed the
response data. And how raw TCP attempts to determine the completion of a
reception while this length spec is absent. The previous implementation
would not reveal the motivation of this non-trivial logic.

6 months agotcp: introduce common support code for TCP socket communication
Gerhard Sittig [Sun, 24 Sep 2023 08:23:15 +0000 (10:23 +0200)]
tcp: introduce common support code for TCP socket communication

It appears that so far only SCPI and the Beagleboard have supported
communication across TCP sockets. And both have locally open coded
the corresponding logic.

Introduce common support for TCP communication. This implementation
provides simple new/free, connect/disconnect, read/write (including
non-blocking reads), source add/remove calls, and keeps the API under
the sr_tcp_ prefix.

This commit introduces common code, but does not adjust callers.

8 months agoinput/protocoldata: also accept comma separated data values
Gerhard Sittig [Sun, 30 Jul 2023 08:10:12 +0000 (10:10 +0200)]
input/protocoldata: also accept comma separated data values

Frame format specs in the header section accepted space and comma
separators already (though comma separated frame format details are
considered unusual). Protocol values in non-comment (text mode) lines
assumed strictly space separated fields.

Accept comma and semicolon too as data value separators for maximum user
convenience. Simplifies the import of post processed other text formats,
only requires the addition of headers and decoration (select control,
text to number conversion base), but allows re-use of all existing
values. Reduces diffs before and after manipulating original text into
protocoldata which sigrok can import.

These separators silently get ignored. They don't have a meaning in the
sense of interpreting "1, , 3" as three values. There is no concept of
empty fields in the sequence of data values. This is pure convenience.

9 months agoinput/protocoldata: reduce inter-frame gap for I2C waveforms
Gerhard Sittig [Thu, 13 Jul 2023 17:30:02 +0000 (19:30 +0200)]
input/protocoldata: reduce inter-frame gap for I2C waveforms

Space I2C data bytes the same as address bytes are spaced. Results in a
graphical presentation that is easier to inspect, and is less wasteful
at the same time (more data is seen at the same zoom level).

9 months agoinput: alpha-sort list of known input modules
Gerhard Sittig [Sun, 25 Jun 2023 21:53:44 +0000 (23:53 +0200)]
input: alpha-sort list of known input modules

Sort the 'extern' declarations and the input_module_list[] array items.
Does not change behaviour, just simplifies maintenance.

9 months agoinput/protocoldata: add input module for "protocol values" files
Gerhard Sittig [Tue, 14 May 2019 19:27:18 +0000 (21:27 +0200)]
input/protocoldata: add input module for "protocol values" files

Implement an input module which accepts data values that may have been
gotten by arbitrary means (external capture utility, synthesized data),
and creates logic traces which mimic the respective protocol's format.
This pretends that a logic capture had been taken by sigrok means, which
can be fed to protocol decoders. The motivation is neither to perfectly
simulate a given protocol, nor to inject arbitrary error conditions and
edge cases, but instead to make externally provided data available to
sigrok protocol decoders.

The input module supports several user servicable options to describe
raw files which exclusively contain data bytes. Optional automatic file
format detection is also supported, as is an optional file header to
embed protocol properties with the bytes stream. Text formatted input
is supported as a strict alternative to raw data bytes, also supporting
comments as well as pseudo comments. The latter carry instructions to
control some aspects that are outside of the mere stream of data bytes.
Some protocols may exclusively be useful in combination with text input.

Protocol specific handlers can generate up to eight logic channels, an
arbitrary number of bits per protocol frame, including varying bit times
within a frame, and several quanta per bit time. It is assumed that this
implementation provides enough infrastructure to mimic an arbitrary set
of protocols beyond the initially supported set of UART, SPI, and I2C.

9 months agoinput/vcd: use common helpers for text lines/words splitting
Gerhard Sittig [Tue, 4 Jul 2023 16:40:19 +0000 (18:40 +0200)]
input/vcd: use common helpers for text lines/words splitting

Use recently added strutil helpers which isolate text lines in receive
buffers and which locate whitespace separated words on text lines. This
simplifies the processing of the data section of VCD input files.

It's essential to _not_ use these helpers when the receive buffer must
not get manipulated, like in file format matches, or when control data
sections span multiple text lines. Update comments to raise awareness.

9 months agotests: implement strutil tests for text line and word splitting
Gerhard Sittig [Sun, 2 Jul 2023 07:48:57 +0000 (09:48 +0200)]
tests: implement strutil tests for text line and word splitting

Add the test_text_line() and test_text_word() routines to cover the
splitting of text buffers into lines and the splitting of words on a
text line.

This implementation "suffers" from global vars at the file scope,
because moving the table of test cases into the test routine results in
compiler errors (initializer data not constant), the cause is uncertain.

9 months agostrutil: add common helpers for input text parsing (lines, words)
Gerhard Sittig [Sun, 2 Jul 2023 07:39:39 +0000 (09:39 +0200)]
strutil: add common helpers for input text parsing (lines, words)

Introduce the sr_text_next_line() and sr_text_next_word() routines which
split an input buffer into text lines and identify whitespace separated
words on a text line. Several input modules redundantly implement this,
having common support is desirable.

9 months agotests: raise maximum version text length (dirty flag)
Gerhard Sittig [Sun, 2 Jul 2023 07:20:49 +0000 (09:20 +0200)]
tests: raise maximum version text length (dirty flag)

The previous implementation of the version text length check accounted
for the major, minor, micro numbers and the git hash. Raise the upper
limit of the accepted text length range to also account for the optional
"dirty" flag. Update comments to keep awareness of the magic numbers in
the length calculation.

9 months agostrutil: accept 0b prefix when base is 2 (which is non-zero)
Gerhard Sittig [Sun, 25 Jun 2023 20:47:47 +0000 (22:47 +0200)]
strutil: accept 0b prefix when base is 2 (which is non-zero)

The sr_atoul_base() conversion routine only accepted the 0b binary
prefix when base was 0. Extend this to also accept the 0b prefix when
the caller specified base is 2. This unbreaks a valid use case.

11 months agoatorch: Implement support for DC and USB Meters
Mathieu Pilato [Sat, 4 Mar 2023 17:18:46 +0000 (18:18 +0100)]
atorch: Implement support for DC and USB Meters

Tested with ATORCH J7-c USB Meter and ATORCH DL24MP-150W Purple Electronic Load

11 months agoatorch: Initial driver skeleton
Mathieu Pilato [Sat, 4 Mar 2023 17:18:39 +0000 (18:18 +0100)]
atorch: Initial driver skeleton

11 months agobinary_helpers: remove unused u64 and float variants (dead code)
Gerhard Sittig [Sun, 30 Apr 2023 09:02:47 +0000 (11:02 +0200)]
binary_helpers: remove unused u64 and float variants (dead code)

Remove support for uint64_t and float data types in the extraction of
number values from byte streams. These are unused in current mainline.
The larger types even don't fit in the single precision result, the
32bit integer already suffers from precision loss during conversion
to float.