Commit Graph

5532 Commits

Author SHA1 Message Date
Gerhard Sittig 22f76e188b 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
2020-08-25 20:59:31 +02:00
Florian Schmidt bd5f0a143e 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 ]
2020-08-25 20:58:54 +02:00
Gerhard Sittig 24a953382c 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).
2020-08-25 19:38:23 +02:00
Gerhard Sittig f91c6940ab scpi_serial: add "GWInstek VCP" (PID 0x0030) as seen in GDM-834x 2020-08-25 19:38:23 +02:00
Gerhard Sittig 395c1850b7 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.
2020-08-25 19:38:23 +02:00
Gerhard Sittig 7d95afb9be 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.
2020-08-25 19:38:23 +02:00
v1ne 6f9234e6f3 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 <wsa@kernel.org>
2020-08-24 07:57:13 +02:00
v1ne 2755ab36f3 ols: Refactor, deduplicate logic packet code
Reviewed-By: Wolfram Sang <wsa@kernel.org>
2020-08-24 07:57:06 +02:00
v1ne dcdc2848b7 ols: Use symbolic name for "success" error code.
Reviewed-By: Wolfram Sang <wsa@kernel.org>
2020-08-24 07:43:03 +02:00
v1ne 58a75642e9 ols: Make constant names more precise, clarify comment
Reviewed-By: Wolfram Sang <wsa@kernel.org>
2020-08-24 07:33:13 +02:00
v1ne a80bed7656 ols: Rename "flags" to "capture flags".
In the current implementation the "flags" are exclusively used for
captures. Prepare the introduction of device flags by renaming the
capture related flags which are specific to an operation.

Reviewed-By: Wolfram Sang <wsa@kernel.org>
2020-08-24 07:29:03 +02:00
v1ne a2b1a53bb4 ols: Symbolic name for magic value, reflect units in variable names
Reviewed-By: Wolfram Sang <wsa@kernel.org>
2020-08-24 07:26:43 +02:00
v1ne f1a37f3924 ols: Remove stray command
It's nowhere documented and nowhere used.

Reviewed-By: Wolfram Sang <wsa@kernel.org>
2020-08-24 07:26:01 +02:00
v1ne 0ccc6f7cdf ols: Make use of zero-initialization.
No need to assign zero after gmalloc0(). Move comments to declaration.

Reviewed-By: Wolfram Sang <wsa@kernel.org>
2020-08-24 07:24:27 +02:00
Frank Stettner b54d9b4974 libsigrok.h: Fix comment for unit Joule. 2020-08-23 13:10:00 +02:00
Frank Stettner fe8c5aef1f libsigrok.h: Add Joule, Coulomb, and Ah units.
Also extend a comment on energy in comparison to power.
2020-08-22 21:53:56 +02:00
Frank Stettner 82ff704449 libsigrok.h: Add MQ for electric charge. 2020-08-22 21:53:56 +02:00
Frank Stettner f5247d953f teleinfo: Fix measured quantity (energy, not power). 2020-08-22 21:53:39 +02:00
Gerhard Sittig 98b7b08956 output/csv: always generate text for analog/logic data packets
Unconditionally generate output text when a session packet is received
which carries analog or logic sample data. Even if the data gets queued
and is not shown immediately, in that case the output text remains empty
but needs to be present. Otherwise applications may assume that the CSV
output module had not handled the data at all, which would result in
unexpected "screen output" with fallback data being interleaved with the
CSV output.

This resolves bug #1026 in its strictest sense (the unexpected presence
of fallback data). But leaves all other issues mentioned in comment 1.
2020-08-22 19:04:31 +02:00
Gerhard Sittig ce384e074f output/csv: check unsupported/untested input signal conditions
The current implementation of the CSV output module makes assumptions
which don't hold. Which results in incorrect or incomplete output for
some combinations of logic and analog signals.

Check for some of the known problematic conditions, and warn the user
about potentially unexpected results. This is a workaround until the
issues properly get addressed in the implementation.

