Commit Graph

5596 Commits

Author SHA1 Message Date
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
Gerhard Sittig 1c5d5905a4 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.
2021-02-02 21:09:54 +01:00
Gerhard Sittig 7320ce5ecc 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).
2021-02-02 21:07:29 +01:00
v1ne 3cc9e21573 ols: Clean up: Replace hand-rolled byte order conversion with existing macros 2021-01-06 10:45:28 +01:00
v1ne f8fd84208d 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.
2021-01-06 10:45:28 +01:00
v1ne 50b15953fe ols: Make external clock setting queriable
... and thus selectable in PulseView.
2021-01-06 10:45:28 +01:00
v1ne f20c39d933 ols: Add option to use the falling edge of the external clock 2021-01-06 10:45:28 +01:00
v1ne c36a7d84ca 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.
2021-01-06 10:45:28 +01:00
v1ne 29f15d52cb 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.
2021-01-06 10:45:28 +01:00
v1ne aad6b9de5f ols: Clean up: Prefix private function for consistency 2021-01-06 10:45:28 +01:00
Gerhard Sittig ba1fb5e926 doc: update README.devices for Meterman 38XR (RS232 button) 2021-01-05 18:17:45 +01:00
Peter Skarpetis 4c29bba1f0 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 ]
2021-01-05 08:13:23 +01:00
Gerhard Sittig 3fa436bb48 serial-dmm: move Mastek items after Metex in the model database
Keep the alpha-sort order in the list of supported chips and models.
2021-01-05 08:10:21 +01:00