Commit Graph

5571 Commits

Author SHA1 Message Date
Gerhard Sittig 4ddea31451 output/vcd: use larger data type to internally store frequency
The 'period' member of the VCD output module's context is supposed to
hold frequencies that correspond to the timescale used during export.
An 'int' (in combination with VCD's 1/10/100 constraint) thus would
result in a 1GHz limit, use uint64_t instead to support higher rates.
2019-12-21 17:19:50 +01:00
Gerhard Sittig 3895064542 output/wavedrom: rephrase accumulation of output data
Iterate over the received sample set first, before iterating over the
respective sample's number of channels. This avoids redundant extraction
of sampled bits (which saves only little), but also increases locality
of processed data (though string accumulation still may be expensive).

It also adds the future option of RLE compression during accumulation of
output data, which perfectly matches the WaveDrom syntax for repeated
bit patterns.
2019-12-21 13:58:43 +01:00
Gerhard Sittig 7a0d1bdc20 output/wavedrom: separate data processing logic from init/cleanup
Rearrange the order of routines in the wavedrom output module. Keep the
flow of .receive() -> .process_logic() -> .wavedrom_render() in one common
group of routines, which is not disrupted by the .init() and .cleanup()
routines which are kind of boilerplate in the source file. This increases
readability and maintainability.
2019-12-21 13:58:43 +01:00
Gerhard Sittig dd5735c998 output/wavedrom: address style nits
Adjust brace style, use C language comments, drop camel case. Use size_t
for indices and offsets. Unobfuscate the open/close logic of rendered
output. Allocate zero-filled memory, reduce sizeof() redundancy. Don't
SHOUT in the module's .name property.

[ Changes indentation, see 'git diff -w -b' for review. ]
2019-12-21 13:58:43 +01:00
Marc Jacobi 40f812f5dc output/wavedrom: introduce a wavedrom output module
WaveDrom provides a textual description of digital timing diagrams,
using the JSON syntax. See https://wavedrom.com/ for more details.
2019-12-21 13:58:43 +01:00
Frank Stettner 675cb86f15 hp-3478a: Check for overflow. 2019-12-20 23:08:51 +01:00
Frank Stettner 7812a5c802 hp-3478a: Add get/set/list of digits. 2019-12-20 23:08:51 +01:00
Frank Stettner e5137b9343 hp-3478a: Add get/set/list of measurement ranges. 2019-12-20 23:07:25 +01:00
Frank Stettner ccf68765aa Add config key SR_CONF_DIGITS. 2019-12-20 13:02:06 +01:00
Frank Stettner 84b4f9a1ff Add config key SR_CONF_RANGE. 2019-12-20 13:02:06 +01:00
Michał Janiszewski e3f86ef5fc beaglelogic: Fix mismatched printf specifiers. 2019-12-19 22:20:47 +01:00
Uwe Hermann 599f9e1deb README.devices: Various updates.
- Mention missing drivers that require (or not) firmware uploads.

 - Update HID "chip" spec options.

 - Remove rarely useful and hard to maintain lists of drivers requiring
   serial port, HID, Bluetooth, BLE, or network conn specs.
2019-12-19 22:15:43 +01:00
Uwe Hermann 349c5e5432 README: Clarify bluez/libbluetooth name. 2019-12-19 22:13:51 +01:00
Gerhard Sittig dc40081706 asix-sigma: comment on trigger/stop position, silence warning
Add a comment on the logic which skips the upper 64 bytes of a 512 bytes
chunk in the Asix Sigma's sample memory. Move the initial assignment and
the subsequent update from a value which was retrieved from a hardware
register closer together for awareness during maintenance. Pre-setting a
high position value that will never match when the feature is not in use
is very appropriate.

Adjust the sigma_read_pos() routine to handle triggerpos identically to
stoppos. The test condition's intention is to check whether a decrement
of the position ends up in the meta data section of a chunk. The previous
implementation tested whether a pointer to the position variable ended in
0x1ff when decremented -- which is unrelated to the driver's operation.
It's assumed that no harm was done because the trigger feature is
unsupported (see bug #359).

This silences the compiler warning reported in bug #1411.
2019-12-19 21:18:35 +01:00
Adrian Godwin a16198316f scpi-dmm: Added minimal support for HP34401A (PR #36) 2019-12-17 00:08:09 +01:00
Peter Åstrand cf6beeb20d korad-kaxxxxp: Add support for RND 320-KD3005P (PR #35)
Since this model replies with a serial number, truncate before that
2019-12-17 00:08:03 +01:00
Sylvain Pelissier 24931412ee lecroy-xstream: Remove header read (PR #33) 2019-12-16 23:52:50 +01:00
Andreas Sandberg 19ab8e363e 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.
2019-12-16 15:51:07 +01:00
Frank Stettner 253d653d4d korad-kaxxxxp: Reword debug output for the status byte. 2019-12-16 15:42:53 +01:00
Frank Stettner 2e129b8b25 korad-kaxxxxp: Send META packet when states have changed. 2019-12-16 15:42:49 +01:00
Frank Stettner 8da30037cf 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.
2019-12-16 15:42:36 +01:00
Frank Stettner dfdf4c83ff rdtech-dps: Send META package when states have changed. 2019-12-16 15:38:58 +01:00
Frank Stettner cce6a8a1b7 rdtech-dps: Handle different current/voltage digits for the various models. 2019-12-16 15:38:54 +01:00
Frank Stettner aff2094193 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.
2019-11-13 10:09:07 +01:00
Frank Stettner c9b187a607 rdtech-dps: Use SR_MQFLAG_DC only for voltage and current channels. 2019-11-12 23:14:33 +01:00
Frank Stettner 7c0891b0b8 rdtech-dps: Synchronize read and write operations. 2019-11-12 23:14:33 +01:00
Sylvain Pelissier ef62ab6c73 Add udev rule for Lecroy WaveRunner oscilloscope 2019-11-09 15:53:29 +01:00
Gerhard Sittig ad4174c1d8 ols: introduce metadata quirks support, unbreak Logic Shrimp
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.
2019-11-07 23:16:06 +01:00
Sylvain Munaut cfdc80151b 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

This fixes bug #1271.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2019-11-02 16:38:13 +01:00
Marc Schink f216309fd0 demo: Fix memory leak
How to reproduce:

 $ G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind --leak-check=full sigrok-cli --scan --driver demo

Signed-off-by: Marc Schink <dev@zapb.de>
2019-11-02 15:32:22 +01:00
Gerhard Sittig 76dea519e4 mooshimeter-dmm: silence compiler warning (memset() prototypes)
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, ':');
           ^
  ...
2019-10-29 17:50:07 +01:00
Gerhard Sittig 113de3a572 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.
2019-10-29 17:42:34 +01:00
Uwe Hermann 0f92d5db03 bt/bt_bluez: Adjust some log levels. 2019-10-26 21:31:51 +02:00
Uwe Hermann f314d87111 bt/bt_bluez: Remove some no longer needed verbose log messages. 2019-10-26 21:31:51 +02:00
Uwe Hermann 2489de3a24 README: Mention new (optional) libgio dependency.
libgio may or may not be part of a larger libglib package, depending on
OS and distro.
2019-10-26 21:31:51 +02:00
Uwe Hermann 59d916fe67 mooshimeter-dmm: Only report successful scan upon working connection. 2019-10-26 21:10:48 +02:00
Derek Hageman ebcd1aba01 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.
2019-10-22 12:21:47 +02:00
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