]> sigrok.org Git - libsigrok.git/log
libsigrok.git
3 years agoscpi-dmm: Add support for Owon XDM2041
Petteri Aimonen [Sun, 28 Feb 2021 13:34:40 +0000 (15:34 +0200)]
scpi-dmm: Add support for Owon XDM2041

3 years agoscpi-dmm: Gracefully handle meters that lack OPC command.
Petteri Aimonen [Sun, 28 Feb 2021 13:32:08 +0000 (15:32 +0200)]
scpi-dmm: Gracefully handle meters that lack OPC command.

The SCPI standard requires OPeration Complete command,
but some Owon meters do not implement it. This commit
makes the probe try OPC once, and if it gets no reply
it assumes it is not supported.

3 years agoscpi-dmm: Add infinity limit to model-specific config.
Petteri Aimonen [Sun, 28 Feb 2021 13:28:55 +0000 (15:28 +0200)]
scpi-dmm: Add infinity limit to model-specific config.

Owon multimeters seem otherwise compatible with gwinstek reader,
except infinity is only 1e9.

3 years agoscpi-pps: Add support for Owon P4000 series.
Petteri Aimonen [Sun, 28 Feb 2021 13:25:21 +0000 (15:25 +0200)]
scpi-pps: Add support for Owon P4000 series.

Tested on P4603 firmware version 1.6.0.

3 years agohantek-6xxx: Add ISDS205B support
litospain [Sat, 11 Apr 2020 20:27:15 +0000 (22:27 +0200)]
hantek-6xxx: Add ISDS205B support

3 years agohantek-6xxx: Fix for channel coupling not updating on changing
waka [Fri, 17 Jul 2020 20:28:06 +0000 (22:28 +0200)]
hantek-6xxx: Fix for channel coupling not updating on changing

Presumed regression related to fix for bug #836

3 years agozketech-ebd-usb: Don't ignore errors
Florian Ragwitz [Sun, 29 Nov 2020 02:19:24 +0000 (18:19 -0800)]
zketech-ebd-usb: Don't ignore errors

3 years agobeaglelogic: Fix resource leak
Florian Ragwitz [Sun, 29 Nov 2020 02:18:35 +0000 (18:18 -0800)]
beaglelogic: Fix resource leak

3 years agohantek-dso: fix 100MS/s
Alberto Scotta [Sat, 5 Dec 2020 15:05:51 +0000 (16:05 +0100)]
hantek-dso: fix 100MS/s

Do not downsample at 100MS/s.
The device actually sampled at (100.0/0x1000)MS/s when 100MS/s was set.

3 years agorigol-ds: Add DS1102Z-E model variant
HReimann [Sat, 23 Jan 2021 15:44:04 +0000 (16:44 +0100)]
rigol-ds: Add DS1102Z-E model variant

3 years agopython bindings: Support passing in rational voltages for config_set
Richard Allen [Tue, 26 Jan 2021 06:27:09 +0000 (00:27 -0600)]
python bindings: Support passing in rational voltages for config_set

3 years agogwinstek-gpd: Fix voltage/current measurement
Richard Allen [Sat, 16 Jan 2021 22:24:50 +0000 (16:24 -0600)]
gwinstek-gpd: Fix voltage/current measurement

3 years agogwinstek-gpd: Support auto-baud detection
Richard Allen [Sat, 16 Jan 2021 19:47:38 +0000 (13:47 -0600)]
gwinstek-gpd: Support auto-baud detection

If the user does not specify a serialcomm configuration,
try all three options from the manual.

3 years agogwinstek-gpd: Retry device identification on failure
Richard Allen [Sat, 16 Jan 2021 19:31:31 +0000 (13:31 -0600)]
gwinstek-gpd: Retry device identification on failure

Try the identification command up to three times
if the device responds with 'Invalid Character.',
which can happen if the device has buffered part
of a command but not executed it.

3 years agogwinstek-gpd: Print serialcomm config
Richard Allen [Sat, 16 Jan 2021 18:35:35 +0000 (12:35 -0600)]
gwinstek-gpd: Print serialcomm config

3 years agoscpi-pps: add R&S HMP2000 model specs
Gerhard Sittig [Tue, 2 Feb 2021 20:09:54 +0000 (21:09 +0100)]
scpi-pps: add R&S HMP2000 model specs

Re-use HMP4000 options and channel groups, only keep separate channel
specs for HMP2000 devices. HMP2030 has three identical 32V/5A channels.
HMP2020 has one 10A channel and one 5A channel.

3 years agoscpi-pps: adjust R&S HMP4000 current resolution for 10A channels
Gerhard Sittig [Tue, 2 Feb 2021 20:07:29 +0000 (21:07 +0100)]
scpi-pps: adjust R&S HMP4000 current resolution for 10A channels

Specs published by R&S suggest that 10A channels support 0.2mA resolution,
while only 5A channels resolve to 0.1mA (up to 1A full scale, 1mA above 1A).

3 years agools: Clean up: Replace hand-rolled byte order conversion with existing macros
v1ne [Tue, 31 Mar 2020 22:29:05 +0000 (00:29 +0200)]
ols: Clean up: Replace hand-rolled byte order conversion with existing macros

3 years agools: Refactor: Extract trigger setup into private place
v1ne [Wed, 1 Apr 2020 03:35:02 +0000 (05:35 +0200)]
ols: Refactor: Extract trigger setup into private place

This copies the code verbatim from one place to another in preparation to adding
support for complex triggers.

3 years agools: Make external clock setting queriable
v1ne [Tue, 31 Mar 2020 22:05:37 +0000 (00:05 +0200)]
ols: Make external clock setting queriable

... and thus selectable in PulseView.

3 years agools: Add option to use the falling edge of the external clock
v1ne [Tue, 31 Mar 2020 18:29:48 +0000 (20:29 +0200)]
ols: Add option to use the falling edge of the external clock

3 years agools: Clear "disabled groups" flags before setting them
v1ne [Tue, 31 Mar 2020 18:21:47 +0000 (20:21 +0200)]
ols: Clear "disabled groups" flags before setting them

This fixes a bug where the channel group setting would not be overwritten in a
new run, but instead the channel group settings of both runs would be merged
together.

