Commit Graph

5234 Commits

Author SHA1 Message Date
Stefan Brüns 02a8c07d89 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.

This fixes bug #1416.
2019-10-07 00:13:13 +02:00
Gerhard Sittig 2da97803e6 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.
2019-10-06 10:08:09 +02:00
Kate J. Temkin 1656cd4a4a fx2lafw: allow for sampling at 48MHz, matching a fw change 2019-10-01 23:52:00 +02:00
Jan Luebbe 6d8205ad9a manson-hcs-3xxx: support new firmware for HCS-3202
A recently bought device seems to use a different model string, but
still speaks the same protocol.
2019-09-27 15:35:38 +02:00
Sebastian Reichel f6129c8f0c rigol-ds: Add initial Rigol MSO5000 support.
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.
2019-08-21 14:54:12 +02:00
Miklos Marton 4d8338bb96 demo: Add random analog signal generation 2019-07-31 23:15:18 +02:00
Elen Eisendle b1b8a7d079 korad-kaxxxxp: Add Korad KD6005P 2019-07-31 23:15:11 +02:00
Gerhard Sittig b50970a541 lcr/vc4080: introduce LCR packet parser for Voltcraft 4080 (and PeakTech 2165)
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.
2019-07-31 22:40:44 +02:00
Gerhard Sittig 66c300c4a6 serial-lcr: also request packets before initial state retrieval
Commit cb5cd1538f 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.
2019-07-31 15:23:03 +02:00
Gerhard Sittig c4d2e6fa5e 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).
2019-07-31 15:23:03 +02:00
Gerhard Sittig 0fb4512125 dmm/bm86x.c: reduce verbosity level (packet request)
Remove a debug message from the Brymen BM86x meter's packet request method.
2019-07-31 15:23:03 +02:00
Gerhard Sittig 60117e6e9a 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.
2019-07-31 15:23:03 +02:00
Uwe Hermann ea9e7a3e82 config keys: Revert re-orderings to avoid ABI changes. 2019-07-30 23:53:42 +02:00
Uwe Hermann 1838d9f13f hameg-hmo: Fix two compiler warnings (-Wstringop-truncation).
src/hardware/hameg-hmo/protocol.c: In function ‘hmo_scope_state_get’:
  src/hardware/hameg-hmo/protocol.c:1130:2: warning: ‘strncpy’ specified bound 20 equals destination size [-Wstringop-truncation]
    strncpy(state->trigger_pattern,
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     sr_scpi_unquote_string(tmp_str),
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     MAX_ANALOG_CHANNEL_COUNT + MAX_DIGITAL_CHANNEL_COUNT);
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CC       src/hardware/hp-3478a/api.lo
    CC       src/hardware/hung-chang-dso-2100/protocol.lo
  src/hardware/hameg-hmo/api.c: In function ‘config_set’:
  src/hardware/hameg-hmo/api.c:388:3: warning: ‘strncpy’ specified bound 20 equals destination size [-Wstringop-truncation]
     strncpy(state->trigger_pattern,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      tmp_str,
      ~~~~~~~~
      MAX_ANALOG_CHANNEL_COUNT + MAX_DIGITAL_CHANNEL_COUNT);
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-07-30 23:53:42 +02:00
Uwe Hermann c38d69adf4 hameg-hmo: Fix two compiler warnings (-Warray-bounds).
src/hardware/hameg-hmo/protocol.c: In function ‘hmo_scope_state_get’:
  src/hardware/hameg-hmo/protocol.c:1035:31: warning: array subscript 0 is above array bounds of ‘char *[0]’ [-Warray-bounds]
     g_free(logic_threshold_short[i]);
            ~~~~~~~~~~~~~~~~~~~~~^~~
  src/hardware/hameg-hmo/protocol.c:1035:31: warning: array subscript 0 is above array bounds of ‘char *[0]’ [-Warray-bounds]
  src/hardware/hameg-hmo/protocol.c:974:24: warning: array subscript 0 is above array bounds of ‘char *[0]’ [-Warray-bounds]
     logic_threshold_short[i] = g_strdup((*config->logic_threshold)[i]);
     ~~~~~~~~~~~~~~~~~~~~~^~~
  src/hardware/hameg-hmo/protocol.c:974:24: warning: array subscript 0 is above array bounds of ‘char *[0]’ [-Warray-bounds]
