Commit Graph

4892 Commits

Author SHA1 Message Date
Jon Burgess 3940abcb47 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)
2018-10-22 00:02:40 +02:00
Uwe Hermann 827139ef49 siglent-sds: Consistently use gboolean/TRUE/FALSE. 2018-10-21 23:33:15 +02:00
Guido Trentalancia fa3d104f17 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).
2018-10-21 23:32:07 +02:00
Gerhard Sittig 0be955d23d dmm/eev121gw: drop an obsolete TODO comment (power measurement) 2018-10-18 19:18:46 +02:00
Gerhard Sittig 72b6f1c082 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.
2018-10-18 19:11:38 +02:00
Gerhard Sittig 39ea7b7d39 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.
2018-10-18 19:08:50 +02:00
Uwe Hermann 59cae77e28 serial_stream_detect(): Make a code comment more generic. 2018-10-14 22:05:57 +02:00
Soeren Apel d10781808d demo: Fixup soft-trigger 2018-10-14 22:05:57 +02:00
luftek 6fc51fb1ee demo: Implement logic triggering.
Analog triggers and other items still need more work.
2018-10-14 21:37:40 +02:00
luftek 31f69b096f demo: Port trigger configuration from fx2lafw. 2018-10-14 21:37:30 +02:00
Uwe Hermann 07182332f0 Random whitespace/cosmetic/typo fixes. 2018-10-14 18:21:56 +02:00
Gerhard Sittig 015df4ae8f 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.
2018-10-14 18:21:56 +02:00
Gerhard Sittig 1c3098aae0 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.
2018-10-14 18:21:56 +02:00
Thomas Weißschuh 388aa0fb6b 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 <thomas@t-8ch.de>
2018-10-14 17:43:34 +02:00
Uwe Hermann 023c6114c5 siglent-sds: Fix SR_CONF_AVERAGING/SR_CONF_AVG_SAMPLES handling. 2018-10-14 01:41:03 +02:00
marchelh c90065a949 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 <marchelh@gmail.com> and various fixups and rebasing
operations by Uwe Hermann <uwe@hermann-uwe.de>]
2018-10-14 01:40:38 +02:00
Uwe Hermann 0540954d76 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
2018-10-13 17:26:47 +02:00
Gerhard Sittig e5fa47c1c9 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).
2018-10-13 15:57:01 +02:00
Gerhard Sittig 75aaf967e3 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.
2018-10-13 15:57:01 +02:00
Gerhard Sittig f1d0755b73 uni-t-dmm: use common hex dump helper routine 2018-10-13 15:57:01 +02:00
Gerhard Sittig d8bc7ca3e6 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.
2018-10-13 15:57:01 +02:00
Gerhard Sittig 08f8421a9e 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.
2018-10-13 15:17:51 +02:00
Gerhard Sittig 712f981dff 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.
2018-10-13 15:17:51 +02:00
Gerhard Sittig fe71c7e42e 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.
2018-10-13 15:06:43 +02:00
Gerhard Sittig 4237ab9e5b 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.
2018-10-13 15:04:50 +02:00
Gerhard Sittig 76f712a73f 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
2018-10-13 14:27:56 +02:00
Uwe Hermann 11cf492183 zeroplus-logic-cube: Only emit log message upon unexpected number of bytes. 2018-10-06 19:13:39 +02:00
Uwe Hermann 2377246220 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);
            ^~~~~~~~~~~~~~~
2018-10-06 19:13:39 +02:00
Peetz0r af930bcf7b fx2lafw: Add new VID:PID for usb-c-grok 2018-10-03 19:09:29 +02:00
Gerhard Sittig 7d40b5ee62 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.
2018-10-02 19:01:25 +02:00
Gerhard Sittig e91c9f6e25 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.
2018-10-02 19:01:25 +02:00
Gerhard Sittig 48e2992f86 serial-dmm: count analog DMM channels starting at 1
Commit 556a926d43 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).
2018-10-02 19:01:25 +02:00
Gerhard Sittig 3ef305b079 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
2018-10-02 19:01:04 +02:00
Gerhard Sittig bd10287e7c Makefile: cosmetics, alpha-sort src/dmm/ entries 2018-10-02 19:01:04 +02:00
Uwe Hermann 822a9c0eda 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.
2018-10-02 15:15:27 +02:00
Martin Ling 56bcbbffd0 raw_analog: Set appropriate precision digits for sample format.
This fixes parts of bug #950.
2018-09-20 20:36:00 +02:00
Martin Ling cd1e7fd20d analog output: convert binary to digital digits of precision.
This fixes parts of bug #950.
2018-09-20 20:35:57 +02:00
Martin Ling 5e5fde6e2c 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.
2018-09-20 20:35:42 +02:00
Uwe Hermann 755793e991 scpi-pps: Add a missing "break" in config_get(). 2018-09-18 23:42:24 +02:00
Uwe Hermann 3bae09ab9f Make sr_packet_{copy,free} API calls public.
This fixes bug #1277.
2018-09-18 23:39:56 +02:00
Martin Ling 3d11872282 scpi-pps: Fix broken channel selection code.
Fixes bug #1279.
2018-09-11 13:08:12 +01:00
Martin Ling 88e4daa9ff scpi-pps: Use software sample and time limits. 2018-09-10 16:33:11 +01:00
Martin Ling 49f7cb2425 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.
2018-09-10 16:12:58 +01:00
Martin Ling cda70c2c19 Add udev rules for Rigol DP800 series. 2018-09-10 13:51:17 +01:00
Uwe Hermann 04a0e0dc1c 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.
2018-09-05 21:50:02 +02:00
Uwe Hermann f696d27e05 std: Drop unneeded/duplicate log messages.
The sr_session_send() function will already log all of those anyway.
2018-09-05 20:31:48 +02:00
Andrej Valek ee1a7d2f9d 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 <andy@skyrain.eu>
2018-09-04 01:39:06 +02:00
Soeren Apel 653d087e15 std: Fix up non-zero FP value generation 2018-09-04 01:31:56 +02:00
Gerhard Sittig 0da8e0bd2b 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.
2018-09-03 22:22:46 +02:00
Gerhard Sittig b736fa0c7d proto.h: move routine declaration to its respective group 2018-09-03 22:22:40 +02:00