Commit Graph

5608 Commits

Author SHA1 Message Date
Gerhard Sittig e3c852854f scpi-dmm: Keysight 34465A is a 6.5 digit meter, bump digits count
Increase the default digit count in the 34465A model description. Though
most measurements get the precision from the current reading, this data
is used as a fallback when the response won't provide the detail.
2021-05-22 08:35:11 +02:00
Gerhard Sittig cae328b54c scpi-dmm: move OPC availability check to after IDN device identification
Assume that *IDN? requests don't involve expensive processing, and thus
don't require *OPC? before their execution. This makes scpi-dmm follow
the good tradition to only use non-standard or model dependent features
after the device was successfully identified. Which avoids confusion on
unrelated devices.

Exclusively check for *OPC? availability on Owon devices, because these
motivated the introduction of the test in the first place. This avoids
confusion on other devices where short timeouts result in errors because
the response is not retrieved although the command is supported (observed
on Agilent meters connected via USBTMC).
2021-05-22 08:35:11 +02:00
Gerhard Sittig 73816a8d8c contrib: add udev rule for Keysight USBTMC
Add the USB identification of a Keysight 34465A digital multimeter.
2021-05-22 08:35:11 +02:00
Gerhard Sittig 84073e32ef siglent-sds: prefer common glib routine to get vector's length
Replace an open coded loop with a call to common glib code.
2021-05-22 08:06:58 +02:00
Gerhard Sittig 191af3d9ca scpi: readability nits in vector getters, style nit in malloc call
Improve readability of SCPI uint8 and float vector get routines. Move
assignment and use of variables closer together to simplify review.
Allocate the glib array based on the text split result's length. Move
data processing to the "straight" path and handle failed conversion as
an exceptional condition in an error path.

Eliminate a redundant data type reference in a malloc call.
2021-05-22 08:06:58 +02:00
Gerhard Sittig 70158398f3 siglent-sds: free memory that was allocated by SCPI get routines
The SCPI get routines may allocate memory for response data which
callers have to free after use.

The implemented approach is modelled after pull request 114 by
Matti Eiden, to get the leak fixes in while the PR is queued.

This addresses part of bug #1683.

Submitted-By: Matti Eiden <snaipperi@gmail.com>
2021-05-22 08:06:58 +02:00
Gerhard Sittig 4da62209dd hameg-hmo: free memory that was allocated by SCPI get routines
The SCPI get routines may allocate memory for response data which
callers have to free after use.

Move an existing assigment such that the initial assignment, the memory
allocation, use of response data, and resource release are in closer
proximity, and thus are easier to reason about during maintenance.
Behaviour does not change.

This is motivated by bug #1683.
2021-05-22 08:06:58 +02:00
Gerhard Sittig 4fad41a8a4 rigol-ds: free memory that was allocated by SCPI get routines
The SCPI get routines may allocate memory for response data which
callers have to free after use.

The approach to release allocated memory is simlar or identical to the
corresponding parts of pull request 95, in an attempt to get the reported
leak fixes in, yet reduce the potential for conflicts where this commit
deviates from the PR. Most work was done by Ralf. Thank you!

This addresses part of bug #1683.

Submitted-By: Reported-By: Ralf <jr-oss@gmx.net>
Tested-By: Reported-By: Ralf <jr-oss@gmx.net>
2021-05-22 08:06:58 +02:00
Gerhard Sittig 83d38ed90a scpi-dmm: free memory that was allocated by SCPI get routines
The SCPI get routines may allocate memory for response data which
callers have to free after use.

This addresses part of bug #1683.
2021-05-22 08:06:58 +02:00
Gerhard Sittig ff85a7f0ab rigol-dg: free memory that was allocated by SCPI get routines
The SCPI get routines may allocate memory for response data which
callers have to free after use.

Move an existing release call to an earlier location, to avoid leaking
memory when an error path is taken.

This addresses part of bug #1683.
2021-05-22 08:06:58 +02:00
Gerhard Sittig 36165cf0f7 lecroy-xstream: free memory that was allocated by SCPI get routines
The SCPI get routines may allocate memory for response data which
callers have to free after use.