2019-07-30 23:53:42 +02:00
Guido Trentalancia 97a000748a hameg-hmo: Add SR_CONF_HIGH_RESOLUTION and SR_CONF_PEAK_DETECTION.
Implement High Resolution mode and Peak Detection settings.

Beautify the code by reordering the Trigger Source settings
definitions.
2019-07-26 01:43:19 +02:00
Guido Trentalancia 29a9b1a0bd hameg-hmo: Get SCPI_CMD_GET_HORIZONTAL_DIV at runtime.
Get the number of horizontal divisions from the device (at runtime)
instead of hardcoding its value in the driver.
2019-07-26 01:43:19 +02:00
Guido Trentalancia a12456f1bb hameg-hmo: Don't hardcode POD/channel numbers.
Don't hardcode the number of PODs or the number of logic (digital)
channels per POD.
2019-07-26 00:55:40 +02:00
Guido Trentalancia 0c96de7223 hameg-hmo: Remove duplicate function call.
This call was inadvertently left around in commit
8cccbac8da.
2019-07-26 00:55:40 +02:00
Guido Trentalancia 66ddc22a1d hameg-hmo: Rename SCPI_CMD_GET_VERTICAL_DIV to *_SCALE.
Fix the name of the SCPI command used to get the vertical scale.
2019-07-26 00:55:40 +02:00
Guido Trentalancia 396af5ad7d hameg-hmo: Beautify trigger pattern.
Beautify the trigger pattern by removing the quotes from the SCPI response
using sr_scpi_unquote_string() and improve the string pattern handling.
2019-07-26 00:55:40 +02:00
Guido Trentalancia a058de0410 hameg-hmo: Add missing 1ns timebase for some models.
Extend the timebase setting down to 1ns from the current limit
of 2ns for all supported series except the HMO Compact.
2019-07-26 00:55:40 +02:00
Guido Trentalancia 0184aca19d hameg-hmo: Add missing quotes for SCPI_CMD_SET_TRIGGER_PATTERN. 2019-07-26 00:11:07 +02:00
Guido Trentalancia b720f16eb5 hameg-hmo: Add RTA4000 MSO support (untested).
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.
2019-07-26 00:11:07 +02:00
Guido Trentalancia aac3063300 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.
2019-07-26 00:11:07 +02:00
Guido Trentalancia 3a247d0359 hameg-hmo: Add SR_CONF_LOGIC_ANALYZER drvopt. 2019-07-26 00:11:07 +02:00
Guido Trentalancia 4f3cb1eaf7 hameg-hmo: Fix the upper limit for the vertical scale. 2019-07-26 00:11:07 +02:00
Guido Trentalancia 1203acc78f 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.
2019-07-26 00:11:07 +02:00
Guido Trentalancia 39e1972347 hameg-hmo: Fix for an incorrect samplerate being returned.
The hameg-hmo driver returns an incorrect sample rate: to reproduce this
bug, set the maximum sample rate from the ACQUIRE menu.

This patch fixes the driver so that the correct sample rate is returned.
2019-07-26 00:11:07 +02:00
Guido Trentalancia 3883934404 hameg-hmo: Avoid bogus SCPI timeouts.
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.
2019-07-26 00:11:07 +02:00
Guido Trentalancia 262061ff3d hameg-hmo: Use 1-based (not 0-based) POD numbers.
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.
2019-07-26 00:11:07 +02:00
Guido Trentalancia 830e24b68f hameg-hmo: SR_CONF_LIMIT_SAMPLES/_FRAMES don't support _GET.
The samples and frame acquisition limits are not stored in the device or
elsewhere. Therefore they should not be read.
2019-07-26 00:11:07 +02:00
Guido Trentalancia 673989692c hameg-hmo: Avoid a double-free.
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.
2019-07-26 00:11:07 +02:00
Guido Trentalancia 4fa4db2c79 hameg-hmo: Add SR_CONF_TRIGGER_PATTERN support.
Introduce support for the Pattern Trigger functionality, sometimes also
called Logic Trigger.
2019-07-26 00:11:07 +02:00
Guido Trentalancia c8ecfa6ea4 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!