3 years agools: Display actual expanded sample instead of the raw sample
v1ne [Wed, 1 Apr 2020 14:15:36 +0000 (16:15 +0200)]
ols: Display actual expanded sample instead of the raw sample

While the raw sample is the actual received data, the expanded sample is the
crucial data I as a developer am interested in seeing. At least if I assume that
the sample expansion works.

3 years agools: Clean up: Prefix private function for consistency
v1ne [Wed, 18 Nov 2020 22:54:46 +0000 (23:54 +0100)]
ols: Clean up: Prefix private function for consistency

3 years agodoc: update README.devices for Meterman 38XR (RS232 button)
Gerhard Sittig [Tue, 5 Jan 2021 17:17:45 +0000 (18:17 +0100)]
doc: update README.devices for Meterman 38XR (RS232 button)

3 years agodmm/mm38xr: introduce DMM packet parser for Meterman 38XR
Peter Skarpetis [Mon, 4 Jan 2021 04:59:23 +0000 (15:59 +1100)]
dmm/mm38xr: introduce DMM packet parser for Meterman 38XR

Introduce a DMM packet parser in src/dmm/ and register it with the
serial-dmm device driver. This adds support for the Meterman 38XR
multimeter.

[ gsi: style adjustment, raise awareness during maintenance ]

3 years agoserial-dmm: move Mastek items after Metex in the model database
Gerhard Sittig [Tue, 5 Jan 2021 07:10:21 +0000 (08:10 +0100)]
serial-dmm: move Mastek items after Metex in the model database

Keep the alpha-sort order in the list of supported chips and models.

3 years agoarachnid-labs-re-load-pro: Fix for get voltage and current while in acquisition.
Frank Stettner [Mon, 4 Jan 2021 13:36:18 +0000 (14:36 +0100)]
arachnid-labs-re-load-pro: Fix for get voltage and current while in acquisition.

[ gsi: moved intruction order to unify with other cond signalling code paths ]

3 years agodmm/bm52x: unbreak build when serial comm is not available
Gerhard Sittig [Tue, 29 Dec 2020 17:31:38 +0000 (18:31 +0100)]
dmm/bm52x: unbreak build when serial comm is not available

Make another code path in the Brymen BM52x packet parser optional which
snuck in earlier and broke compilation when serial_comm dependencies are
not met.

Ideally the src/dmm/ parser code would not get built at all in that
case, but building a parser with reduced functionality and not using it
later because its callers are conditional is as good, and is what other
DMM packet parsers did in the past.

How to reproduce:

  $ configure --without-libserialport --without-libhidapi --without-libbluez
  $ make

3 years agofx2lafw: Unbreak SR_CONF_LIMIT_SAMPLES for large values (above 2**32)
Ralf [Tue, 15 Dec 2020 19:02:37 +0000 (20:02 +0100)]
fx2lafw: Unbreak SR_CONF_LIMIT_SAMPLES for large values (above 2**32)

Capture does not stop for sample count values which exceed the range of
a 32bit type variable. Adjust the data type to 64bit.

How to reproduce: 8MSa/s * 600s -> 4,800,000,000 samples

  $ sigrok-cli -d fx2lafw -o capture.sr --config samplerate=8M --time 600000

[ gsi: rephrased the commit message ]

3 years agoftdi-la: work around missing USB strings during device probe
Gerhard Sittig [Fri, 25 Dec 2020 11:47:01 +0000 (12:47 +0100)]
ftdi-la: work around missing USB strings during device probe

Some FTDI chip based products ship with EEPROM content which makes
libftdi fail to lookup the USB strings, which breaks the scan for the
device's presence. The previous implementation was strict and only
accepted the absence of a serial number. This implementation also copes
when vendor and model cannot be gathered from the device, and provides
fallback values based on VID:PID numbers.

Also factor out a magic number for string lengths. Stick with dynamic
allocation since 3x 32bytes would be rather huge a local stack use, and
future maintenance might bump that string length again.

[ gsi: magic number in one spot, bounded string assignment, style nits ]

Submitted-By: Christo Crause <redacted>
3 years agoasix-sigma: parse serial numbers as unsigned values
Niklas Thorne [Tue, 17 Nov 2020 11:55:26 +0000 (12:55 +0100)]
asix-sigma: parse serial numbers as unsigned values

This unbreaks device detection on 32bit platforms.

3 years agostrutil: introduce sr_atoul_base() conversion helper (non-decimal)
Niklas Thorne [Tue, 17 Nov 2020 11:55:26 +0000 (12:55 +0100)]
strutil: introduce sr_atoul_base() conversion helper (non-decimal)

Introduce a text to number conversion routine which supports non-decimal
bases and optional suffixes, but returns unsigned results and thus covers
a larger range of values. This kind of amends commit 97aa41e9b59c which
introduced the sr_atol_base() routine.

3 years agodriver_list: unbreak list of builtin drivers for LTO configurations
Gerhard Sittig [Tue, 3 Nov 2020 17:25:18 +0000 (18:25 +0100)]
driver_list: unbreak list of builtin drivers for LTO configurations

Check for the availability of the "no_reorder" linker attribute, which
keeps the list of builtin drivers in shape on LTO enabled build setups.
Keep backwards compatibility for platforms which lack support for the
"no_reorder" attribute. Phrase the implementation such that other
keywords as well as user provided external specs are possible.

This resolves bug #1433.

Submitted-By: Ivan Mironov <redacted>
3 years agolibsigrok-internal.h: add u64be endianess writer
Gerhard Sittig [Mon, 26 Oct 2020 18:48:22 +0000 (19:48 +0100)]
libsigrok-internal.h: add u64be endianess writer

Add endianess aware writer for uint64_t data in BE format. This is
motivated by the Codethink Interrogizer.

3 years agoserial-dmm: add support for the Brymen BM820s family
Gerhard Sittig [Wed, 30 Sep 2020 07:59:32 +0000 (09:59 +0200)]
serial-dmm: add support for the Brymen BM820s family

The BM820s series uses the same 10000 counts protocol as BM520s does,
but lacks the capability of recording measurements. Re-use the bm52x
DMM packet parser, but don't register the config get/set/list and
acquisition start callbacks.

It turns out that the packet request and packet validity check routines
need to be individual, since 0x82 is used instead of 0x52 as a magic
number in some places. Fortunately the complex payload parser is shared
among BM520s and BM820s series. This was tested with a BM829s meter.

