Commit Graph

4935 Commits

Author SHA1 Message Date
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
Uwe Hermann 3ad0308c55 sr_resourcepaths_get(): Drop confusing log message.
This is not really needed and can sometimes confuse users.
2018-09-03 22:18:28 +02:00
Uwe Hermann 2efb3cd700 hantek-6xxx: Hantek 6022BE: Add VID/PID 04b5:6022 support.
On Windows, this device can either enumerate as 04b4:6022 or 04b5:6022,
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 #918.
2018-09-03 22:01:32 +02:00
Uwe Hermann 00f0016cc3 Consistently use the _WIN32 #define.
The _WIN32 variant is available pretty much on all compilers, others
might not be. G_OS_WIN32 would probably be an equally well-suited
alternative, but for now we standardize on _WIN32.

  http://nadeausoftware.com/articles/2012/01/c_c_tip_how_use_compiler_predefined_macros_detect_operating_system#WindowswithCygwinPOSIX
2018-09-01 21:11:45 +02:00
Uwe Hermann 9be587a148 ipdbg-la: Fix two compiler warnings on Windows.
This is happening because the send() and recv() functions
have different prototypes on POSIX and Windows. Using the casts
is required on Windows and doesn't hurt on POSIX systems.

  [...]/protocol.c: In function 'tcp_send':
  [...]/protocol.c:161:26: warning: pointer targets in passing argument 2 of 'send' differ in signedness [-Wpointer-sign]
    out = send(tcp->socket, buf, len, 0);
                            ^
  In file included from [...]/protocol.c:24:0:
  [...]/include/winsock2.h:997:34: note: expected 'const char *' but argument is of type 'const uint8_t * {aka const unsigned char *}'
     WINSOCK_API_LINKAGE int WSAAPI send(SOCKET s,const char *buf,int len,int flags);
                                    ^
  [...]/protocol.c: In function 'ipdbg_la_tcp_receive':
  [...]/protocol.c:201:32: warning: pointer targets in passing argument 2 of 'recv' differ in signedness [-Wpointer-sign]
      int len = recv(tcp->socket, buf, 1, 0);
                                  ^
  In file included from [...]/protocol.c:24:0:
  [...]/include/winsock2.h:992:34: note: expected 'char *' but argument is of type 'uint8_t * {aka unsigned char *}'
     WINSOCK_API_LINKAGE int WSAAPI recv(SOCKET s,char *buf,int len,int flags);
                                    ^
2018-09-01 21:08:10 +02:00
Uwe Hermann 3bfdadf6df ipdbg-la: Fix data_available() implementation on Windows.
[...]/protocol.c: In function 'data_available':
  [...]/protocol.c:73:38: error: 'bytes_available' undeclared (first use in this function)
    ioctlsocket(tcp->socket, FIONREAD, &bytes_available);
                                        ^
  [...]/protocol.c:73:38: note: each undeclared identifier is reported only once for each function it appears in
  [...]/protocol.c:84:1: warning: no return statement in function returning non-void [-Wreturn-type]
   }
   ^
2018-09-01 21:07:09 +02:00
Uwe Hermann 24fbd9f814 ipdbg-la: Fix a build issue on Windows.
[...]/protocol.c:41:23: fatal error: sys/ioctl.h: No such file or directory
2018-09-01 21:06:57 +02:00
Gerhard Sittig 4be5746d1d fx2lafw: silence error message in query for channel group's device options
The fx2lafw(4) driver supports mere logic analyzers as well as mixed
signal devices, but does not support channel group specific device
options. Avoid an error message when channel group device options get
queried, the condition is perfectly legal and non-fatal.

How to reproduce:
  $ pulseview -d fx2lafw
  $ sigrok-cli -d fx2lafw -g Logic --show

This fixes bug #1267.
2018-08-30 22:11:25 +02:00