This is motivated by but does not resolve bug #1026.
2020-08-22 19:00:05 +02:00
Timo Kokkonen 66665b0932 README.devices: Document enabling GW Instek GDM-397 serial output mode. 2020-08-22 09:10:42 +02:00
Timo Kokkonen a3ec8a9aa1 serial-dmm: Add GW Instek GDM-397 meter support.
This meter appears to be rebranded UNI-T UT61B, but with
improved input protection.
2020-08-22 09:10:42 +02:00
Gerhard Sittig e37e301e26 korad-kaxxxxp: add support for forced "detection" of a given model
Korad PSU models are rather popular. But the successful operation of
currently unsupported model names or firmware versions is hard to verify
by users, because building the library from locally modified sources is
involved.

Introduce support for the "force_detect=" scan option. Warning messages
contain how the device identifies itself. Optional user specs can force
the assignment of the driver to the unsupported model. Which results in
reports that include the identification details as well as the successful
use of the device.

  $ sigrok-cli -d korad-kaxxxxp:conn=...:force_detect=KORADKA3005PV2.0 --show
2020-08-22 09:10:29 +02:00
Gerhard Sittig d643e6bc39 hwdriver: introduce SR_CONF_FORCE_DETECT config key (scan option)
Often previously unsupported models might be covered by existing code,
but would not match against a builtin list of known devices.

Introduce a config key which provides a scan option for users to force
the use of a driver with an unsupported device. This increases the
probability of requests for support of an additional model which are
associated with a successful use of that very device, and eliminates
the necessity to build from source for the trivial cases.

It's up to individual drivers whether they support forced detection,
and how they interpret the value of the scan option.
2020-08-22 09:10:29 +02:00
Gerhard Sittig 048250d0e0 korad-kaxxxxp: add config_get() support for SR_CONF_CONN
Let applications query the device instance's conn= key. This lets users
recognize individual devices if multiple of them are connected.

  $ sigrok-cli -d korad-kaxxxxp:conn=/dev/ttyACM0 --show
  ...
  korad-kaxxxxp:conn=/dev/ttyACM0 - Korad KA3005P with 2 channels: V I
  ...
2020-08-22 09:10:29 +02:00
Timo Kokkonen 860ee00ab1 scpi-dmm: Remove SYST:LOC hack for GWInstek meters.
No need for this hack anymymore as there is now DMM_CMD_SETUP_LOCAL
command that can be used to return unit back to "local" mode properly.
2020-08-20 12:48:13 -07:00
Timo Kokkonen 4c80a27284 scpi-dmm: Add new command DMM_CMD_SETUP_LOCAL.
Add new command DMM_CMD_SETUP_LOCAL for setting device back
to "local" mode. If device implmements this command, it is
sent when driver is closed and after device "scan".