3 years agodmm/bm52x: add support for recorded measurements (memory data sets)
Gerhard Sittig [Thu, 24 Sep 2020 21:01:26 +0000 (23:01 +0200)]
dmm/bm52x: add support for recorded measurements (memory data sets)

Extend the BM52x packet parser, add config get/set/list code to handle
the data source property. Either let the common serial-dmm code run the
acquisition of live readings, or locally retrieve the selected "session
page" and forward its measurements to the session bus. These separate
code paths are required because the protocol differs a lot between these
modes, a totally different set of requests and responses is involved,
response interpretation logic is impossible to share between live and
recorded measurements.

3 years agobrymen-dmm: remove obsolete driver (support has moved to serial-dmm)
Gerhard Sittig [Thu, 24 Sep 2020 19:50:37 +0000 (21:50 +0200)]
brymen-dmm: remove obsolete driver (support has moved to serial-dmm)

The DMM support for Brymen BM850s has moved to src/dmm/ and became
part of the serial-dmm driver. Remove the now obsolete brymen-dmm/
source code.

3 years agodmm/bm85x: introduce DMM packet parser for Brymen BM850(a/s)
Gerhard Sittig [Thu, 24 Sep 2020 19:45:51 +0000 (21:45 +0200)]
dmm/bm85x: introduce DMM packet parser for Brymen BM850(a/s)

Implement a DMM packet parser for the BM850s protocol. This involves
variable length responses, which recently became a common serial-dmm
feature. Register the new parser under the "brymen-bm85x" device name.
This obsoletes the brymen-dmm driver which announces as "brymen-bm857".
This implementation was tested with the BM859s meter.

The text to number conversion with precision detection resolves the
last remaining issue of bug #1611.

3 years agostrutil: add text to float conversion which also gets precision from text
Gerhard Sittig [Thu, 24 Sep 2020 19:18:21 +0000 (21:18 +0200)]
strutil: add text to float conversion which also gets precision from text

Provide a common string helper routine which converts input text to a
double precision floating point number, and also gets its precision in
the process.

3 years agoserial-dmm: more DMM parser callbacks (open, var length, config, start)
Gerhard Sittig [Thu, 24 Sep 2020 14:33:20 +0000 (16:33 +0200)]
serial-dmm: more DMM parser callbacks (open, var length, config, start)

Extend the serial-dmm driver's common infrastructure to support more
per-parser (per-model) specific extensions. Add support for variable
length packets (motivated by BM85x), and pass the packet length to
parsers which accept it. Add callbacks which run after the COM port got
opened (motivated by BM85x). Add support for additional configuration
get/set/list properties (motivated by BM52x), including a hook into the
acquisition start and a state container which is owned by the parser.

Device specific acquisition start can check its local state which can
store the result of previous config get/set requests, and can arrange
for a different receive routine to execute (motivated by BM52x). The
default code path will execute serial-dmm's receive routine which keeps
invoking the DMM's packet parser for each registered display.

Prefer double precision values in the new parser callbacks. Also fixup
some data type issues: Use unsigned types for length and size specs as
well as timeouts, don't promote false booleans to NULL pointers, reduce
malloc() argument redundancy. Rephrase some instruction grouping and
update comments to simplify future maintenance. Get the current time
just once for improved consistency in the packet re-request code path.
Rename identifiers in the data reception path to improve readability.

3 years agoserial: extend stream detect for variable length packet checkers
Gerhard Sittig [Thu, 24 Sep 2020 14:29:06 +0000 (16:29 +0200)]
serial: extend stream detect for variable length packet checkers

The previous implementation of the packet detection in a serial stream
assumed that all packets are of equal length which is known in advance.
Extend the packet validity check interface such that caller provided
callbacks can either decide that the input is valid or invalid (terminal
decision), or request more receive data before a decision can be made
(deferral, coverring variable length packets, with a minimum size to
cover the header before a length becomes available and the total packet
length is known).

This commit extends the API, and adjusts the call sites to not break the
compilation. Actual variable length checkers are yet to be done. Improve
readability while we are here: Better reflect the purpose and units of
variables in their identifiers. Tweak diagnostics messages, update
inline and doxygen comments.

3 years agoinput/vcd: fix a divide by zero bug in the analog-only case
Gerhard Sittig [Thu, 22 Oct 2020 17:27:06 +0000 (19:27 +0200)]
input/vcd: fix a divide by zero bug in the analog-only case

When the input data exclusively contained analog data, then creation of
the submit buffer for logic data caused a division by zero. Fix the
create_feed() routine.

3 years agoinput/vcd: suggest downsampling to users for reduced resource consumption
Gerhard Sittig [Sat, 17 Oct 2020 10:16:49 +0000 (12:16 +0200)]
input/vcd: suggest downsampling to users for reduced resource consumption

Naive creation of VCD files with inappropriately fine timescale specs
results in excessive resource consumption due to libsigrok's assumption
of a constant rate stream of sample data. A workaround is available and
documented, but users need to become much more aware.

Implement a reliable check for wasteful input data situations which
depends on the reception of _all_ input data, and can only alert users
late after potentially spending lots of time and assuming that available
resources allow completion of the import. Users could miss that check's
outcome.

Also implement early checks which (necessarily) are based on weaker
conditions, to already raise user's awareness while data import still is
executing. Phrase these early checks as computationally inexpensive as
possible, to not affect the main task of data import too much. Avoid
false positives by balancing the desire for early emission of messages
and picking appropriate conditions to test for.

This commit implements the foundation for early estimates and reliable
terminal checks, as well as the emission of messages which support users
and allow a more effective use of the file format. The specific limits
and tested conditions still may benefit from more tuning in the future.

The input module logic in this commit emits an information for harmless
cases, and emits warnings for "severe" cases where default option values
or incomplete user specs result in several orders of magnitude higher
resource consumption than necessary. GUI users may not notice, but the
library cannot help that given the current infrastructure -- the library
stricly does as the application tells it to, according to user input.

The best use is to run the CLI's --show feature on VCD files of unknown
content, to get an idea how to most appropriately configure a subsequent
file import. An alternative is to open the VCD file before import, check
the timescale in the header and the last two timestamps, to get an rough
estimate of a useful downsample factor.

