Andreas Sandberg [Sun, 29 Sep 2019 15:38:17 +0000 (16:38 +0100)]
fluke-dmm: Fix use-after-free bugs
The handler for fluke 18x and 28x DMMs allocates several data
structures on the stack that are used after they have been freed when
creating a data feed packet.
Restructure the code so that all handlers send their own packets. As a
bonus, this avoid a couple of small heap allocations.
Frank Stettner [Tue, 9 Apr 2019 12:20:41 +0000 (14:20 +0200)]
korad-kaxxxxp: Fix bug when setting values while acquisition is running.
By separating the variables that holds the get and set values, the output
state, OVP and OCP can now be set while the acquisition is running.
Also some variables are named more clearly.
Frank Stettner [Wed, 1 May 2019 21:18:13 +0000 (23:18 +0200)]
rdtech-dps: Retry sr_modbus_read_holding_registers() up to 3 times.
The communication with the rdtech power supplies is not very reliable,
especially during the start. Because of that, the driver tries to read the
modbus registers up to three times.
Nevertheless there is the chance, that the communication fails.
Introduce quirks support for devices which provide incomplete metadata.
Add conservative logic to unbreak the Logic Shrimp. Amend previously
received information when it was incomplete, but don't interfere if a
future firmware version fixes the issue.
Without this change, the device gets detected but "has zero channels"
and would be unusable. Because when a device provides metadata, these
details are used exclusively, no fallbacks apply.
Sylvain Munaut [Sat, 13 Oct 2018 13:51:15 +0000 (15:51 +0200)]
std: Remove call to sr_dev_close from std_serial_dev_acquisition_stop
There is no reason to close the entire device in acquisition_stop and
this actually breaks pulseview on serial devices using this callback
when running multiple acquisition cycles
The Mooshimeter driver uses mem*() and str*() library calls. Include the
<string.h> header file to silence compiler warnings.
...
./src/hardware/mooshimeter-dmm/protocol.c: In function 'lookup_tree_path':
./src/hardware/mooshimeter-dmm/protocol.c:275:3: warning: implicit declaration of function 'strchr' [-Wimplicit-function-declaration]
end = strchr(path, ':');
^
./src/hardware/mooshimeter-dmm/protocol.c:275:9: warning: incompatible implicit declaration of built-in function 'strchr' [enabled by default]
end = strchr(path, ':');
^
...
Gerhard Sittig [Tue, 29 Oct 2019 16:42:34 +0000 (17:42 +0100)]
bt: apply 20s timeout to BLE connect(2) attempts
Even working BLE devices won't immediately succeed in the first call to
connect(2), which is why the "in progress" phase was added. But absent
peers made the previous implementation try forever, getting stuck in the
sr_bt_connect_ble() call.
Try to balance these two constraints. Do terminate BLE connect attempts
after a generous timeout. When this 20s period passed, there probably is
a configuration error or unresponsive peer. Yet the timeout needs to be
in this ballpark to not erroneously fail for working setups.
Derek Hageman [Tue, 19 Feb 2019 23:26:27 +0000 (16:26 -0700)]
Add support for the Mooshimeter DMM
This adds support for the Mooshim Engineering BLE based Mooshimeter.
Because the meter requires raw BLE packets, the driver uses the BLE
layer directly. Since the meter has no physical way of configuring it,
the actual configuration is set entirely with sigrok device options.
Stefan Brüns [Sat, 14 Sep 2019 20:13:13 +0000 (22:13 +0200)]
Fix link errors when compiling with LTO enabled
When libsigrok is compiled with link-time-optimization, the linker
stumbles over the section named the same as the function. Whether this
is a compiler/linker bug or a coding error is unknown.
Renaming the special section (to the same as already used on OS X) avoids
the problem.
Gerhard Sittig [Sun, 6 Oct 2019 08:08:09 +0000 (10:08 +0200)]
build: unbreak C++ binding compilation with newer Doxygen (1.8.16)
Doxygen version 1.8.16 introduced an issue which breaks the compilation
of sigrok's C++ binding (https://github.com/doxygen/doxygen/issues/7190).
Don't set the FILE_PATTERNS variable at all, instead of assigning an
empty value. This resolves bug #1422.
This adds basic support for the Rigol MSO5000 series. It has
the same problems as the DS4000 series: Live capture provides
one digital channel per byte. Buffered memory returns the data
compressed (one byte has 8 digital channels), but the banks are
read separately. It's not possible to read uint16.
Introduce the lcr/vc4080.c source file which implements the parser for
the serial data stream of the Voltcraft 4080 LCR meter. Add the meter to
the list of supported devices in the serial-lcr driver, as well as the
PeakTech 2165 LCR meter which is another compatible device.
This implementation contains a workaround for USB based serial cables
which seem to suffer from incomplete parity handling (observed with the
FT232R based PeakTech cable). Similar approaches were seen in existing
DMM drivers.
This implementation supports the main and secondary displays. The D and Q
"displays" which are communicated in the serial packets appear unreliable
and redundant, users can have the D and Q values shown in the supported
displays.
Gerhard Sittig [Sun, 23 Jun 2019 06:19:39 +0000 (08:19 +0200)]
serial-lcr: also request packets before initial state retrieval
Commit cb5cd1538f5d introduced packet request support in the serial-lcr
device driver. Calls were added to the detection of the device's
presence, and the periodic acquisition of measurement data. Add another
call to the device configuration retrieval that follows the presence
detection, without it communication timed out with no data received.
Also slightly raise the timeout for this device configuration gathering
phase. With one second sharp, the VC4080 was detected, but getting its
current configuration kept failing. This device's serial communication
is extra slow (1200 bps) and the packets are rather large (39 bytes).
Which made the stream detect's receive routine stop checking for the
availability of more data while a packet was being received.
Gerhard Sittig [Sun, 16 Jun 2019 12:51:16 +0000 (14:51 +0200)]
serial-lcr: move probe, dev inst creation, data read out of scan
Move the initial device probe (LCR packet validity check), the creation
of the device instance after successful probe, and the subsequent packet
inspection after resource allocation out of the scan routine. This shall
improve readability of the serial-lcr driver's probe logic, and reduces
diffs when handling of multiple connections gets added later.
Add a developer comment, the serial-lcr driver needs to handle multiple
connections when the conn= spec is ambiguous (multiple cables of the
same type, with the same VID:PID).
Gerhard Sittig [Sun, 23 Jun 2019 06:36:54 +0000 (08:36 +0200)]
serial_hid: reduce verbosity, drop excessive debug messages
The HID transport for serial communication was rather noisy at log
levels of 4 and above. Now that test coverage was increased and
operation is stable, drop a lot of the excessive and redundant debug
messages in regular code paths.
According to the latest available version of the manual, as
for the RTB2000 and RTM3000 series, the RTA4000 series also
uses a slightly different dialect than other previously
supported models, in particular when it comes to the POD
(logic channel groups) handling.
I do not have such model available for testing therefore, as
for the RTB2000 and RTM3000 support recently introduced, I do
not know whether or not the RTA4000 also understands the
existing dialect. In doubt, the new official dialect is
implemented by this patch.
hameg-hmo: Add RTB2000 and RTM3000 MSO support (untested).
According to the latest available version of the manual, they
both use a slightly different dialect than currently supported
models, in particular when it comes to the POD (logic channel
groups) handling.
I do not have any of the above models available for testing
therefore I do not know whether or not they also understand
the existing dialect. In doubt, the new official dialect is
implemented by this patch.
hameg-hmo: Only update states after successful SCPI SET.
Update the oscilloscope state with new settings only after
they have been successfully stored in the device to avoid
an inconsistent state in case of SCPI SET command failure.
During the initial configuration phase of the hameg-hmo driver
only send an OPC command if a SCPI command has been previously
sent to the device so that bogus SCPI timeouts are avoided.
The current starting index for the POD name is currently wrong as it is zero.
The official POD numbering starts instead at 1 (see device panel, buttons
and manual), so the current index used for message printing and groups
naming in the driver needs to be incremented by one.
Avoid double memory freeing leading to segmentation fault in when a SCPI
command fails to get a string due conditions such as a timeout or an invalid
command.
hameg-hmo: When setting slope, also set trigger type to edge.
When setting the type of slope for the edge trigger function, also set the
trigger type to edge because it is not necessarily configured that way and
therefore such functionality might fail to work properly!
hameg-hmo: Try to find a valid serialcomm if none is supplied.
If no serial port option is specified on the command-line using the
"serialcomm" driver option, but the device is connected through USB
and it requires a known default serial port option, then use it in
order to avoid data corruption or even worse problems.
Note: the easiest way to reproduce data corruption on HMO3000 series
is to start an analog data acquisition (e.g. on channel CH1) after
switching from Ethernet mode to USB VCP mode (HO732 USB/Ethernet interface).
At the moment only the maximum number of frames to be acquired can be
configured for the Hameg/Rohde&Schwarz HMO mixed-signal oscilloscope
series driver (hameg-hmo).
This patch adds support to configure the number of samples to acquire
in both analog and digital (logic) mode.
hameg-hmo: Add support for 16 digital (logic) channels.
This patch introduces the support for 16 digital (logic) channels for the
following oscilloscope models: HMO3032, HMO3042, HMO3052 and HMO3522
(previously only 8 digital channels were supported, i.e. only 1 POD).
This patch takes care of removing an invalid product model (HMO2522)
and adds a missing product model (HMO3522) in the hameg-hmo driver,
thus extending the number of supported oscilloscope models.
Uwe Hermann [Sat, 6 Jul 2019 21:22:47 +0000 (23:22 +0200)]
hantek-4032l: Fix broken triggering on low signal.
The trigger range/mask "compression" procedure is apparently not
required and breaks triggering on a low line state.
This has been verified to fix the issue on a Hantek 4032L with FPGA
version 0x4303. It is possible that the procedure mentioned above
might be required for other FPGA versions, though that is unknown.
If you experience trigger issues with other FPGA versions, please
contact us for further debugging and testing.
Gerhard Sittig [Thu, 20 Jun 2019 09:53:36 +0000 (11:53 +0200)]
dmm/bm86x: unbreak temperature modes (two probes and no probes)
The Brymen BM86x supports up to two temperature probes. The dual display
can show individual temperatures of the two probes or differences. The
previous implementation "detected" a value of zero degrees when no probe
was attached and the display showed dash lines. When cycling assignments
of probes to displays, some valid combinations did not result in values
shown by the libsigrok driver.
An implementation detail of the formerly separate brymen-bm86x driver
was lost during recent migration of the dmm/bm86x parser into the
serial-dmm driver. When the meter's temperature function is selected,
it's essential to inspect the primary display's flags and digits, to
determine the secondary display's quantity and unit. Previous versions
never bothered to explicitly check for the "----" digits text, but the
combination of the primary's last digit showing C/F as well as the
binary C/F flags before the value provided hints which the secondary
displays group of digits and flags did not.
Gerhard Sittig [Thu, 20 Jun 2019 09:06:22 +0000 (11:06 +0200)]
serial_hid: make --list-serial output compatible with conn=, print "VID.PID"
When the list of all connections gets created which are supported by the
HID serial transport, items contain a "hid/ch9325/raw=/dev/hidraw3" path
and a "1a86:e008" pair of vendor and product IDs.
Separate the VID/PID pair by a period not a colon, so that --list-serial
output immediately becomes usable with "--driver <name>:conn=<spec>"
invocations. Eliminate the necessity to adjust clipboard context by the
user. This improves usability in cases where not a single connection
gets addressed, but a group of connections gets specified by ambiguous
conn= specs.
Gerhard Sittig [Mon, 17 Jun 2019 20:59:25 +0000 (22:59 +0200)]
serial-lcr: add support for packet request
Some meters require the reception of a request before they provide
acquisition data. Add support for the chip driver's .packet_request()
routine, and timeout handling in the serial-lcr driver. This follows
the serial-dmm model.
Gerhard Sittig [Mon, 17 Jun 2019 20:51:36 +0000 (22:51 +0200)]
serial-lcr: add support for chip specific channel names
Allow LCR chip drivers to specify custom printf() formats for their
channel names. Default to "P1" etc in the absence of format specs.
This implementation is similar to serial-dmm.
The EEVBlog 121GW meter support always registers the three-displays
parse routine with the serial-dmm device driver. The single-display
routine need not be public. Adjust the visibility.
Reduce indentation for a continued line in a nearby declaration
while we are here.
Gerhard Sittig [Wed, 12 Jun 2019 21:58:24 +0000 (23:58 +0200)]
ftdi-la: do enter the error path upon VID:PID mismatch
Bug #1390 reports that "!desc" is always true (should be: false?). But
the actual problem would be that 'desc' is _not_ NULL when none of the
supported chips' VID:PID matched (FT232H happens to "get found" then,
erroneously).
Add a sentinel to the table of supported chips, such that 'desc' becomes
NULL upon mismatch, and the error path is entered.
Gerhard Sittig [Tue, 11 Jun 2019 16:56:04 +0000 (18:56 +0200)]
serial-dmm: rename victor-dmm-ser entry, default to USB HID cable
The serial-dmm entry for Victor DMMs is able to communicate to either
geniune COM ports (RS232 or USB CDC) or the obfuscating USB HID cables.
The victor-dmm driver became obsolete and was removed. Rename the
serial-dmm entry, remove the no longer needed "-ser" suffix. Suggest a
default connection via the obfuscating USB HID cable, accept user
provided overrides for regular serial cables (same behaviour as before,
connection spec for serial ports keeps being mandatory).
Gerhard Sittig [Thu, 9 May 2019 16:11:07 +0000 (18:11 +0200)]
victor-dmm: remove obsolete device driver, has moved to serial-dmm
Remove the victor-dmm device driver. Its functionality is contained in
the Victor specific serial-over-HID transport, the FS9922 DMM parser,
and the serial-dmm device driver. The additional implementation became
obsolete.
Gerhard Sittig [Mon, 10 Jun 2019 18:15:24 +0000 (20:15 +0200)]
serial-hid: add support for (scrambling) Victor DMM cables
Introduce a serial transport which undoes the Victor DMM cable's
obfuscation to the DMM chip's original data packet. Which allows to
re-use the existing FS9922 support code, obsoleting the victor-dmm
device driver.