]> sigrok.org Git - libsigrok.git/log
libsigrok.git
5 years agools: simplify calculation of readcount
Wolfram Sang [Wed, 2 Jan 2019 12:15:18 +0000 (13:15 +0100)]
ols: simplify calculation of readcount

Somewhen we probably want DIV_ROUND_UP from the Kernel.

Signed-off-by: Wolfram Sang <redacted>
5 years agools: drop wrong usage of macro
Wolfram Sang [Wed, 2 Jan 2019 12:15:17 +0000 (13:15 +0100)]
ols: drop wrong usage of macro

commit f51acd69 ("ols: combine demux samples") wrongly replaced the bit
pattern of 0x20 with the number of channels which just happens to be 32
as well. So, the code works but is confusing to read. Reword the
for-loop to make it more comprehensible.

Signed-off-by: Wolfram Sang <redacted>
5 years agools: use 32bit for handling sample counts
Wolfram Sang [Wed, 2 Jan 2019 12:15:16 +0000 (13:15 +0100)]
ols: use 32bit for handling sample counts

The OLS protocol sends 16bit values to specify the sample count and
delay count. However, this 16bit value is the number of 32bit words to
be sampled, so the actual sample count is 4 times larger and does not
fit into a uint16_t. Extend it to support the full range of 256K
(LogicShrimp will need this) and to prepare support for devices with
even more memory (Pepino).

Signed-off-by: Wolfram Sang <redacted>
5 years agools: remove needless initialization
Wolfram Sang [Wed, 2 Jan 2019 12:15:15 +0000 (13:15 +0100)]
ols: remove needless initialization

channel_mask is recalculated before it gets accessed, so this
initialization is not needed.

Signed-off-by: Wolfram Sang <redacted>
5 years agools: remove unused define
Wolfram Sang [Wed, 2 Jan 2019 12:15:14 +0000 (13:15 +0100)]
ols: remove unused define

Signed-off-by: Wolfram Sang <redacted>
5 years agouni-t-ut32x: rephrase the receive buffer and packets relation
Gerhard Sittig [Thu, 5 Oct 2017 23:38:26 +0000 (01:38 +0200)]
uni-t-ut32x: rephrase the receive buffer and packets relation

The previous implementation assumed that a receive data chunk ends
exactly with a sensor packet's end. Yet the buffer had 32 bytes while
the packets have 19 bytes.

Separate the data reception from the packet processing. Collect whatever
chunks the USB connection provides, and scan the resulting buffer for
packets. Cope with either incomplete or corrupt or misaligned packets as
well as with multiple packets in receive chunks. The latter might happen
upon initial synchronization, when a device already sends data or the
serial port buffered previously communicated data.

In the regular case, the computer will process so fast that each single
character will be handled individually. We don't mind. The frequency is
some 60 times per second, and the data volume is 19 bytes. The software
works for the regular case, and synchronizes fast at startup or after
comm errors.

5 years agouni-t-ut32x: improve robustness of packet parser, more diagnostics
Gerhard Sittig [Thu, 5 Oct 2017 22:34:05 +0000 (00:34 +0200)]
uni-t-ut32x: improve robustness of packet parser, more diagnostics

Always print the data bytes of received buffers in the packet parser,
then check some more fixed fields to not process invalid packets, then
process the packet content as the previous implementation did.

Call the packet parser for incomplete packets and discarded input
buffers as well (initial synchronization, re-sync after comm errors).
This results in the availability of more diagnostics during development.

Pass the packet's location and size from outside. This prepares the
logic to cope with situations where the receive buffer contains multiple
(potentially incomplete) packets.

5 years agouni-t-ut32x: use ASCII literals in packet parser, symbols for magic numbers
Gerhard Sittig [Thu, 5 Oct 2017 22:09:44 +0000 (00:09 +0200)]
uni-t-ut32x: use ASCII literals in packet parser, symbols for magic numbers

Slightly unobfuscate the UT32x packet parser. The protocol is mostly
ASCII based, checks for hex numbers may be unexpected. Use symbolic
identifiers for the packet length and some special characters.

5 years agouni-t-ut32x: comment on the "T1-T2" channel name (looks like a range)
Gerhard Sittig [Thu, 5 Oct 2017 21:26:38 +0000 (23:26 +0200)]
uni-t-ut32x: comment on the "T1-T2" channel name (looks like a range)

5 years agouni-t-ut32x: use common code for sw limits, minor data type fixup (data source)
Gerhard Sittig [Thu, 5 Oct 2017 21:16:50 +0000 (23:16 +0200)]
uni-t-ut32x: use common code for sw limits, minor data type fixup (data source)