This is motivated by but does not resolve bug 1624.

3 years agoinput/vcd: unbreak U and - values for single bit input data
Gerhard Sittig [Sat, 17 Oct 2020 08:42:56 +0000 (10:42 +0200)]
input/vcd: unbreak U and - values for single bit input data

The previous implementation already mapped L/H/U/- literals for input
data values to the 0/1/0/0 logic levels which sigrok can handle. But
missed these literals in the condition which dispatches real/integer,
bit vector, and single bit data types. Which made VCD import fail for
some of the files in the SpinalWorkshop repo.

Extend the test condition for single bit values. This unbreaks the
import of the Apb3TimerTester.vcd and ApbPwmTester.vcd files, which
contained phrases like these:

  ...
  $var reg 1 % io_apb_pwrite $end
  ...
  #0
  bUUUUUUUU !
  b0 "
  0#
  1$
  U%

and

  ...
  $var reg 8 # io_apb_paddr[7:0] $end
  $var reg 1 $ io_apb_pwrite $end
  ...
  #0
  b0 !
  0"
  b-------- #
  -$
  b-------------------------------- %
  b00000000000000000000000000000000 &
  1'

3 years agoconfigure: Add optional TI-RPC dependency, unbreak VXI communication.
Soeren Apel [Sun, 26 Jul 2020 15:11:37 +0000 (17:11 +0200)]
configure: Add optional TI-RPC dependency, unbreak VXI communication.

Recent glibc-2.26 no longer provides support for SunRPC, and libsigrok's
build support failed to detect the presence of libtirpc in that case.

  https://wiki.gentoo.org/wiki/Glibc_2.26_porting_notes/RPC_implementation

Extend the check, use either SunRPC or TI-RPC. Which re-enables VXI on
recent setups. This resolves bug #1473.

3 years agorigol-dg: Add device/firmware specific quirks support.
Timo Kokkonen [Mon, 5 Oct 2020 09:04:57 +0000 (02:04 -0700)]
rigol-dg: Add device/firmware specific quirks support.

DG800/DG900 units seems to have issues with counter implementation:
- About 1 second delay is needed after enabling or disabling the counter.
  Otherwise unit stops responding properly (start seeing USB errors).
- Second channel and counter cannot be enabled simultaneously.

3 years agoitech-it8500: avoid "new" as a variable identifier
Gerhard Sittig [Tue, 6 Oct 2020 17:26:36 +0000 (19:26 +0200)]
itech-it8500: avoid "new" as a variable identifier

Strictly speaking the "new" identifier is not a reserved word. Still
it's good practice not to use it for variables in C language sources.
Rename variables to "old_bit" and "new_bit" for consistency.

3 years agoitech-it8500: declaration nits
Gerhard Sittig [Tue, 6 Oct 2020 17:18:42 +0000 (19:18 +0200)]
itech-it8500: declaration nits

Rearrange the order of declarations in the protocol.h header. Start with
packet layout, continue with requests (commands), then responses (status),
before the device context and the set of routines.

Rename the status codes to STS_* in contrast to CMD_* codes. Use an enum
for different byte values, leave defines for packet sizes et al. Phrase
bit fields in terms of bit numbers not byte values.

Total nit: Change the breaks in the long list of add_source() args. Keep
event type and timeout together, similar to callback and its data.

3 years agoitech-it8500: rephrase config get/set/list, reflect error paths
Gerhard Sittig [Tue, 6 Oct 2020 17:13:34 +0000 (19:13 +0200)]
itech-it8500: rephrase config get/set/list, reflect error paths

Explicitly "break the flow" when internal status gathering fails, to
reflect that an error path is taken and the config call will fail. The
conditional assignment of response data in case of success could be
slightly misleading (it was to me during review).

Eliminate a goto which kind of circumvented the optional transmission of
a request to the device. Instead test whether a command was filled in to
determine whether a command needs to get sent.

3 years agoitech-it8500: ITECH IT8500 series DC electronic load driver.
Timo Kokkonen [Sat, 30 May 2020 23:03:26 +0000 (16:03 -0700)]
itech-it8500: ITECH IT8500 series DC electronic load driver.

This driver supports ITECH IT8500 series electronic loads:
 IT8511+, IT8511A+,
 IT8512+, IT8512A+, IT8512B+, IT8512C+, IT8512H+,
 IT8513A+, IT8513B+, IT8513C+, IT8514C+, IT8514B+, IT8516C+

Additionally BK Precision 8500 series loads (models 8500, 8502, 8510,
8512, 8514, 8518, 8520, 8522, 8524 & 8526) should work as well.
As ITECH is the OEM manufacturer for these BK Brecision models.

3 years agoitech-it8500: Initial driver skeleton.
Timo Kokkonen [Fri, 29 May 2020 08:43:35 +0000 (01:43 -0700)]
itech-it8500: Initial driver skeleton.

3 years agohwdriver: New entries for DC Load "CW" (Power) and "CR" (Resitance) modes.
Timo Kokkonen [Mon, 5 Oct 2020 04:03:19 +0000 (21:03 -0700)]
hwdriver: New entries for DC Load "CW" (Power) and "CR" (Resitance) modes.

Added following new entries:
- SR_CONF_POWER
- SR_CONF_POWER_TARGET
- SR_CONF_RESISTANCE_TARGET

3 years agodmm/metex14: unbreak packet request helper return code
Gerhard Sittig [Tue, 6 Oct 2020 18:59:27 +0000 (20:59 +0200)]
dmm/metex14: unbreak packet request helper return code

Return SR_OK in case of successful transmission of a packet request. The
previous implementation passed the serial layer's verbatim return value,
which was non-negative non-null (read: above zero) in case of success,
which is none of the expected return codes of a packet request routine.

This amends commit 379e95c587e1d and completes the adjustment which was
started in commit a4be2b327be8. The issue has gone unnoticed in the past
since it took not effect. The serial-dmm caller only tested for negative
return values.

3 years agoREADME.devices: add JTAGulator section for Logic Analyzer mode
Gerhard Sittig [Tue, 6 Oct 2020 18:32:04 +0000 (20:32 +0200)]
README.devices: add JTAGulator section for Logic Analyzer mode

Manual activity is required to enable the SUMP protocol support on the
JTAGulator. Link to the vendor's wiki article for users' convenience.