This addresses part of bug #1683.
2021-05-22 08:06:58 +02:00
Gerhard Sittig 9417f26fd4 hp-3457a: style nits in the probe routine
Unobfuscate a string comparison. Eliminate redundant data type specs
in malloc calls.
2021-05-22 08:06:58 +02:00
Gerhard Sittig 1c50255506 hp-3457a: free memory that was allocated by SCPI get routines
The SCPI get routines may allocate memory for response data which
callers have to free after use.

This addresses part of bug #1683.
2021-05-22 08:06:58 +02:00
Gerhard Sittig c9cfcd2591 fluke-45: free memory that was allocated by SCPI get routines
The SCPI get routines may allocate memory for response data which
callers have to free after use.

This implementation is incomplete. The fluke-45 driver's context holds
a "global" copy of the most recently received response. While the data
is freed in the next receive call, one item remains allocated for the
driver's remaining life time. Which is considered non-critical.

Also moves an operator in a complex multi-line expression to a different
location to follow the project's style.

This addresses part of bug #1683.
2021-05-22 08:06:58 +02:00
Gerhard Sittig 9b915e3a41 scpi: document callers' responsibility to free getters' allocated memory
Some of the SCPI getter routines allocate memory for response data which
callers need to free after use. Document this responsibility in more
places, and rephrase existing locations for consistency. See a word-diff
for the essence of the commit.

It's assumed that the separate paragraph in the function description is
better perceived than something that's hidden in the parameter or return
value discussion. Also reference the corresponding free routine by name
for callers' convenience (data types will differ among routines). Some
free routines can be called unconditionally, others require NULL checks
at the caller's.

Reported-By: Ralf <jr-oss@gmx.net>
2021-05-22 08:06:58 +02:00
Gerhard Sittig 4c72966444 scpi: make sure to either return valid SCPI response data or NULL
Assign NULL early in those SCPI get routines which return allocated
memory to their callers. So that the return value is either a valid
pointer to memory or NULL regardless of the routine's exit code. This
simplifies call sites and increases robustness.
2021-05-22 08:06:58 +02:00
Gerhard Sittig ac1866b923 serial_libsp: extend diag in code path which opens serial ports
Opening a serial port involves two libserialport calls, while only the
second call's return value gets inspected. Check the lookup before the
open, too, and provide its details in a diag message.
2021-05-22 07:59:18 +02:00
Rafael G. Martins f5c697bfe6 serial-dmm: Add PeakTech 2025 meter support.
This meter seems to be a rebranded Victor 86D. Vendor procotol
documentation matches FS9922 RS232 protocol.
2021-05-16 12:08:58 +02:00
Frank Stettner 4efd5462c7 rdtech-dps: Add missing devc initialisation. 2021-05-09 19:29:38 +02:00
Gerhard Sittig c899e691f3 contrib/60-libsigrok.rules: add udev rule for Microchip PICkit2 2021-04-25 12:52:20 +02:00
Gerhard Sittig 4b8348941d input/csv: trim surrounding whitespace from header line channel names
When CSV import grabs channel names from the first line in the file then
the text strictly between column separators (a comma) was used. Which
resulted in channel names like " channel 1". Trim leading and trailing
space before unquote, to better fulfill most users' expectation. Users
still can quote the input data for special cases if desired.
2021-04-25 12:51:33 +02:00
Gerhard Sittig 7a78fd56f7 rdtech-dps: research to reduce serial comm transfer volume again
The DPS devices default to a rather low UART communication bitrate. The
generous retrieval of more Modbus registers than strictly necessary for
the periodic acquisition of analog channel values and state tracking may
or may not be an issue.

Instrument all call sites in api.c to the device state gathering calls
such that the protocol.c side transparently can reduce the transfer
volume depending on which level of detail the caller may expect given
its current context. Under optimal circumstances this might cut the
traffic in half, which DPS devices may benefit from.