5 years agouni-t-ut32x: pre-set to default conn= spec
Gerhard Sittig [Thu, 5 Oct 2017 09:35:25 +0000 (11:35 +0200)]
uni-t-ut32x: pre-set to default conn= spec

The previous implementation of the UT32x driver expected to see a conn=
spec, without it no device is found. Default to the USB identification
of the CH9325 chip, to make the driver work out of the box. Users still
can provide conn= specs and override the default for other cables.

5 years agodoc: update README.devices (USB detection, enable serial comm)
Gerhard Sittig [Sun, 30 Dec 2018 11:31:20 +0000 (12:31 +0100)]
doc: update README.devices (USB detection, enable serial comm)

Slightly rephrase README.devices since there is no strict distinction
into "fully automatic" and "always manual". Some drivers _accept_ conn=
specs when provided, _and_ support automatic detection of enumerable
devices, _and_ might implement defaults but also support overrides.

Nit, numerically sort the list of Uni-T cables (which is about to grow
in the future) for improved readability.

Add two more devices which require users to manually enable the serial
communication (Brymen BM257s, EEVBlog 121GW).

5 years agobindings: Add Output::format()
Martin Ling [Sun, 30 Dec 2018 03:01:21 +0000 (04:01 +0100)]
bindings: Add Output::format()

5 years agorigol-ds: Fix memory buffer readout on DS4000 series.
Martin Ling [Sat, 29 Dec 2018 02:18:05 +0000 (03:18 +0100)]
rigol-ds: Fix memory buffer readout on DS4000 series.

5 years agoAdd support for YiXingDianZi MDSO in hantek-6xxx driver.
majekw [Sun, 2 Dec 2018 12:49:44 +0000 (13:49 +0100)]
Add support for YiXingDianZi MDSO in hantek-6xxx driver.

5 years agoscpi-pps: add support for BK Precision 9130
Mike Williams [Wed, 5 Dec 2018 19:46:26 +0000 (14:46 -0500)]
scpi-pps: add support for BK Precision 9130

5 years agoscpi-dmm: add experimental Keysight 34465A support
Mike Williams [Wed, 5 Dec 2018 17:47:52 +0000 (12:47 -0500)]
scpi-dmm: add experimental Keysight 34465A support

Tested DC current, DC voltage, and resistance. Instrument gives an error
only on first measurement but the output of the measurements is correct.

5 years agocontrib/60-libsigrok.rules: Mention FT232H/ftdi-la item.
Uwe Hermann [Fri, 28 Dec 2018 12:01:45 +0000 (13:01 +0100)]
contrib/60-libsigrok.rules: Mention FT232H/ftdi-la item.

5 years agoftdi-la: added FT232H device ID
Paul [Wed, 19 Dec 2018 20:23:57 +0000 (21:23 +0100)]
ftdi-la: added FT232H device ID

5 years agobindings: Add new Context::create_end_packet() method.
Martin Ling [Thu, 27 Dec 2018 19:38:30 +0000 (20:38 +0100)]
bindings: Add new Context::create_end_packet() method.

5 years agopython: Add override for Context.create_logic_packet()
Martin Ling [Thu, 27 Dec 2018 19:38:06 +0000 (20:38 +0100)]
python: Add override for Context.create_logic_packet()

5 years agodmm/eev121gw: fix a typo in a comment
Gerhard Sittig [Thu, 20 Dec 2018 18:10:27 +0000 (19:10 +0100)]
dmm/eev121gw: fix a typo in a comment

5 years agopickit2: avoid NULL dereference in close code path
Gerhard Sittig [Wed, 19 Dec 2018 11:41:29 +0000 (12:41 +0100)]
pickit2: avoid NULL dereference in close code path

5 years agoipdbg-la: Check if limit samples is valid (leq size of ringuffer)
Daniel Anselmi [Tue, 4 Dec 2018 00:55:00 +0000 (01:55 +0100)]
ipdbg-la: Check if limit samples is valid (leq size of ringuffer)

5 years agoDon't reference SR_PACKAGE_VERSION_STRING directly in backend.c.
Martin Ling [Thu, 20 Sep 2018 20:12:28 +0000 (21:12 +0100)]
Don't reference SR_PACKAGE_VERSION_STRING directly in backend.c.

Reporting build versus runtime versions makes sense for a client,
but not inside the library itself.

5 years agoDon't reference SR_PACKAGE_VERSION_STRING directly in output modules.
Martin Ling [Thu, 20 Sep 2018 19:42:11 +0000 (20:42 +0100)]
Don't reference SR_PACKAGE_VERSION_STRING directly in output modules.