This fixes parts of bug #1328.
2019-07-26 00:11:07 +02:00
Guido Trentalancia a9f3fa0548 hameg-hmo: Remove unused SCPI command enums, sort entries. 2019-07-26 00:11:07 +02:00
Guido Trentalancia 4cf90b8667 hameg-hmo: Add support for the HMO1202 MSO. 2019-07-26 00:11:07 +02:00
Guido Trentalancia e35ebc6aa3 hameg-hmo: Initial R&S RTC1000 MSO support attempt.
(might need testing)
2019-07-26 00:11:07 +02:00
Guido Trentalancia e131be0ac3 hameg-hmo: Add support for SR_CONF_LOGIC_THRESHOLD/_CUSTOM.
Update the Hameg/Rohde&Schwarz HMO driver (hameg-hmo) so that it
is possible to configure the logic threshold for digital signals.

The user can get or set the logic threshold configuration using
the channel group POD0 (and/or POD1 where available), for example:

sigrok-cli --driver hameg-hmo --get logic_threshold -g POD0
sigrok-cli --driver hameg-hmo --config logic_threshold=TTL --set -g POD0

sigrok-cli --driver hameg-hmo --get logic_threshold_custom -g POD0
sigrok-cli --driver hameg-hmo --config logic_threshold_custom=0.7 --set -g POD0
2019-07-26 00:11:07 +02:00
Guido Trentalancia 3308450089 hameg-hmo: Update the default serial port options.
Update the default serial port options for Rohde&Schwarz and
Hameg mixed-signal oscilloscope devices connected through USB.

Also, remove misplaced and unused serial port configuration option.

This patch complements fa3d104f17
in terms of updating the USB PIDs for new devices (HMO series).

This fixes parts of bug #1321.
2019-07-26 00:11:07 +02:00
Guido Trentalancia 232eb33c67 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).

This fixes parts of bug #1321.
2019-07-26 00:11:07 +02:00
Guido Trentalancia bb0665868e hameg-hmo: Avoid getting stuck upon SCPI timeouts.
Correctly set the length of the buffer used to hold the SCPI response
from the device containing the binary acquisition data.

If a timeout occurs, truncate the buffer and send the partial response
from the device instead of getting stuck on timeouts!

Thanks to Stefan Brüns for reviewing the first version of this patch
and spotting out a serious problem with it.

This fixes bug #1323.
2019-07-26 00:11:07 +02:00
Guido Trentalancia d779dcacb7 hameg-hmo: Add SR_CONF_LIMIT_SAMPLES support.
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.
2019-07-26 00:11:07 +02:00
Guido Trentalancia 6d0f3508f7 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).
2019-07-26 00:11:07 +02:00
Guido Trentalancia 91525636a6 hameg-hmo: Remove invalid HMO2522, add missing HMO3522.
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.

This fixes bug #1322.
2019-07-26 00:11:07 +02:00
Guido Trentalancia 14cb6aa40a hameg-hmo: Use g_byte_array_free() instead of g_free().
Use the appropriate glib function to free memory (byte array).

This fixes bug #1324.
2019-07-26 00:10:35 +02:00
Guido Trentalancia 4fff7b3c8a Update the pkg-config (.pc) entry for libsigrok. 2019-07-26 00:10:35 +02:00
Guido Trentalancia 1bb348cdbf std: std_gvar_tuple_array/_rational: Fix GVariantBuilder type.
Fix the type of container used to initialize the GVariantBuilder
structure which builds an array of tuples.
2019-07-26 00:10:35 +02:00
Uwe Hermann 80d3497569 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.

This fixes bug #1402.
2019-07-06 23:22:47 +02:00
Uwe Hermann e6bb2984e9 hantek-4032l: Cosmetics. 2019-07-06 23:21:22 +02:00