This commit adds the infrastructure to potentially reduce transfer
volume, but does not change behaviour. The "config" reasons may need
further partitioning if Modbus register access really turns out to be
a severe bottleneck. The API lends itself to that extension easily. The
approach which gets prepared in this commit needs to get runtime tested
by those who got access to the hardware.
2021-04-25 12:10:33 +02:00
Gerhard Sittig 884ae8c021 rdtech-dps: introduce support for RD6006 and other Riden RD models
The RD devices differ from DPS devices in their default communication
bitrate (115200), register content endianess (BE), and register set
layout (addresses for registers). In either case 16bit registers get
accessed by means of Modbus communication over a serial channel. The
interpretation of the registers' values mostly is the same as for DPS
devices once a register with the same meaning got identified. Device
identification includes a 32bit serial number which DPS devices appear
to not provide.

All other product features are the same, and map to identical sigrok
mechanisms. That's why re-using the rdtech-dps driver to add rdtech-rd
support is considered desirable. This implementation shares all code
"above" the raw register addressing and raw value interpretation. All
logical processing, configuration interface, state tracking and data
submission to the session feed, are shared among the different device
types.

Declare support for the RD6006, RD6012, and RD6018 models. Their specs
were taken from the 2020.12.2 instruction manual. The driver was tested
with an RD6006 device (firmware version 1.28). Unfortunately automatic
device detection is not possible or will not be reliable, which is why
users need to specify the respective model by picking one of the two
drivers. Within a driver variant the device identification and use of
the device are automatically dealt with.
2021-04-25 12:10:26 +02:00
Gerhard Sittig d7a4dad881 rdtech-dps: layer separation between API and protocol, style nits
The existing power supply driver for Riden DPS/DPH devices unfortunately
duplicated intimate details of modbus communication and register layout
including interpretation of raw register values across several source
files. Do separate the physical transport and the register layout and
register fields interpretation layers. This brings the driver in line
with the usual api.c and protocol.c arrangement of responsibilities, and
prepares the future addition of other similar devices.

Address a few style nits while we are here. Include <config.h> in all
source files, and alpha-sort include directives. Address minor data type
nits. Reduce indentation in code paths. Propagate more error codes.
Update comments which lagged behind the code, adjust grammer (eliminate
"actual" false friends). Eliminate a few magic numbers and redundancies,
switch to the more recent endianess aware byte stream reader API where
beneficial, to eliminate redundant offset math.

Other nits seem to have gone unnoticed before: The indices of all sigrok
channels were identical (all zero). Signed print formats were used for
unsigned data.

This implementation compiles, but wasn't runtime tested due to lack of
hardware. A rough estimate of transfer volume and transport throughput
suggests that the 10ms cycle time no longer can be kept, may end up
around 25ms (40 cycles per second). This can get avoided by adding more
code to tell the configuration requests, the acquisition start, and the
measurements grabbing during acquisition apart. It's assumed though that
the 10ms glib poll interval did not translate to such fast measurement
gathering. The firmware may typically provide data at lower rates anyway.

The generic source code may look overly complicated or redundant at
first glance, but compilers' generated code will greatly get optimized.
Simplified maintenance because of reduced cognitive load is considered
more important.
2021-04-25 12:10:22 +02:00
Frank Stettner 584269fd2f hp-59306a: Initial HP 59306A driver.
[ gsi: drop libgpib dependency, minor style adjustment ]
2021-04-25 12:04:10 +02:00
Frank Stettner 12e7abe219 hp-59306a: Initial driver skeleton. 2021-04-24 16:47:06 +02:00
Frank Stettner 522381a343 Add device type SR_CONF_MULTIPLEXER. 2021-04-24 16:47:06 +02:00
Soeren Apel 004fd9ffd3 Amend #119 to use vector instead of tuple
This way, we don't need to bump glibmm to 2.54, which we otherwise would
2021-03-28 23:17:17 +02:00
Gerhard Sittig 955ab60455 kingst-la2016: address trivial style nits (whitespace, braces, line length)
Improve readability by addressing the trivial style nits in the driver.

Break the channel list into two times eight instead of nine plus seven
items. Put braces around all branches if one of them has braces. Add
braces to multi line branches despite most of the branch just being a
comment -- it's still many lines. Break extra long text lines, adjust
the position of operators when single expressions span multiple lines.