5 years agodrivers: Make per-driver sr_dev_driver structs static.
Uwe Hermann [Thu, 20 Dec 2018 07:52:51 +0000 (08:52 +0100)]
drivers: Make per-driver sr_dev_driver structs static.

5 years agomicrochip-pickit2: Drop unneeded prefix.
Uwe Hermann [Thu, 20 Dec 2018 07:35:06 +0000 (08:35 +0100)]
microchip-pickit2: Drop unneeded prefix.

5 years agomicrochip-pickit2: Minor cosmetics.
Uwe Hermann [Thu, 20 Dec 2018 07:32:56 +0000 (08:32 +0100)]
microchip-pickit2: Minor cosmetics.

5 years agomicrochip-pickit2: first driver implementation (acquisition works, triggers don't)
Gerhard Sittig [Tue, 11 Dec 2018 14:14:13 +0000 (15:14 +0100)]
microchip-pickit2: first driver implementation (acquisition works, triggers don't)

Fill in the scan, open/close, get/set/list, acquisition start/stop logic
such that data acquisition with a PICkit2 works.

Trigger support needs more attention. User specified triggers either
seem to not take effect, or the trigger position is not in the expected
location. It's yet to get determined what's the issue.

This implementation is based on protocol information gathered from the
pk2-la project.

5 years agomicrochip-pickit2: Initial driver skeleton.
Gerhard Sittig [Tue, 11 Dec 2018 11:18:07 +0000 (12:18 +0100)]
microchip-pickit2: Initial driver skeleton.

5 years agobrymen-bm86x: drop redundant free call, fixup channel index
Gerhard Sittig [Tue, 11 Dec 2018 15:52:06 +0000 (16:52 +0100)]
brymen-bm86x: drop redundant free call, fixup channel index

Remove a free() call in an error path for a list which immediately
before the call was determined to be NULL. Use index 0 and 1 for
channels P1 and P2 respectively (the previous implementation used 0
for both channels).

5 years agoscpi-dmm: run OPC queries immediately before essential commands
Gerhard Sittig [Sat, 17 Nov 2018 18:51:31 +0000 (19:51 +0100)]
scpi-dmm: run OPC queries immediately before essential commands

The current implementation of the SCPI DMM driver is conservative about
checking the device's being operational, but the *OPC? queries are found
in unfortunate locations. Run the OPC query right before running the
next "actual" command, not afterwards. And certainly not between sending
requests and potentially gathering responses in subsequent calls.

This commit does not change current behaviour, but improves maintenance
before pending commits.

5 years agoscpi-dmm: return MQ table entry to "get MQ" routine callers
Gerhard Sittig [Sat, 17 Nov 2018 18:43:38 +0000 (19:43 +0100)]
scpi-dmm: return MQ table entry to "get MQ" routine callers

The "get MQ" helper routine communicates SCPI responses and translates
them to internal "MQ and flag" values. Optionally return the MQ table
entry reference to callers, so they don't have to repeat the table
lookup when the function's default precision is required, or should
future "start acquisition" requests need to refer to the meter's current
function.

5 years agoscpi-dmm: adjust MQ table for Agilent 34405A
Gerhard Sittig [Sat, 17 Nov 2018 16:17:43 +0000 (17:17 +0100)]
scpi-dmm: adjust MQ table for Agilent 34405A

Rename the table to reflect that it's model specific. Remove the 4-wire
resistance function which this device does not support.

5 years agoscpi-dmm: add support for model specific device options
Gerhard Sittig [Sat, 17 Nov 2018 15:26:51 +0000 (16:26 +0100)]
scpi-dmm: add support for model specific device options

Supported SCPI DMM devices will differ in the set of options and whether
parameters can get queried or configured. Use a "generic" set of devopts
during scan and for simpler models, prepare support for other sets of
devopts for more complex models.

5 years agoscpi-dmm: accept serialcomm= scan options
Gerhard Sittig [Sun, 11 Nov 2018 12:42:12 +0000 (13:42 +0100)]
scpi-dmm: accept serialcomm= scan options

5 years agoscpi: alpha-sort the vendor alias list
Gerhard Sittig [Sat, 17 Nov 2018 16:32:21 +0000 (17:32 +0100)]
scpi: alpha-sort the vendor alias list

5 years agoscpi: add Keysight vendor alias
Gerhard Sittig [Sat, 17 Nov 2018 16:30:47 +0000 (17:30 +0100)]
scpi: add Keysight vendor alias

5 years agoscpi-dmm: move declaration of local variable out of header file
Gerhard Sittig [Sat, 17 Nov 2018 15:43:46 +0000 (16:43 +0100)]
scpi-dmm: move declaration of local variable out of header file

5 years agoRemove always-false condition
Michał Janiszewski [Tue, 30 Oct 2018 06:31:40 +0000 (07:31 +0100)]
Remove always-false condition

5 years agoPython-Binding: Added data array for logic packet payload
Sven Bursch-Osewold [Fri, 19 Oct 2018 07:11:36 +0000 (09:11 +0200)]
Python-Binding: Added data array for logic packet payload

5 years agoscpi-dmm: Implement support for Agilent 34405A, prepare others
Gerhard Sittig [Sun, 4 Nov 2018 18:54:17 +0000 (19:54 +0100)]
scpi-dmm: Implement support for Agilent 34405A, prepare others

Implement the scpi-dmm driver in such a generic way that it could work
with several protocol variants and with differing models which happen to
use any of these protocol variants. Prepare a list of supported models
with their respective SCPI command set, set of DMM functions and their
precision.

Add support for Agilent 34405A. The ten functions of this device got
tested and are operational, in continuous mode as well as with sample
count or capture time limits. The driver can query the current meter's
function, can change the function, and can run acquisitions in either
the current mode or with a user specified function selection. There is
some potential for improvement: AUTO/MIN/MAX/HOLD indicators are not
supported by this implementation.

5 years agoscpi-dmm: Initial driver skeleton.
Gerhard Sittig [Fri, 2 Nov 2018 17:32:33 +0000 (18:32 +0100)]
scpi-dmm: Initial driver skeleton.

5 years agoscpi: nit, use glib to determine string vector length
Gerhard Sittig [Wed, 7 Nov 2018 19:27:17 +0000 (20:27 +0100)]
scpi: nit, use glib to determine string vector length

Replace a DIY length calculation with a glib call.

5 years agoscpi: introduce string un-quote helper routine
Gerhard Sittig [Wed, 7 Nov 2018 19:22:54 +0000 (20:22 +0100)]
scpi: introduce string un-quote helper routine

The SCPI protocol may communicate strings in quoted form, enclosed by a
matching pair of single or double quote characters, and occurances of
this very quote character within the string get doubled (escaped). Add a
common routine to undo the quotes.

5 years agofluke-45: fix minor memory leaks in the probe routine
Gerhard Sittig [Sat, 3 Nov 2018 13:52:00 +0000 (14:52 +0100)]
fluke-45: fix minor memory leaks in the probe routine

Free the SCPI hardware info after successful model detection, too. Only
allocate the device instance when a supported model was found. Link the
device context earlier right after allocation, for easier verification.

5 years agofluke-45: disable ECHO test, it confuses other SCPI devices
Gerhard Sittig [Sat, 3 Nov 2018 13:34:28 +0000 (14:34 +0100)]
fluke-45: disable ECHO test, it confuses other SCPI devices

Disable the ECHO test in the Fluke 45 probe routine which violates the
SCPI protocol and makes other devices unavailable. This fixes bug #1272.

5 years agofluke-45: avoid NULL dereference in the probe routine
Gerhard Sittig [Sat, 3 Nov 2018 13:28:56 +0000 (14:28 +0100)]
fluke-45: avoid NULL dereference in the probe routine

The Fluke 45 probe routine tries to detect whether the serial port is
"in echo mode" (which already is questionable before the IDN query).
In the absence of a response, the library segfaults. Fix it.

5 years agoREADME.devices: add example for -d driver:conn=usbtmc/bus.addr
Gerhard Sittig [Wed, 7 Nov 2018 20:16:53 +0000 (21:16 +0100)]
README.devices: add example for -d driver:conn=usbtmc/bus.addr

5 years agoFree list returned by sr_session_dev_list()
Jon Burgess [Sun, 14 Oct 2018 23:17:09 +0000 (00:17 +0100)]
Free list returned by sr_session_dev_list()

==214948== 16 bytes in 1 blocks are definitely lost in loss record 161 of 6,440
==214948==    at 0x4C2EE0B: malloc (vg_replace_malloc.c:299)
==214948==    by 0x650F435: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x6527056: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x65284B0: g_slist_copy_deep (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x592BBA6: sr_session_dev_list (session.c:402)
==214948==    by 0x56EF7B5: sigrok::Session::Session(std::shared_ptr<sigrok::Context>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >) (classes.cpp:932)

==214948== 16 bytes in 1 blocks are definitely lost in loss record 162 of 6,440
==214948==    at 0x4C2EE0B: malloc (vg_replace_malloc.c:299)
==214948==    by 0x650F435: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x6527056: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x65284B0: g_slist_copy_deep (in /usr/lib64/libglib-2.0.so.0.5600.3)
==214948==    by 0x592BBA6: sr_session_dev_list (session.c:402)
==214948==    by 0x56F1EB1: sigrok::Session::devices() (classes.cpp:967)

5 years agosiglent-sds: Consistently use gboolean/TRUE/FALSE.
Uwe Hermann [Sun, 14 Oct 2018 22:04:21 +0000 (00:04 +0200)]
siglent-sds: Consistently use gboolean/TRUE/FALSE.

5 years agoAdditional USB PID for Rohde&Schwarz HMO series mixed-signal oscilloscopes
Guido Trentalancia [Sat, 20 Oct 2018 17:33:01 +0000 (19:33 +0200)]
Additional USB PID for Rohde&Schwarz HMO series mixed-signal oscilloscopes

Add another possible USB PID for Rohde&Schwarz HMO series mixed-signal
oscilloscopes (previously branded Hameg).

5 years agodmm/eev121gw: drop an obsolete TODO comment (power measurement)
Gerhard Sittig [Thu, 18 Oct 2018 17:18:46 +0000 (19:18 +0200)]
dmm/eev121gw: drop an obsolete TODO comment (power measurement)

5 years agodmm/eev121gw: cosmetics, align ranges' scaling table entries
Gerhard Sittig [Wed, 17 Oct 2018 15:46:26 +0000 (17:46 +0200)]
dmm/eev121gw: cosmetics, align ranges' scaling table entries

Align the scaling items such that all numbers are aligned. Drop unneeded
"prefixes" for the 2nd display's tables, the main and sub displays already
have their individual tables which reside in their respective groups.

5 years agodmm/eev121gw: add missing scale items for sub display in power modes
Gerhard Sittig [Tue, 16 Oct 2018 19:14:55 +0000 (21:14 +0200)]
dmm/eev121gw: add missing scale items for sub display in power modes

Complete the voltage and current scale items for the sub display which
were incomplete for VA, mVA, and uVA power measurement modes before.

5 years agoserial_stream_detect(): Make a code comment more generic.
Uwe Hermann [Sun, 14 Oct 2018 17:01:59 +0000 (19:01 +0200)]
serial_stream_detect(): Make a code comment more generic.

5 years agodemo: Fixup soft-trigger
Soeren Apel [Sun, 14 Oct 2018 18:45:25 +0000 (20:45 +0200)]
demo: Fixup soft-trigger

5 years agodemo: Implement logic triggering.
luftek [Tue, 9 Oct 2018 17:20:56 +0000 (19:20 +0200)]
demo: Implement logic triggering.

Analog triggers and other items still need more work.

5 years agodemo: Port trigger configuration from fx2lafw.
luftek [Tue, 9 Oct 2018 10:04:54 +0000 (12:04 +0200)]
demo: Port trigger configuration from fx2lafw.

5 years agoRandom whitespace/cosmetic/typo fixes.
Uwe Hermann [Sun, 27 May 2018 15:07:26 +0000 (17:07 +0200)]
Random whitespace/cosmetic/typo fixes.

5 years agoserial-dmm: add EEVblog 121GW device entry (-d eevblog-121gw:conn=<uart>)
Gerhard Sittig [Fri, 28 Sep 2018 17:38:23 +0000 (19:38 +0200)]
serial-dmm: add EEVblog 121GW device entry (-d eevblog-121gw:conn=<uart>)

Add an "eevblog-121gw" subdriver entry for the EEVblog 121GW multimeter.
Use device dependent channel names instead of the default "P1" etc names.

It's assumed that the device's binary packet data is available at a COM
port. This means that an external BT to UART gateway is required until
BLE communication will be one of libsigrok's native connection types.

5 years agodmm/eev121gw: introduce parser for EEVblog 121GW 19-byte binary packets
Gerhard Sittig [Fri, 28 Sep 2018 16:39:23 +0000 (18:39 +0200)]
dmm/eev121gw: introduce parser for EEVblog 121GW 19-byte binary packets

Introduce the dmm/eev121gw.c source file with parse routines for the
EEVblog 121GW meter's 19-bytes binary packets. Get the values and MQ
properties of the device's several displays (main, sub, bar) in several
individual parse calls.

This commit introduces initial support for the device. Some of the modes
and features are untested, as are some of the device's ranges.

5 years agoNewer versions of Victor DMMs (at least for 86) contain a direct
Thomas Weißschuh [Sun, 14 Oct 2018 15:43:34 +0000 (17:43 +0200)]
Newer versions of Victor DMMs (at least for 86) contain a direct
Mini-USB port. This port speaks the FS9922 protocol.

Picture of Mini-USB version:
http://roastlogger.co.uk/coffee/roastlogger/victor86.html

Signed-off-by: Thomas Weißschuh <redacted>
5 years agosiglent-sds: Fix SR_CONF_AVERAGING/SR_CONF_AVG_SAMPLES handling.
Uwe Hermann [Sat, 13 Oct 2018 22:27:24 +0000 (00:27 +0200)]
siglent-sds: Fix SR_CONF_AVERAGING/SR_CONF_AVG_SAMPLES handling.

5 years agosiglent-sds: Add ESERIES device support.
marchelh [Sun, 9 Sep 2018 14:11:59 +0000 (16:11 +0200)]
siglent-sds: Add ESERIES device support.

Due to some SCPI command changes that Siglent made, the connection
failed due to the wrong commands being send to the device.

This might fix parts of bug #1242, though initial tests show that
further changes might be needed.

[Note: This commit consists of multiple squashed commits from
marchelh <redacted> and various fixups and rebasing
operations by Uwe Hermann <redacted>]

5 years agokorad-kaxxxxp: Add Tenma 72-2540 V2.0/V2.1 support (untested).
Uwe Hermann [Sat, 13 Oct 2018 15:21:56 +0000 (17:21 +0200)]
korad-kaxxxxp: Add Tenma 72-2540 V2.0/V2.1 support (untested).

The IDN strings were mentioned here:
https://github.com/kxtells/tenma-serial/issues/2

5 years agoserial: dump DMM packets during stream detection
Gerhard Sittig [Mon, 8 Oct 2018 15:07:07 +0000 (17:07 +0200)]
serial: dump DMM packets during stream detection

Regular operation of serial DMM drivers optionally can dump packet bytes
after the intialization phase has synchronized to the stream. Failure to
synchronize to the stream left developers without a dump, which complicates
research what went wrong.

Do dump packet content while the serial_stream_detect() routine tries to
synchronize to the stream. Use the spew level since the dump occurs upon
every attempt, which translates to: every received byte until a valid
packet was seen (or the synchronization phase expired).

5 years agoserial-dmm: print data bytes according to specific meter's packet length
Gerhard Sittig [Sat, 29 Sep 2018 18:46:45 +0000 (20:46 +0200)]
serial-dmm: print data bytes according to specific meter's packet length

The previous implementation always dumped 23 data bytes for received
packets. This could result in truncated diagnostics information, and/or
access to invalid buffer content.

Rephrase the packet dump routine such that the specific meter's exact
packet length gets dumped, and use the common hex dump support code.

5 years agouni-t-dmm: use common hex dump helper routine
Gerhard Sittig [Sat, 6 Oct 2018 17:17:27 +0000 (19:17 +0200)]
uni-t-dmm: use common hex dump helper routine

5 years agostrutil: introduce hex dump routines (allocate a text buffer)
Gerhard Sittig [Sat, 6 Oct 2018 17:02:03 +0000 (19:02 +0200)]
strutil: introduce hex dump routines (allocate a text buffer)

Introduce common support for hex dumps in the string util collection.
There are explicit allocation and release routines for the textual
representation of the data bytes, so that callers are free to chose
whether and how to decorate the dump and where to send the message.

5 years agoinput/vcd: add channel list checks for file re-read
Gerhard Sittig [Sat, 13 Oct 2018 09:06:16 +0000 (11:06 +0200)]
input/vcd: add channel list checks for file re-read

Keep (part of) previous results around when the VCD input module gets
reset, and check the header of the next import against previous runs to
avoid issues in applications. This addresses the VCD specific part of
bug #1241, and resolves the remaining part of bug #1306.

5 years agodevice: introduce routines to compare channels and channel lists
Gerhard Sittig [Sat, 13 Oct 2018 06:19:00 +0000 (08:19 +0200)]
device: introduce routines to compare channels and channel lists

Applications are not prepared to handle changes in the channel list
between multiple acquisitions from the same source (device drivers
or input modules). Introduce common helpers to compare channels and
channel lists.

5 years agodevice: introduce common sr_channel_free() support code
Gerhard Sittig [Sat, 13 Oct 2018 06:16:18 +0000 (08:16 +0200)]
device: introduce common sr_channel_free() support code

There was the sr_channel_new() allocation routine, but releasing that
allocation was open-coded in call sites. Add the sr_channel_free()
routine for code re-use and consistency.

5 years agoinput/vcd: Expand the reset() logic
Gerhard Sittig [Fri, 12 Oct 2018 09:07:12 +0000 (11:07 +0200)]
input/vcd: Expand the reset() logic

This addresses part of bug #1306. The reset() method of the VCD input
module was incomplete, and did not process new data upon second read.
Improve robustness and add missing reset instructions. Void invalid
pointers and avoid NULL dereferences in cleanup paths.

5 years agokorad-kaxxxxp: add yet another KD3005P identification string
Gerhard Sittig [Fri, 12 Oct 2018 08:49:12 +0000 (10:49 +0200)]
korad-kaxxxxp: add yet another KD3005P identification string

Apparently there are devices which identify as "KORADKD3005PV2.0" (no
whitespace, no trailing 0x01). Add another model entry.

Reported-By: Lars Pötter
5 years agozeroplus-logic-cube: Only emit log message upon unexpected number of bytes.
Uwe Hermann [Sat, 6 Oct 2018 15:14:24 +0000 (17:14 +0200)]
zeroplus-logic-cube: Only emit log message upon unexpected number of bytes.

5 years agoFix various gcc 8 compiler warnings related to ARRAY_SIZE.
Uwe Hermann [Tue, 18 Sep 2018 21:21:40 +0000 (23:21 +0200)]
Fix various gcc 8 compiler warnings related to ARRAY_SIZE.

Example:

  In file included from src/hardware/kecheng-kc-330b/protocol.h:26,
                   from src/hardware/kecheng-kc-330b/api.c:22:
  src/hardware/kecheng-kc-330b/api.c: In function ‘config_list’:
  src/libsigrok-internal.h:51:34: warning: division ‘sizeof (void *) / sizeof (void)’ does not compute the number of array elements [-Wsizeof-pointer-div]
   #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
                                    ^
  src/libsigrok-internal.h:55:32: note: in expansion of macro ‘ARRAY_SIZE’
   #define ARRAY_AND_SIZE(a) (a), ARRAY_SIZE(a)
                                  ^~~~~~~~~~
  src/libsigrok-internal.h:964:43: note: in expansion of macro ‘ARRAY_AND_SIZE’
    std_opts_config_list(key, data, sdi, cg, ARRAY_AND_SIZE(scanopts), \
                                             ^~~~~~~~~~~~~~
  src/hardware/kecheng-kc-330b/api.c:296:10: note: in expansion of macro ‘STD_CONFIG_LIST’
     return STD_CONFIG_LIST(key, data, sdi, cg, NULL, drvopts, devopts);
            ^~~~~~~~~~~~~~~

5 years agofx2lafw: Add new VID:PID for usb-c-grok
Peetz0r [Tue, 11 Sep 2018 15:20:20 +0000 (17:20 +0200)]
fx2lafw: Add new VID:PID for usb-c-grok

5 years agoserial-dmm: introduce support for subdriver specific channel names
Gerhard Sittig [Sun, 30 Sep 2018 02:45:27 +0000 (04:45 +0200)]
serial-dmm: introduce support for subdriver specific channel names

Default to the existing "P1" etc naming scheme for analog channels of
serial-dmm subdrivers. Add support for subdriver specific channel names
(which can reference the channel number if they desire). This is useful
for devices with multiple displays, or special purpose devices where
other names than P1 can better reflect the channel's nature.

5 years agoserial-dmm: only send acquisition data for enabled channels
Gerhard Sittig [Sun, 30 Sep 2018 20:16:52 +0000 (22:16 +0200)]
serial-dmm: only send acquisition data for enabled channels

Respect the user's "channel enabled" status. Do not feed the session bus
when data for disabled channels was received.

5 years agoserial-dmm: count analog DMM channels starting at 1
Gerhard Sittig [Sun, 30 Sep 2018 02:36:39 +0000 (04:36 +0200)]
serial-dmm: count analog DMM channels starting at 1

Commit 556a926d432dd introduced support for multiple displays in
subdrivers of serial-dmm, but also changed user visible channel numbers
to start from 0. Restore the previous behaviour, start counting from 1
which users may perceive as more natural (serial-dmm used to start at P1
in the past, scopes start with CH1 as well).

5 years agobrymen-bm86x: avoid NULL deref when usb->devhdl does not exist
Gerhard Sittig [Sun, 30 Sep 2018 19:52:21 +0000 (21:52 +0200)]
brymen-bm86x: avoid NULL deref when usb->devhdl does not exist

There are code paths where dev_close() tries to access a USB handle
which does not exist. This was observed with this command:

  $ sigrok-cli -d brymen-bm86x --scan

5 years agoMakefile: cosmetics, alpha-sort src/dmm/ entries
Gerhard Sittig [Fri, 28 Sep 2018 17:45:28 +0000 (19:45 +0200)]
Makefile: cosmetics, alpha-sort src/dmm/ entries

5 years agohantek-6xxx: Hantek 6022BL: Add VID/PID 04b5:602a support.
Uwe Hermann [Tue, 2 Oct 2018 13:15:27 +0000 (15:15 +0200)]
hantek-6xxx: Hantek 6022BL: Add VID/PID 04b5:602a support.

On Windows, this device can either enumerate as 04b4:602a or 04b5:602a,
depending on which vendor driver is currently being used, so we have to
support both in the hantek-6xxx driver as well.

This fixes bug #1295.

5 years agoraw_analog: Set appropriate precision digits for sample format.
Martin Ling [Thu, 20 Sep 2018 01:04:12 +0000 (02:04 +0100)]
raw_analog: Set appropriate precision digits for sample format.

This fixes parts of bug #950.

5 years agoanalog output: convert binary to digital digits of precision.
Martin Ling [Thu, 20 Sep 2018 01:40:06 +0000 (02:40 +0100)]
analog output: convert binary to digital digits of precision.

This fixes parts of bug #950.

5 years agoFix read past end of array in sr_analog_si_prefix_friendly.
Martin Ling [Thu, 20 Sep 2018 00:45:22 +0000 (01:45 +0100)]
Fix read past end of array in sr_analog_si_prefix_friendly.

In the case where the input unit was not in the array, the for loop would
complete, but the following test would then read past the end of the array
since 'i' would already have been incremented to the array size.

Spotted because unitless data was getting SI prefixes with no unit, though
this would not have been deterministically reproducible.

This fixes parts of bug #950.

5 years agoscpi-pps: Add a missing "break" in config_get().
Uwe Hermann [Tue, 18 Sep 2018 21:42:24 +0000 (23:42 +0200)]
scpi-pps: Add a missing "break" in config_get().

5 years agoMake sr_packet_{copy,free} API calls public.
Uwe Hermann [Tue, 18 Sep 2018 21:39:56 +0000 (23:39 +0200)]
Make sr_packet_{copy,free} API calls public.

This fixes bug #1277.

5 years agoscpi-pps: Fix broken channel selection code.
Martin Ling [Tue, 11 Sep 2018 12:08:12 +0000 (13:08 +0100)]
scpi-pps: Fix broken channel selection code.

Fixes bug #1279.

5 years agoscpi-pps: Use software sample and time limits.
Martin Ling [Mon, 10 Sep 2018 14:06:25 +0000 (15:06 +0100)]
scpi-pps: Use software sample and time limits.

5 years agoscpi-pps: Don't block waiting for a value on capture stop.
Martin Ling [Mon, 10 Sep 2018 15:10:31 +0000 (16:10 +0100)]
scpi-pps: Don't block waiting for a value on capture stop.

The comment says "A requested value is certainly on the way", but the code no
longer works this way. The receive handler requests a value and blocks until
it is received. There is no value pending between receive handler calls, so
this code now only leads to a timeout.

5 years agoAdd udev rules for Rigol DP800 series.
Martin Ling [Mon, 10 Sep 2018 12:51:17 +0000 (13:51 +0100)]
Add udev rules for Rigol DP800 series.

5 years agooutput/csv: Disable the dedup option by default.
Uwe Hermann [Wed, 5 Sep 2018 19:50:02 +0000 (21:50 +0200)]
output/csv: Disable the dedup option by default.

Having this on by default is surprising to most users, since csv is
not usually associated with having a VCD-like dedup property/feature.

5 years agostd: Drop unneeded/duplicate log messages.
Uwe Hermann [Wed, 5 Sep 2018 18:31:48 +0000 (20:31 +0200)]
std: Drop unneeded/duplicate log messages.

The sr_session_send() function will already log all of those anyway.

5 years agohantek-4032l: Fix default threshold value selection (FP workaround).
Andrej Valek [Thu, 23 Aug 2018 18:48:43 +0000 (20:48 +0200)]
hantek-4032l: Fix default threshold value selection (FP workaround).

Take value from generated array of range instead of using a hard-coded value.

Signed-off-by: Andrej Valek <redacted>
5 years agostd: Fix up non-zero FP value generation
Soeren Apel [Tue, 14 Aug 2018 08:03:35 +0000 (10:03 +0200)]
std: Fix up non-zero FP value generation

5 years agoinput: improve robustness, avoid NULL dereference in sr_input_send()
Gerhard Sittig [Mon, 4 Jun 2018 21:21:01 +0000 (23:21 +0200)]
input: improve robustness, avoid NULL dereference in sr_input_send()

Applications might pass NULL for the buffer, and input modules might
accept it (or just cope). Eliminate a potential NULL dereference in
the emission of diagnostics messages.

5 years agoproto.h: move routine declaration to its respective group
Gerhard Sittig [Mon, 4 Jun 2018 21:44:30 +0000 (23:44 +0200)]
proto.h: move routine declaration to its respective group