3 years agoinput/csv: trim cell content before conversion
Gerhard Sittig [Sun, 4 Oct 2020 17:48:42 +0000 (19:48 +0200)]
input/csv: trim cell content before conversion

Trailing whitespace in CSV cells broke the text to number conversion.
Trim the text content of cells before processing it. This is useful and
actually essential for data cells, and does not harm titles in header
lines, neither will it affect column format specs.

How to reproduce:

  $ echo ' 3.14 , 2' | \
    sigrok-cli -i - -I csv:header=false:column_formats=2a
  sr: input/csv: Cannot parse analog text  3.14  in column 1 in line 1.

3 years agorigol-dg: Fix reading current output signal duty cycle value.
Timo Kokkonen [Sat, 3 Oct 2020 23:35:10 +0000 (16:35 -0700)]
rigol-dg: Fix reading current output signal duty cycle value.

Reading output signal duty cycle value didn't always work, since it relied
on old (cached) information about the currently active waveform. Changed to
always query channel status so this won't happen anymore.

3 years agorigol-dg: Add Rigol DG800 and DG900 series support.
Timo Kokkonen [Sat, 3 Oct 2020 23:20:31 +0000 (16:20 -0700)]
rigol-dg: Add Rigol DG800 and DG900 series support.

This adds support for all Rigol DG800/DG900 series models.

DG800 series: DG811, DG812, DG821, DG822, DG831, DG832
DG900 series: DG952, DG972, DG992

3 years agoudev: Add Rigol DG800 and DG900 series VID/PID.
Timo Kokkonen [Sat, 3 Oct 2020 23:18:35 +0000 (16:18 -0700)]
udev: Add Rigol DG800 and DG900 series VID/PID.

3 years agopce-322a: unbreak send_command() return code
Gerhard Sittig [Fri, 2 Oct 2020 09:18:57 +0000 (11:18 +0200)]
pce-322a: unbreak send_command() return code

Data was sent to the serial port, and the non-zero positive write length
was mistaken as an error, since it did not match the SR_OK code's value.
This snuck in with commit 379e95c587e1d in 2017-08.

Rephrase the check for successful serial writes in the pce-322a driver.
Pass on error codes from the serial layer in verbatim form. Check for
the exact expected write length and derive SR_ERR_IO upon mismatch. Do
return SR_OK upon success.

Reported-By: Michael Ströder <redacted>
Tested-By: Michael Ströder <redacted>
3 years agorigol-dg: reduce redundancy in malloc() calls
Gerhard Sittig [Sun, 27 Sep 2020 10:09:47 +0000 (12:09 +0200)]
rigol-dg: reduce redundancy in malloc() calls

No need to duplicate the data type, just allocate enough memory to
hold the variable's value. Shuffle the order of items in the array
size calculation (number of items times the size of an item).

3 years agoudev: Add Rigol DG1000z Series VID/PID.
Timo Kokkonen [Mon, 31 Aug 2020 06:22:00 +0000 (23:22 -0700)]
udev: Add Rigol DG1000z Series VID/PID.

3 years agorigol-dg: Initial Rigol DG1000z driver implementation.
Timo Kokkonen [Sun, 6 Sep 2020 05:06:30 +0000 (22:06 -0700)]
rigol-dg: Initial Rigol DG1000z driver implementation.

This implements support for Rigol DG1000z series digital signal
generators. Driver provides basic control via channel groups
("1", and "2"). Acquisition returns data from the built-in
frequency counter.

Supported models: DG1022Z, DG1032Z, DG1062Z

[ gsi: added some coding style adjustment ]

3 years agorigol-dg: Initial driver skeleton.
Timo Kokkonen [Sat, 29 Aug 2020 19:05:12 +0000 (12:05 -0700)]
rigol-dg: Initial driver skeleton.

3 years agohwdriver: Add SR_CONF_DUTY_CYCLE & SR_CONF_PHASE.
Timo Kokkonen [Sat, 29 Aug 2020 19:37:46 +0000 (12:37 -0700)]
hwdriver: Add SR_CONF_DUTY_CYCLE & SR_CONF_PHASE.

3 years agoscpi: accept numbers like 4.0000E3 as integer value
Ralf [Tue, 25 Aug 2020 06:19:18 +0000 (08:19 +0200)]
scpi: accept numbers like 4.0000E3 as integer value

MSO5000 returns memory depth value in that format, e.g.
sr: [04:21.491949] scpi_vxi: Successfully sent SCPI command: 'ACQ:MDEP?'.
sr: [04:21.501463] scpi: Got response: '4.0000E+03', length 10.

[ gsi: drop redundant assignment and parens, amend diag message ]

3 years agoserial: lower severity of failed stream detect message
Gerhard Sittig [Sun, 27 Sep 2020 06:01:44 +0000 (08:01 +0200)]
serial: lower severity of failed stream detect message

Reduce the message's log level from ERR to INFO when the serial stream
detect routine cannot find a valid packet. Although an error code gets
returned, the condition need not be fatal (can be the result of trying
several peers before success or finally giving up). Let callers decide
on the severity of failure to detect a specific device's presence, and
provide more context in their message which is more helpful to users.
Interested readers still get the message at slightly raised log levels.

This avoids confusing user perceivable situations like these:

  $ sigrok-cli --scan
  sr: serial: Didn't find a valid packet (read 0 bytes).
  sr: serial: Didn't find a valid packet (read 0 bytes).
  The following devices were found:
  demo - Demo device with 13 channels: D0 D1 D2 D3 D4 D5 D6 D7 A0 A1 A2 A3 A4

3 years agools: more robust device reset in acquisition stop
Gerhard Sittig [Sun, 27 Sep 2020 05:50:14 +0000 (07:50 +0200)]
ols: more robust device reset in acquisition stop

Use the existing ols_send_reset() routine because acquisition
termination can get initiated in several code paths. Make sure the
device will cease activity whatever state it happens to be in. This
amends commit 6d8182b643ae.

3 years agools: send CMD_RESET on acquisition stop
Ben Gardiner [Tue, 22 Sep 2020 03:27:40 +0000 (03:27 +0000)]
ols: send CMD_RESET on acquisition stop