Define DMM_CMD_SETUP_LOCAL for GWInstek meters, so they get
returned to local mode automatically after use.
2020-08-20 12:48:00 -07:00
Gerhard Sittig 25879a34e9 scpi-dmm: alpha-sort the list of supported devices (vendor/model list)
Any order is as arbitrary as any other. The alphabetical order of vendor
and model names might be the most robust during maintenance: easiest to
remember, easiest to use when checking for presence, and easiest to add
to or resolve conflicts during merges. Vendor renames (HP to Agilent to
Keysight, et al) are ugly but can't be helped easily.
2020-08-17 20:32:08 +02:00
Gerhard Sittig 33aa8117e3 scpi-dmm: minor style adjustment (gdm906x, analog init, comments, diag)
Address minor style issues: Need not assign NULL after g_malloc0(), need
not check for NULL before g_free(). Rephrase diagnostics messages which
are user visible by default, remove internal development details. Reword
a few comments, and adjust their grammar for consistency across the code
base. The sr_analog_init() routine executed immediately before getting
measurements, need not (re-)assign endianess or floating point details,
except those which do change after initialization (double vs float).
Rephrase model dependent checks for easier adjustment during maintenance.
Unobfuscate string comparisons.
2020-08-17 20:01:02 +02:00
Gerhard Sittig 72cd558d4a scpi: Raise severity when IDN response lacks the serial number field.
Raise the diagnostics message's severity from debug to warn when the
'*IDN?' response lacks the serial number field. Although it has only
been seen for some GWInstek DMMs, it violates the SCPI spec, and more
or other activity is required in a future implementation. This change
amends commit 47e7a6395e.
2020-08-17 19:07:37 +02:00
Gerhard Sittig 6dc0007c71 scpi_serial: Rephrase NL and NL+CR line termination check.
Rearrange the check for line termination in SCPI receive data, and add a
comment in that spot. Keep related conditions together, avoid line breaks
for complex terms. This shall simplify review, and raise awareness during
maintenance. This change amends commit a0ade2f933.
2020-08-17 18:48:50 +02:00
Timo Kokkonen 4e5ff004d8 scpi_serial: Add GW-Instek GPD-9061 (USBCDC mode) VID/PID. 2020-08-17 18:35:17 +02:00
Timo Kokkonen 7eba792f0d udev: Add GW-Instek GDM-9061 VID/PID. 2020-08-17 18:35:17 +02:00
Timo Kokkonen 868fc65ec3 scpi-dmm: Add support for GW-Instek 906X series bench multimeters.
- Add support for GDM-9060 and GDM-9061 DMMs.
2020-08-17 18:35:17 +02:00
Timo Kokkonen d0b602f00f scpi-dmm: Add support for GW-Instek 8200A series bench multimeters.
- Add support for GDM-8251A and GDM-8255A DMMs.
2020-08-17 18:35:17 +02:00
Timo Kokkonen 47e7a6395e scpi: Support devices that omit serial number in *IDN? command responses. 2020-08-17 18:35:17 +02:00
Timo Kokkonen a0ade2f933 scpi_serial: Add support for (broken) devices sending NL+CR terminator.
This allows SCPI code to work with devices that terminate their responses
with NL+CR (instead of usual NL) like some GW-Instek DMMs.
2020-08-17 18:35:17 +02:00
Gerhard Sittig d7df9dc738 serial_hid: add iokit= prefix for the Mac IOKit special case
Rephrase the logic which turns HIDAPI paths returned from enumerations
into something that can be used with conn= device options. Rearrange
code paths and rename variables to hopefully increase readability, and
to prepare support for more conditions in future implementations.

Replace the "IOService:" prefix on recent Mac versions with the "iokit="
literal, to eliminate the previously unhandled colon in path names. This
resolves bug #1586.

Move the allocation of a writable buffer from the callers to the callee,
to simplify multiple call sites, and most of all because the caller need
not be aware of the buffer's required size (input and output size can
differ in either direction).

Update the conn=hid/ section in README.devices, add the iokit= prefix.
2020-08-09 16:09:04 +02:00
Gerhard Sittig 4feb6ec9a2 output/csv: complete and improve timestamp construction support
Unbreak the timestamp calculation when session data is received in
multiple packets. Avoid a division by zero when the samplerate is not
known yet the time column is requested. Only calculate timestamps when
the time column is requested. Use floating point during the scaling,
only convert to integer immediately before printing. Change line breaks
to not split a complex sub-expression across several lines.
2020-08-05 21:03:11 +02:00
Earle F. Philhower, III 01ac3eedfa output/csv: Avoid accumulated timestamp error for odd samplerates
The conversion of sample rates to sample periods and the repeated
addition of truncated values (integer variables) resulted in the
accumulation of errors in the timestamp column for odd samplerate
values. How to reproduce:

  $ sigrok-cli -d demo:analog_channels=0 \
      -c samplerate=6000000 --samples 1200001 \
      -O csv:time=true | tail

Accept the additional cost to reduce the error. Always get the timestamp
in a new calculation based on the sample number and the sample rate.

This addresses bug #1027.