Drop unnecessary parentheses around single variables and auto
incrementing pointer dereferences. Adjust whitespace especially for
pointer data types, and arith operators.
2021-03-16 21:40:32 +01:00
Helge Kruse c3d4003710 kingst-la2016: Eliminate non-portable packed structs for USB transfer layout
Eliminate packed structs in the construction and in the reception of
USB transfers, since these are rather non-portable. Use common support
for endianess aware access to byte streams instead. This unbreaks the
driver for MinGW builds, and increases portability and maintainability
on all other sigrok supported platforms.

[ gsi: adjust more locations, improve robustness, fixup style, reword message ]
2021-03-16 21:27:24 +01:00
Helge Kruse d9a74e97f4 kingst-la2016: Use common code to send trigger and frame boundary packets
[ gsi: adjust more locations, reword commit message ]
2021-03-16 21:26:35 +01:00
Gerhard Sittig 8f87c5284b tests: extend endianess conversion tests to also cover the 48bit writer
Cover the recently added writer for 48bit little endian data. Prepare a
large bytes pattern buffer that can also serve for future 64bit tests.
2021-03-16 21:26:35 +01:00
Gerhard Sittig 797c8d9034 libsigrok-internal.h: add 48bit endianess aware byte stream helpers 2021-03-16 21:26:35 +01:00
Helge Kruse 40a0b2f466 kingst-la2016: Upload firmware to correct USB configuration 1
The ezusb_upload_firmware() routine opens the USB device and selects the
current configuration. The specified value must match the previously read
configuration descriptor. This commit unbreaks the firmware download for
MinGW builds which link against libusb-1.0.20-rc3-event-abstraction-v4.

[ gsi: reworded commit message ]
2021-03-16 21:25:56 +01:00
Frank Stettner 051d85f28d korad-kaxxxxp: Add support for Korad KD3005P V2.1 2021-03-16 21:04:20 +01:00
Petteri Aimonen 2111d1574b scpi-dmm: Add support for Owon XDM2041 2021-03-06 19:04:32 +01:00
Petteri Aimonen ddeaa49d43 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.
2021-03-06 19:04:19 +01:00
Petteri Aimonen 33306b13ac scpi-dmm: Add infinity limit to model-specific config.
Owon multimeters seem otherwise compatible with gwinstek reader,
except infinity is only 1e9.
2021-03-06 19:04:14 +01:00
Petteri Aimonen 5433907ed9 scpi-pps: Add support for Owon P4000 series.
Tested on P4603 firmware version 1.6.0.
2021-02-28 15:25:21 +02:00
litospain 389acdd991 hantek-6xxx: Add ISDS205B support 2021-02-21 23:26:20 +01:00
waka f5c618e55f hantek-6xxx: Fix for channel coupling not updating on changing
Presumed regression related to fix for bug #836
2021-02-21 23:20:22 +01:00
Florian Ragwitz b41562f6ce zketech-ebd-usb: Don't ignore errors 2021-02-21 23:05:32 +01:00
Florian Ragwitz a99ff45359 beaglelogic: Fix resource leak 2021-02-21 23:05:27 +01:00
Alberto Scotta fe185e4990 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.
2021-02-21 23:01:58 +01:00
HReimann 0f5dcee6ce rigol-ds: Add DS1102Z-E model variant 2021-02-21 22:55:00 +01:00
Richard Allen a2916ad017 python bindings: Support passing in rational voltages for config_set 2021-02-21 22:21:17 +01:00
Richard Allen 1145ceaa78 gwinstek-gpd: Fix voltage/current measurement 2021-02-21 21:46:08 +01:00
Richard Allen c93c014f47 gwinstek-gpd: Support auto-baud detection
If the user does not specify a serialcomm configuration,
try all three options from the manual.
2021-02-21 21:46:08 +01:00
Richard Allen c329b788d2 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.
2021-02-21 21:41:18 +01:00
Richard Allen 10fd326dea gwinstek-gpd: Print serialcomm config 2021-02-21 21:41:18 +01:00