Sending CMD_RESET will interrupt armed/untriggered acquisitions which is
very useful in Pulseview sessions since, without this, a next 'run' will
hang.

Signed-off-by: Ben Gardiner <redacted>
3 years agobrymen-dmm: unbreak dBm reference impedance interpretation
Gerhard Sittig [Mon, 21 Sep 2020 19:08:27 +0000 (21:08 +0200)]
brymen-dmm: unbreak dBm reference impedance interpretation

The reference impedance for dBm measurements comes in an unexpected
format. Isolate the 4..1200 Ohms value, ignore the (inappropriate?)
"0." and exponent parts of the response. Clearly reflect that Ohms
values are seen in different contexts (dBm reference, continuity,
resistance).

Reword comments in the BM850 response parser's code path for dBm
measurements. The reference value is shown when the function is entered
(verified here) or when the reference value changes (haven't seen this
here but a comment in the previous implementation said so).

3 years agobrymen-dmm: unbreak temperature response parsing
Gerhard Sittig [Mon, 21 Sep 2020 18:32:21 +0000 (20:32 +0200)]
brymen-dmm: unbreak temperature response parsing

The BM850s temperature function response includes the C/F unit in an
unexpected position ("0.0272CE+3") which breaks number conversion. Drop
the C/F unit to unbreak the conversion.

This was observed with BM859s. Absence of the C/F unit in the response
is fatal in this implementation. If other meter firmware versions or
models don't suffer from that issue, the removal must be silent and
non-fatal.

3 years agobrymen-dmm: rephrase bfunc and value text parsing
Gerhard Sittig [Mon, 21 Sep 2020 18:20:13 +0000 (20:20 +0200)]
brymen-dmm: rephrase bfunc and value text parsing

When the BM850s response packet's payload gets interpreted, the DLE/STX
transport envelope is not of interest. Rephrase the bitfield inspection
to better reflect that 'bfunc' indicators get accessed (match the vendor's
documentation). Rephrase the calling parse routine to unobfuscate the text
field access. Unclutter assignments for the analog feed. Use a shorter
layout in debug messages, reflect raw input data and conversion results.

3 years agobrymen-dmm: improve text to number conversion robustness, signed OL
Gerhard Sittig [Mon, 21 Sep 2020 17:57:32 +0000 (19:57 +0200)]
brymen-dmm: improve text to number conversion robustness, signed OL

The BM850(a/s) response packets are a mix of binary and text content.
The text part of it is _not_ a regular ASCIIZ string. Enforce the NUL
termination before running standard C library string routines on it.
Rephrase the conversion routine to become more C idiomatic.

Also check the optional sign for overflow conditions, return either
positive or negative infinity as a result.

3 years agobrymen-dmm: style nits, apply comm param defaults, low battery warning
Gerhard Sittig [Sun, 20 Sep 2020 07:33:35 +0000 (09:33 +0200)]
brymen-dmm: style nits, apply comm param defaults, low battery warning

Rephrase how the default serial communication parameters get applied.
Preset the variable to the default value and let optional user provided
specs override these. This avoids an extra check which is difficult to
read and highly redundant. Add a comment for raised awareness that a
default port spec is undesirable because it's unreliable.

Raise the severity of low battery messages. It's worth warning the user
because measurements could be inaccurate.

Reduce indentation in continuation lines of a long routine signature,
and drop an empty line in a short struct while we are here.

3 years agobrymen-dmm: unbreak BM85x communication by pulsing RTS after COM port open
Gerhard Sittig [Sun, 20 Sep 2020 07:23:45 +0000 (09:23 +0200)]
brymen-dmm: unbreak BM85x communication by pulsing RTS after COM port open

Either the Brymen meters in the BM850s series or their cables require an
RTS pulse to wakeup, without it there won't be a response during scan or
when requesting measurements. Follow the vendor's documented sequence for
a low RTS pulse after opening the serial port and before communication to
the device.

This fixes bug #1595.

Reported-By: Karl Palsson <redacted>
3 years agoserial: add routine to manipulate handshake state (RTS, DTR)
Gerhard Sittig [Sun, 20 Sep 2020 07:14:01 +0000 (09:14 +0200)]
serial: add routine to manipulate handshake state (RTS, DTR)

Introduce a routine in libsigrok's internal serial layer which lets
applications manipulate the state of handshake signals (RTS and DTR)
after the serial port got opened and configured. This allows for timed
pulses which cannot get expressed with static "rts=1" etc phrases in
parameter strings, and allows handshake signal control while leaving
bitrate and frame format untouched. Applications specify which signals
to modify while other signals remain as they are (ternary input).

Do implement the signal manipulation in the libserialport transport,
do nothing and silently pass in the HID and BT transports. These can
get extended later as the need arises, depending on the HID chips' and
RFCOMM peers' capability to control these signals. This extension is
transparent to application code (acquisition device drivers).

3 years agoserial: rephrase check for speed (bitrate) in parameter string routine
Gerhard Sittig [Sun, 20 Sep 2020 07:38:45 +0000 (09:38 +0200)]
serial: rephrase check for speed (bitrate) in parameter string routine

Use positive logic, put the error path for an unavailable value where
the check for its availability is. Do the regular activity on available
values in the straight code path with lesser indentation. Also group the
bitrate, frame format, and handshake params when breaking text lines.

3 years agodmm/bm52x: introduce support for Brymen BM525s
Gerhard Sittig [Wed, 16 Sep 2020 19:25:33 +0000 (21:25 +0200)]
dmm/bm52x: introduce support for Brymen BM525s

Introduce a bm52x DMM packet parser which is modelled after the bm86x
implementation, and hook it up to the serial-dmm driver. This supports
the live readings (real-time download) of the Brymen BM525s logging DMM.
The timing follows the vendor documentation (0.5s between requests, and
4.0s absolute timeout after request transmission). Reading previously
recorded data (memory data sets) unfortunately does not fit well into
the serial-dmm approach, and needs to get addressed differently later.

3 years agoserial-dmm: only do bytes to text conversion at higher log levels
Gerhard Sittig [Fri, 18 Sep 2020 14:38:54 +0000 (16:38 +0200)]
serial-dmm: only do bytes to text conversion at higher log levels

Check the current log level before starting the potentially expensive
bytes to text conversion for a debug message (dump DMM packets).