Signed-off-by: Earle F. Philhower, III <earlephilhower@yahoo.com>
[ gsi: rephrased commit message, how to reprodue ]
2020-08-05 20:53:57 +02:00
Timo Kokkonen b81cfbc349 gwinstek-gpd: Add missing SW limits API calls. 2020-08-03 18:54:33 +02:00
Gerhard Sittig d579755a66 sw_limits: add const for limits param for config_get
The sr_sw_limits_config_get() routine exclusively reads the 'limits'
parameter, need not write to it. Add the 'const' attribute.
2020-08-03 17:53:11 +02:00
Gerhard Sittig 0dc27cd1db serial: make failed flush() in open() non-fatal, CP2110 flush() return
Commit cb828f1b3e introduced an unconditional flush() call in the
open() routine's body, and passed its return value in verbatim form to
open() callers. Some of the transports/cables for serial communication
yield the SR_ERR_NA return value. Consider this a non-fatal condition.

Unbreak the CP2110 HID chip's flush() implementation. Don't expect a
return value of 0 from HID write calls, instead expect to see the number
of written bytes for successful calls.

This was tested with ch9325 (UT-D04), cp2110 (UT-D09) and bu86x.
2020-08-01 14:55:20 +02:00
Timo Kokkonen 13726d30b2 gwinstek-gpd: Add support to old (hardware) revision units.
Manufacturer revised hardware design without changing model numbers at some point.
Old units have firmware that behaves differently. Responses are terminated with \r
instead of \n. And STATUS? command response format is different.
2020-08-01 07:19:49 +02:00
Timo Kokkonen 3b316fdca0 gwinstek-gpd: Add support for GPD-3303S. 2020-07-31 14:28:38 +02:00
Gerhard Sittig dc172c38d2 output/ascii: data type nits, rephrase sample bit access
Use size types for counters, unsigned for bit manipulation. Trigger
position needs to remain a signed int (must be possible to go negative
for "not here", and strictly remains within the output text line length,
so should be good).

Rephrase the nested loop during bit extraction from logic packets, and
how a channel's value at a given sample number gets accessed. Eliminate
redundancy in that spot, to improve readability and simplify maintenance.
2020-07-31 11:25:29 +02:00
Gerhard Sittig 31907b76de output/ascii: style nits in name alignment and trigger flush
Unobfuscate the implementation of the recent channel name alignment and
trigger position flush, address other style nits of earlier versions:

Don't need a GString for runtime constant channel names (which also
suffered from a mismatch of declaration and allocation). Don't need to
"construct space" when printf(3) can align the value. Pre-allocate text
buffers with more appropriate length when known in advance. Drop another
unused variable. Eliminate data type redundancy in malloc(3) calls. Make
sure to get zeroed memory, disabled channels can result in assignment
gaps. Use consistent brace style and separate variable declaration from
use (no RAII here).

Excess text line length remains, there has been a lot of it in the
previous implementation. It is left for another commit.

Tested with:

  $ sigrok-cli -d demo:analog_channels=0:logic_channels=4 --samples 40 -O ascii -t D3=r -w
2020-07-31 10:39:50 +02:00
v1ne cc835205cd output/ascii: Also print trigger marker for "short" data lines
The trigger position would be missing in the output text when the number of
available samples is less than the configured text line length. Do flush the
trigger marker for the last chunk of accumulated samples, too.

How to reproduce:

  $ sigrok-cli -d ... --samples 32 -O ascii:width=128

[ gsi: rephrased commit message ]
2020-07-31 10:30:22 +02:00
v1ne 3b93d3c24b output/ascii: Vertically align logic channel names
This results in vertical alignment of sample data and trigger positions.
The implementation assumes that the channel names' byte count corresponds
to the space which they occupy on screen. Channel names with umlauts still
may suffer from misalignment.

[ gsi: rephrased commit message ]
2020-07-31 10:24:43 +02:00
v1ne f64f51b404 output/ascii: Remove unused variable 2020-07-31 10:24:26 +02:00