3 years agoinput/csv: provide double precision values to session feed
Gerhard Sittig [Sun, 13 Sep 2020 14:35:59 +0000 (16:35 +0200)]
input/csv: provide double precision values to session feed

Common conversion support code accepts double precision input data for
analog packets. Use the 'double' data type in the CSV input module to
feed sample data to the session bus.

3 years agoanalog.c: rephrase analog feed to float conversion routine
Gerhard Sittig [Sun, 13 Sep 2020 06:34:45 +0000 (08:34 +0200)]
analog.c: rephrase analog feed to float conversion routine

Rephrase the sr_analog_to_float() routine to further reduce redundancy.

Check early for a match of the input data and result format, to grab the
raw data without conversion in that case. Handle optional scale/offset
calculation in that fast code path, too.

Unify the instructions which convert input data from either integer or
floating point presentations to the result format. Use common stream
readers to retrieve input data in several formats, which eliminates
local conversion buffers. Move common sub-expressions (scale/offset) out
of loops. Run more calculations on double precision data before results
get trimmed to single precision.

Add and extend comments to improve future maintenance. Include (terse)
details of unsupported input data presentations in error messages.

This implementation was neither tuned nor measured for performance.
There still is a lot of redundancy among the branches which handle a
specific input data type. Rephrasing that approach interacts with the
yet to be done performance tuning, thus needs to get addressed later.
The current phrases' verbosity is believed to improve readability.

3 years agolibsigrok-internal.h: add more endianess aware stream reader routines
Gerhard Sittig [Sat, 12 Sep 2020 06:13:21 +0000 (08:13 +0200)]
libsigrok-internal.h: add more endianess aware stream reader routines

Add endianess aware readers including address incrementing variants for
those intrinsic data types which were missing in the previous version
yet are needed for sr_analog_to_float() adjustment.

Also move the 24bit reader to its position in the sort order.

3 years agotests/analog: add more tests for analog feed to float array conversion
Gerhard Sittig [Tue, 8 Sep 2020 19:07:33 +0000 (21:07 +0200)]
tests/analog: add more tests for analog feed to float array conversion

Extend test coverage for the sr_analog_to_float() conversion routine.
Pass data which is encoded in native, little and big endian format to
the routine. Pass single and double precision floating point data, and
integer data in different unit sizes and signedness. Cover scale/offset
calculations as well.

Also cover expected failed conversion for unsupported combinations of
input data format details (half/quad precision float, u64 integer).

Adjust the grouping of test cases in the sequence while we are here.
Move SI prefix, unit, and rational number related tests out of the
analog-to-float conversion group.

3 years agoanalog.c: sr_analog_to_float(): Support for receiving double values.
Timo Kokkonen [Tue, 8 Sep 2020 00:33:07 +0000 (17:33 -0700)]
analog.c: sr_analog_to_float(): Support for receiving double values.

Unbreak the conversion of input data in the floating point format when
the input data's format does not match the host's internal presentation,
thus grabbing raw data cannot be done.

Also accept the input data in double precision format which was not
supported before. Check for unsupported unit size values and emit an
error message similar to the integer code path.

This is motivated by bug #779 but does not resolve it. Adjusts common
conversion support, but sticks with single precision return data type
for API compatibility.

3 years agotests: strutil, use ck_assert
Jiri Slaby [Tue, 15 Sep 2020 06:50:48 +0000 (08:50 +0200)]
tests: strutil, use ck_assert

We pass no message, so use ck_assert instead of ck_assert_msg. This
results in an error with check 0.15:
tests/strutil.c:157:2: error: too few arguments to function '_ck_assert_failed'
  157 |  ck_assert_msg(saved_locale != NULL);

3 years agoinput/saleae: improve L2D undersampling, do provide sample data
Gerhard Sittig [Wed, 2 Sep 2020 15:59:47 +0000 (17:59 +0200)]
input/saleae: improve L2D undersampling, do provide sample data

The Saleae Logic exported files (Logic2 digital format) don't contain a
samplerate, so users need to specify the value. For values smaller than
the samplerate that was used during the capture undersampling will take
place. An implementation detail of the input module could result in
incorrect timing of sample values in the session feed. In extreme cases
none of the periods between signal edges qualified for submission. In
that case no sample data was sent to the sigrok session at all.

  $ sigrok-cli -i digital_1.bin -I saleae:samplerate=1000

Keep the very timestamp at hand when the last sample data was submitted.
Only advance that timestamp when more sample data was sent. This avoids
the accumulation of timing errors for undersampling scenarios, and does
forward undersampled input data when the user provided sample period has
passed.

This fixes bug #1600.

3 years agokorad-kaxxxxp: remove obsolete code (clear before read, timeout literal)
Gerhard Sittig [Tue, 1 Sep 2020 15:06:55 +0000 (17:06 +0200)]
korad-kaxxxxp: remove obsolete code (clear before read, timeout literal)

The korad response read routine clears the receive buffers, so callers
don't have to. This amends commit d2cc60bd4511.

The acquisition timeout is handled by common sw_limits support. Remove
the no longer referenced literal. This amends commit 3f9b48ae5f35.

3 years agokorad-kaxxxxp: speed up scan process, rephrase response read routine
Gerhard Sittig [Mon, 31 Aug 2020 19:03:31 +0000 (21:03 +0200)]
korad-kaxxxxp: speed up scan process, rephrase response read routine

The Korad protocol relies on unterminated request and response strings,
which works well enough for fixed length acquisition and status queries.
But the variable length replies to identification requests suffered from
an implementation detail in the receive routine. A large timeout must be
used because supported devices reportedly are slow to respond. There is
no simple yet robust condition to detect the response's completion. The
scan code must prepare for the maximum response length across the set of
supported devices. Unfortunately the maximum amount of time was spent
waiting for the response to occupy the provided response buffer, before
a long total timeout expired.

Rework the korad driver's helper routine which gets a variable length
non-terminated text string. Keep the long initial timeout, and keep
iterating in that initial phase to quickly detect when response data
became available. But terminate the read sequence after a shorter period
without receive data after some initial receive data was seen. Assume
that identification responses get transferred at wire speed and without
additional delays beyond bitrate expectations. Acquisition and status
responses shall not be affected by this change.

This speeds up the scan for devices from roughly 5s to some 0.1s on
newer devices (KA3005P v5.5) and 0.5s on older devices (KA3005P V2.0).

This commit also addresses an issue in the response text termination,
where partial responses contained undefined data. The previous version's
return value was unspecific: Negative for fatal errors, but either zero
or non-zero for successful reads, with no way for callers to learn about
the received amount of data. The rephrased version always returns the
amount of received data, and adds internal documentation which discusses
the implementation's constraints and the motivation for the approach.

This is a modified version of the initial implementation which was
Submitted-By: Karl Palsson <redacted>
3 years agokorad-kaxxxxp: style cleanup in device scan, keep serno at hand
Gerhard Sittig [Fri, 28 Aug 2020 14:17:22 +0000 (16:17 +0200)]
korad-kaxxxxp: style cleanup in device scan, keep serno at hand

Cleanup style in the korad driver's scan() routine. Keep declarations
out of code blocks. Reduce redundancy and improve robustness in the
response buffer length calculation. Reduce clutter and group related
instructions together. Unobfuscate result checks, and keep the result
at hand (for diagnostics, or error propagation). Unobfuscate string
comparisons in the model ID lookups, terminate the search upon match.
Use a not so terse name for data that gets referenced at rather distant
locations.

Keep the optionally available serial number at hand, to present it to
users when desired. This aspect was
Reported-By: Karl Palsson <redacted>
3 years agoinput/saleae: keep previous channels across cleanup() call
Gerhard Sittig [Wed, 26 Aug 2020 14:46:41 +0000 (16:46 +0200)]
input/saleae: keep previous channels across cleanup() call

The previous implementation of the cleanup() routine in the saleae input
module kept user specified options, but lost the previously created list
of sigrok channels. Keep it.

Also make sure that reset() voids the previous copy after grabbing its
value. To not unexpectedly release resources which still get referenced.

This shall unbreak file-reload.

3 years agoscpi-pps: use remote and local modes for HMP4000
Gerhard Sittig [Tue, 25 Aug 2020 18:47:26 +0000 (20:47 +0200)]
scpi-pps: use remote and local modes for HMP4000

Stop using the unusal "mixed" mode (local interface available during
remote operation) for HMP4000, applications may not be prepared for this
use case. Use traditional "remote" and "local" modes instead. This change
also ends remote mode after the application is done using the device.

3 years agoscpi-pps: Add more HMP4000 series devices
Gerhard Sittig [Tue, 25 Aug 2020 18:58:24 +0000 (20:58 +0200)]
scpi-pps: Add more HMP4000 series devices

List both vendor names "HAMEG" and "ROHDE&SCHWARZ" in the scpi-pps
driver, either responses were seen for HMP4000 devices. Unfortunately
vendor names don't support regex matches, so they require individual
profile items. The items also "violate" the alpha sort order in the list
of profiles, but keeping the series' models together is more important.

Add a declaration for the HMP4030 device which re-uses the HMP4040 data
but open codes the smaller channel count. Ideally the .probe_channels()
routine would receive the scpi_pps item as a parameter, and could yield
model specific result data from common information for the series. The
implementation in this commit is the least intrusive approach until
something better becomes available.

This shall cover the whole HMP4000 series:
  https://www.rohde-schwarz.com/product/hmp4000

3 years agoscpi-pps: add support for Hameg / Rohde & Schwarz HMP4040
Florian Schmidt [Tue, 7 Apr 2020 14:33:29 +0000 (16:33 +0200)]
scpi-pps: add support for Hameg / Rohde & Schwarz HMP4040

This commit introduces initial support for the HMP4040 power supply by
Rohde & Schwarz. It allows to configure the device and "statically" read
back current state. Automatic status updates with per-channel details
are not available yet (common support is missing).

[ gsi: drop status update remainder, address minor style nits ]

3 years agodoc: update README.devices for GWInstek VCP (CP210x in disguise)
Gerhard Sittig [Fri, 21 Aug 2020 09:47:59 +0000 (11:47 +0200)]
doc: update README.devices for GWInstek VCP (CP210x in disguise)

Reference the vendor's Windows specific "driver" download for the
CP210x chip with a non-default VID:PID. Provide an example how to
assign the Linux driver to that device (interactive, no udev rule).

3 years agoscpi_serial: add "GWInstek VCP" (PID 0x0030) as seen in GDM-834x
Gerhard Sittig [Fri, 21 Aug 2020 09:40:29 +0000 (11:40 +0200)]
scpi_serial: add "GWInstek VCP" (PID 0x0030) as seen in GDM-834x

3 years agoscpi-dmm: factor out some OL detection limits
Gerhard Sittig [Fri, 21 Aug 2020 09:34:54 +0000 (11:34 +0200)]
scpi-dmm: factor out some OL detection limits

Prepare the "plus/minus infinity" checks for OL conditions to use
model dependent limits. This commit does not change behaviour.

3 years agoscpi-dmm: add SR_CONF_CONN getter
Gerhard Sittig [Fri, 21 Aug 2020 10:36:53 +0000 (12:36 +0200)]
scpi-dmm: add SR_CONF_CONN getter

Add config_get() support for conn= specs. This is a best-effort approach.
Failure to get the SCPI connection text is non-fatal during probe.

3 years agools: Detect Demon Core, use its canonic command names
v1ne [Tue, 31 Mar 2020 19:51:22 +0000 (21:51 +0200)]
ols: Detect Demon Core, use its canonic command names

Document Demon Core commands and associated metadata magic numbers.
See http://web.archive.org/web/20190317154112/
http://mygizmos.org/ols/Logic-Sniffer-FPGA-Spec.pdf for documentation.

Detect the Demon Core presence, use more symbolic names in related
code paths to eliminate magic numbers, switch to their canonic names.

Reviewed-By: Wolfram Sang <redacted>
3 years agools: Refactor, deduplicate logic packet code
v1ne [Tue, 31 Mar 2020 17:02:29 +0000 (19:02 +0200)]
ols: Refactor, deduplicate logic packet code

Reviewed-By: Wolfram Sang <redacted>
3 years agools: Use symbolic name for "success" error code.
v1ne [Wed, 1 Apr 2020 14:45:17 +0000 (16:45 +0200)]
ols: Use symbolic name for "success" error code.

Reviewed-By: Wolfram Sang <redacted>