Commit Graph

2149 Commits

Author SHA1 Message Date
Gerhard Sittig 0617bb5a4e scpi-dmm: move declaration of local variable out of header file 2018-11-17 20:07:21 +01:00
Michał Janiszewski 3e33089b72 Remove always-false condition 2018-11-10 23:20:29 +01:00
Gerhard Sittig 3cdad416e4 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.
2018-11-10 23:14:49 +01:00
Gerhard Sittig 7a396ff5c5 scpi-dmm: Initial driver skeleton. 2018-11-10 20:11:35 +01:00
Gerhard Sittig a1ce15d4a1 scpi: nit, use glib to determine string vector length
Replace a DIY length calculation with a glib call.
2018-11-10 20:11:35 +01:00
Gerhard Sittig a019bc48fd 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.
2018-11-10 18:26:30 +01:00
Gerhard Sittig c10b0276da 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.
2018-11-10 18:26:30 +01:00
Gerhard Sittig 71db2d4d06 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.
2018-11-10 18:26:30 +01:00
Gerhard Sittig 712f7d5e40 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.
2018-11-10 18:26:30 +01:00
Uwe Hermann 827139ef49 siglent-sds: Consistently use gboolean/TRUE/FALSE. 2018-10-21 23:33:15 +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
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
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
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
Gerhard Sittig 1372bdcdb5 saleae and other FX2: show firmware name when loading fails
The "firmware load failed" message would be even more helpful if users
could learn which firmware file failed to load. Add those filenames to
various FX2-based drivers.

This addresses bug #1262.
2018-08-30 22:05:56 +02:00
Uwe Hermann ee425a466a Add a new sr_log_callback_get() API call. 2018-08-30 19:11:30 +02:00
Uwe Hermann 8bc8e9094c ipdbg-la: scan(): Use g_strdup_printf(). 2018-08-30 02:02:51 +02:00
Uwe Hermann 4d33f5e112 ipdbg-la: Make some functions static. 2018-08-30 01:56:35 +02:00
Uwe Hermann ac3625bef9 ipdbg-la: Avoid CamelCaps and ALLCAPS variable names. 2018-08-30 01:35:48 +02:00
Uwe Hermann 703fb45490 ipdbg-la: Drop some unneeded casts. 2018-08-30 01:22:10 +02:00
Uwe Hermann 4465837b7d ipdbg-la: data_available(): Return gboolean. 2018-08-30 01:22:10 +02:00
Uwe Hermann 3831eaf9f4 ipdbg-la: Use std_init() and std_dev_list(). 2018-08-30 01:22:02 +02:00
Uwe Hermann 4838c6ca5a ipdbg-la: Consistently use g_strerror(). 2018-08-30 00:53:18 +02:00
Uwe Hermann fac36d0a77 ipdbg-la: Drop unneeded g_malloc0() checks for small allocations. 2018-08-30 00:52:19 +02:00
Uwe Hermann 13ac501acd ipdbg-la: Drop unneeded sdi->status handling.
This is already done by the backend wrapper functions.
2018-08-30 00:50:35 +02:00
Uwe Hermann 77b6b98d1c ipdbg-la: Simplify config_get/_set/_list. 2018-08-30 00:47:03 +02:00
Uwe Hermann 1f9652a861 ipdbg-la: Fix devopts[] contents. 2018-08-30 00:39:40 +02:00
Uwe Hermann 1f15efc1f7 ipdbg-la: Drop various unneeded name prefixes. 2018-08-30 00:33:39 +02:00
Uwe Hermann 932ef10f12 ipdbg-la: Fix incorrect copyright headers.
As per Daniel Anselmi <danselmi@gmx.ch> in an email conversation, the
code was actually written by Eva Kissling <eva.kissling@bluewin.ch>
(as indicated in the commit logs as well). Fix the headers accordingly.
2018-08-30 00:33:39 +02:00
Uwe Hermann 8a9788e2b7 ipdbg-la: Consistently use the same naming everywhere.
Use "ipdbg-la" everywhere to refer to the driver, including
in function name prefixes etc. There's no need to encode
website details (.org) into the driver/function name(s).
2018-08-30 00:11:51 +02:00
Soeren Apel ed18648423 ipdbg-la: Allow rx to time out and handle invalid data properly
This is required for when we connect to invalid devices, e.g.
port 4243 of the IPDBG host instead of 4242.
2018-08-29 23:59:48 +02:00
Soeren Apel 8771222588 ipdbg-la: Remove SR_CONF_SERIALCOMM 2018-08-29 23:59:45 +02:00
Soeren Apel 9d2e5483dc ipdbg-la: Adjust to sigrok indentation style 2018-08-29 23:59:42 +02:00
Soeren Apel 7f4c9a0444 ipdbg-la: More style fixes 2018-08-29 23:59:39 +02:00
Soeren Apel 38e7493dd1 ipdbg-la: Style fixes 2018-08-29 23:59:35 +02:00
Eva Kissling b51288e3da ipdbg-la: stop-command 2018-08-29 23:59:32 +02:00
Eva Kissling b8fa29a175 ipdbg-la: stop-function pulseview 2018-08-29 23:59:30 +02:00
Eva Kissling a66099c6fa ipdbg-la: add edge trigger option 2018-08-29 23:59:27 +02:00
Eva Kissling 2f15f5bfec ipdbg-la: revers order of trigger settings 2018-08-29 23:59:25 +02:00
Eva Kissling a54144c0bd ipdbg-la: return correct samples limit 2018-08-29 23:59:22 +02:00
Eva Kissling 8f6b0eb12a ipdbg-la: add "loggs" 2018-08-29 23:59:20 +02:00
Eva Kissling 750303aab8 ipdbg-la: get rid of crash on shutdown 2018-08-29 23:59:17 +02:00
Eva Kissling d37c6daa84 ipdbg-la: reduce warnings (added explicit casts) 2018-08-29 23:59:14 +02:00
Eva Kissling a4210e1890 ipdbg-la: Add changes for IPDBG project 2018-08-29 23:59:10 +02:00
Uwe Hermann 17e0251d84 sr_buildinfo_libs_get(): Also support LIBUSBX_API_VERSION.
This fixes a build issue on some distros / libusb versions.
2018-07-22 18:01:22 +02:00
Uwe Hermann 19d816c54a input/wav: Fix potential buffer overflow (and compiler warning).
With gcc 8 this yielded:

  src/input/wav.c: In function ‘receive’:
  src/input/wav.c:345:51: warning: ‘%d’ directive output may be truncated writing between 1 and 10 bytes into a region of size 6 [-Wformat-truncation=]
       snprintf(channelname, sizeof(channelname), "CH%d", i + 1);
                                                     ^~
  src/input/wav.c:345:48: note: directive argument in the range [1, 2147483647]
       snprintf(channelname, sizeof(channelname), "CH%d", i + 1);
                                                  ^~~~~~
  src/input/wav.c:345:5: note: ‘snprintf’ output between 4 and 13 bytes into a destination of size 8
       snprintf(channelname, sizeof(channelname), "CH%d", i + 1);
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-07-22 16:59:38 +02:00
Uwe Hermann 0f5bba9622 strutil.c: Use gboolean in favor of bool for consistency. 2018-07-22 16:37:58 +02:00
Gerhard Sittig d875496366 strutil: insist in some mantissa for parse rational
The previous implementation accepted either empty integer or empty
fractional parts of a floating point number, but also when both parts
were missing ("." input). Insist in at least one of the parts to be
present.
2018-07-22 16:36:15 +02:00
Gerhard Sittig 7f5bfd6130 strutil: accept leading whitespace in parse rational
Programmatic output of floating point numbers might choose to print
spaces instead of an explicit '+' sign, to align the output with the
result of formatting negative numbers yet achieve a screen appearance
similar to what humans would have written. Skip leading whitespace
before insisting in seeing either signs or digits or decimals.
2018-07-22 16:36:15 +02:00
Gerhard Sittig 42408643f9 strutil: handle empty fractional in parse rational
Accept numbers like "123." where the period (dot) is present yet the
fractional part is empty. Adding a period but no additional digits is a
popular method of turning an otherwise integer literal into a float.
Compilers and strtod() routines accept this notation, too, so we have to
expect seeing such input.
2018-07-22 16:36:15 +02:00
Gerhard Sittig dd3202febf strutil: cosmetics, fixup minor style nits 2018-07-22 16:36:15 +02:00
Gerhard Sittig ed367d6820 input/vcd: abort VCD import when timestamp counts backwards
The VCD specification requests that timestamps will strictly increase as
one advances through the file. Add another check where the previous
implementation resulted in a tight loop and made the application stall.
Do print an error message and abort file processing in that case.

This fixes bug #1250.
2018-07-22 16:15:26 +02:00
Uwe Hermann e6104296c2 sr_buildinfo_libs_get(): Show LIBUSB_API_VERSION. 2018-07-19 23:56:33 +02:00
Uwe Hermann 51bf39a163 strutil: Fix unit test failure (bug #1093).
Patch by Wojciech Lazarski, thanks a lot!
2018-07-17 19:06:05 +02:00
Gerhard Sittig 3387a5d8ee output: simplify trigger marker position calculation (readability)
This amends commit 67b345b981 which fixed the calculation of the
trigger marker's position. Improve readability of the formulae and
adjust comments.
2018-07-15 20:47:08 +02:00
Gerhard Sittig 67b345b981 output: fixup trigger marker position in ascii/bits/hex output modules
Adjust the calculation of the '^' marker's position in T: lines of the
-O ascii/bits/hex output modules such that it matches the sample data
lines' layout. Add comments which discuss the motivation of the marker
position's calculation, which differs among each of those modules.

Strictly speaking -O bits was already correct. But I chose to adjust and
comment the logic such that multiple output modules follow a common
pattern. If performance is an issue, the bits.c change might be worth
reverting.

This commit fixes bug #1238.
2018-07-15 19:40:00 +02:00
Uwe Hermann 769561cbe9 std: Improve prototypes of some functions. 2018-06-26 16:42:43 +02:00
Uwe Hermann 0f523f2b45 rigol-ds: Add initial Agilent MSO7034A support.
Digital channels (and various other features) are not yet supported.
2018-06-22 22:53:11 +02:00
Uwe Hermann 9ad1d49c4c rigol-ds: Improve a log message. 2018-06-22 19:20:44 +02:00
Uwe Hermann c26107b745 siglent-sds: Drop currently unused switch/case. 2018-06-22 18:54:28 +02:00
Uwe Hermann eb354840f0 siglent_sds_channel_start(): Use ternary operator to shorten code. 2018-06-22 18:54:28 +02:00
Uwe Hermann 55bece00aa rigol-ds: Add missing "return SR_ERR". 2018-06-22 10:53:03 +02:00
marchelh e5b41b8d7e siglent-sds: Fixed samplerate and memory depth calculation 2018-06-22 10:51:50 +02:00
marchelh 7e776c70b0 siglent-sds: Fix, USB connection problem partially solved, bug #1130 2018-06-22 10:51:39 +02:00
Valentin Ochs 6b04525ba2 rigol-ds: Initial patch for Rigol DS4000 support
This fixes bug #1208.
2018-06-22 01:55:02 +02:00
Valentin Ochs 643c8824a5 rigol-ds: Rename the CHANINFO macro and comment it 2018-06-22 00:47:09 +02:00
Valentin Ochs 6bcc81ac3a rigol-ds: Store trigger sources and their number for each model
Store trigger sources and their number for each model when it is probed
and use that.

This fixes bug #299.
2018-06-22 00:35:44 +02:00
Uwe Hermann c5c6fa0f22 serial-dmm: Fix Voltcraft VC-96 sorting. 2018-06-18 16:30:04 +02:00
Uwe Hermann 4a6751fd07 dmm/vc96: Drop some obsolete debug output. 2018-06-18 16:30:04 +02:00
Matthias Schulz 9456d63610 Add support for the Voltcraft VC-96 DMM. 2018-06-18 16:30:04 +02:00
Adrian Stratulat b8fcae5a12 dtm0660: Do not apply the exponent twice on the value
This fixes bug #1236.
2018-06-18 15:26:46 +02:00
Joerg Alpers 10481ef05d Fix: Bug #1188 DSLogic triggering 2018-06-16 19:31:44 +02:00
JohnCh ab2b21fb68 fluke-45: Add initial driver implementation. 2018-06-15 15:48:49 +02:00
JohnCh e756c595b6 fluke-45: Initial driver skeleton. 2018-06-15 15:05:04 +02:00
Uwe Hermann f1e82915a8 gwinstek-gpd: Fix sr_dev_driver struct. 2018-06-15 00:18:22 +02:00
Uwe Hermann 380d3b2ae8 gwinstek-gpd: Avoid some unnecessary assignments. 2018-06-14 22:48:26 +02:00
Uwe Hermann eaa8c6597b gwinstek-gpd: Drop some unneeded debug logs. 2018-06-14 22:48:26 +02:00
Bastian Schmitz b872ab7d30 gwinstek-gpd: Initial implementation. 2018-06-14 14:19:08 +02:00
Soeren Apel 5eb39a91f3 wav: Don't assume CHUNK_SIZE >= total_samples 2018-06-06 22:07:04 +02:00
Uwe Hermann bf2a6eeaa0 hantek-4032l: Minor cosmetic fix. 2018-06-06 00:01:04 +02:00
Uwe Hermann c7b5c3588e hantek-4032l: Rename 'devc->buffer' to 'devc->buf'.
This is shorter and also avoids confusion with transfer->buffer.
2018-06-05 23:59:24 +02:00
Uwe Hermann 7b9387b8f0 hantek-4032l: Rename number_samples to num_samples. 2018-06-05 23:56:30 +02:00
Uwe Hermann 264a4cb2b8 hantek-4032l: Use MIN() where possible. 2018-06-05 23:55:23 +02:00
Uwe Hermann cbc656e45f hantek-4032l: Simplify some config_get/_set parts.
Also, drop some unneeded checks.
2018-06-05 23:43:23 +02:00
Uwe Hermann 583fc126d0 hantek-4032l: config_set(): Simplify SR_CONF_CAPTURE_RATIO case.
The sr_config_set() wrapper already checks the value.
2018-06-05 23:16:02 +02:00
Uwe Hermann 2dcd904c18 hantek-4032l: Drop some unneeded malloc checks.
As per guidelines in HACKING.
2018-06-05 23:02:58 +02:00
Uwe Hermann 61803a29aa hantek-4032l: Reduce indentation level a bit. 2018-06-05 22:59:29 +02:00
Uwe Hermann b8a954c586 zketech-ebd-usb: Fix a compiler warning. 2018-06-05 22:01:12 +02:00
Andrej Valek f49065c668 hantek-4032l: Add support for external clocks.
These options are NOT available for FPGA version 0.

- add option to select edge type

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 22:01:12 +02:00
Andrej Valek bc294eaca8 Add SR_CONF_EXTERNAL_CLOCK_SOURCE key.
Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 22:01:12 +02:00
Andrej Valek 2a80186103 hantek-4032l: Separate threshold channels.
Split global threshold into channels A and B.

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 22:01:12 +02:00
Andrej Valek caad0024fb hantek-4032l: Set new pwm threshold handling.
Calculate threshold values from <-6.0;6.0> range.

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 17:16:39 +02:00
Andrej Valek 3dc976fe9f hantek-4032l: Implement trigger handling.
Send trigger position to upper layer.

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 17:16:39 +02:00
Andrej Valek 4b75f84c01 hantek-4032l: Set maximum samples size to 64MB.
Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 17:11:43 +02:00
Andrej Valek 2958315ded hantek-4032l: Increase speed of data getting.
- add support for multiple transfers.
 - set nummber of samples to 1 for FPGA FW version 0
- increase size of data transfer buffer to 2kB.

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 17:10:14 +02:00
Andrej Valek 43d8603571 hantek-4032l: Separate USB receive callbacks.
Callback for data transfer is separated from status. This change will be
used for better data transfer sending/receiving. Cast signal, that trigger
has been captured was moved into state: H4032L_STATUS_FIRST_TRANSFER.

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 16:57:48 +02:00
Andrej Valek 7a7afc0086 hantek-4032l: Get FGPA version.
- get FPGA version in dev_open
 - enable some features only for newer FPGA
- decrease printing number of message of FPGA version

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 16:57:48 +02:00
Andrej Valek 28f2d07fe5 hantek-4032l: Unify style.
Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-06-05 16:55:45 +02:00
Soeren Apel 9e850040db Fix #1167 by not creating sigrok channels twice
Also fixes a similar bug in the analog_raw input module that prevented
it from resetting properly - it freed its resources by calling cleanup().
2018-06-03 19:37:49 +02:00
Gerhard Sittig 3c9117094c input/logicport: remove obsolete reset/cleanup assignments
The in->buf truncation is done by common backend logic. The module's
cleanup() does zero out inc, which obsoletes the flag assignments.
2018-06-03 19:28:46 +02:00
Gerhard Sittig 4c40d096d4 input/logicport: don't re-create channels after input module reset
Split the creation of channels and groups as well as the creation of the
session feed buffer into separate routines. Re-allocate the buffer after
reset but do not re-create the channels and groups.

This implementation assumes that after reset() of the input module, the
very same set of channels (including their order, names and enabled
state, as well as group membership) results from processing the
subsequently fed file content. Reading rather different configurations
from the same input file by means of repeated reset and re-read may not
work as expected.
2018-06-03 19:28:46 +02:00
Gerhard Sittig 49d9a095e8 input/logicport: silence a non-fatal glib runtime assertion
Explicitly check GString pointers for validity before calling glib
routines that would access string content. This silences an assertion
error for a non-fatal runtime condition:

(process:17044): GLib-CRITICAL **: g_string_free: assertion 'string != NULL' failed
2018-06-03 19:28:46 +02:00
Gerhard Sittig a38c2bfbbb input: clear sdi_ready flag and receive() buffer in common code
Rephrase common input reset logic such that additional common code can
execute after the individual module's reset callback. No behaviour has
changed, the module's reset callback still is optional, and identical
log output gets emitted.

Do clear the sdi_ready flag in the common sr_input_reset() routine, so
that all input modules will parse header information again before
processing sample data when subsequent calls receive new file content.
Void the input module's receive() buffer from common reset code. This
unbreaks the feature of re-reading previously consumed input files.

Extend comments in the common reset and free code paths, which involve
the modules' reset and cleanup routines, which interact in non-trivial
ways. Discuss the responsibilities of common and individual routines, to
remain aware during maintenance.
2018-06-03 19:28:46 +02:00
Uwe Hermann 1e99158c1b hantek-6xxx: Drop some unused variables. 2018-06-02 23:23:55 +02:00
Sergey Alirzaev 4299fcc0b8 hantek-6xxx: FIFO sampling
It doesn't buffer all the samples before sending them out anymore.

This fixes bug #1214.
2018-06-02 23:12:29 +02:00
Uwe Hermann d828b05e65 scpi-pps: Rigol DP71x: Make OVP/OCP threshold listable. 2018-06-01 15:47:48 +02:00
Frank Stettner 1c8901f744 scpi: Use locale independent sr_vsnprintf_ascii() and sr_vsprintf_ascii() functions. 2018-06-01 15:46:17 +02:00
Frank Stettner 21ef355e50 strutil: Locale independent sprintf() and vsprintf() functions 2018-06-01 15:46:17 +02:00
Frank Stettner 49a468ed8b scpi-pps: Add listable OVP/OCP threshold for HP 66xxx and prepared all other 2018-06-01 15:46:17 +02:00
Frank Stettner a61c8cce01 scpi-pps: Add HP 6631B, HP 66332A, HP 6633B and HP 6634B power supplies 2018-06-01 15:46:17 +02:00
Frank Stettner 7e381bfc3c scpi-pps: Add missing functionality for the HP 6632B power supply. 2018-06-01 15:46:17 +02:00
Frank Stettner 17a82e83ff scpi-pps: Reimplemention of switching channel groups (PSU channels)
Acquisition won't work correctly in a multi-threaded environment, when
config_set() and config_get() are called with a channel group.
The channel switching itself has moved to scpi/scpi.c, to be able to
handle switching in a thread safe way.
2018-06-01 15:46:17 +02:00
Frank Stettner fa2ce8c762 scpi-pps: Use thread safe SCPI functions, return float not double.
Use of the thread safe SCPI functions, so no write+read operation is
interruped.

Also return float values instead of double value in acquisition mode.
This is related to bug #779.
2018-06-01 15:46:17 +02:00
Frank Stettner fd20e59caa scpi: Synchronize read, write and write+read operations.
This ensures that SCPI read/write/write+read operations are thread safe.
F.e.: If a write operation expects a return value (in other words: a
read operation), it is not allowed to be interrupted by another write
operation.

To simplify things, the SCPI helper functions are moved from
scpi/helpers.c to scpi/scpi.c and also are renamed to fit the naming
scheme.

libgpib in particular will abort the program execution in case of
concurrent operations.
2018-06-01 15:46:17 +02:00
Uwe Hermann 1c5adc5ff7 scpi.c: Drop an unneeded log message.
The IDN string is already logged by sr_scpi_get_string().
2018-06-01 14:43:10 +02:00
Uwe Hermann 0c8aedb543 scpi_serial.c: Improve an error message. 2018-06-01 14:43:10 +02:00
Uwe Hermann 0261956fab scpi_serial.c: Drop an unneeded log message.
The number of bytes read is already logged by the serial backend:

  sr: [00:00.072857] scpi_serial: Read 1 bytes into buffer.
  sr: [00:00.073884] serial: Read 1/2008 bytes.
  sr: [00:00.073900] scpi_serial: Read 1 bytes into buffer.
  sr: [00:00.074896] serial: Read 1/2007 bytes.
  sr: [00:00.074905] scpi_serial: Read 1 bytes into buffer.
  sr: [00:00.075949] serial: Read 1/2006 bytes.
2018-06-01 14:43:10 +02:00
Uwe Hermann 319fe9cea6 scpi-pps: Add support for the Rigol DP711/DP712. 2018-06-01 14:43:10 +02:00
Gerhard Sittig 13ac09279a input/chronovu_la8: claim responsibility for LA16 files, devel comments
The chronovu_la8 input module is capable of handling either file type,
generated by LA8 or LA16 vendor software. Automatic detection is not
available, but user provided channel counts work fine.

Adjust the input module's name and description, and claim support for
.kdt as well as .kd1 files.

Add developer notes on implementation details, the file content's
constraints, and potential future adjustment.
2018-05-25 23:21:43 +02:00
Gerhard Sittig e8eb24222c input/chronovu_la8: only send data to the session, don't send the header
The file format is funny, a data part is leading (fixed size) and a
"header" part follows. The previous implementation sent the header part
to the session, too, pretending it was part of the data. This change
limits the number of samples that get sent to the session.

Comment on the file layout and header fields while we are here. This
information got lost in commit 02e24c0ce0 when the input module got
converted from do-it-yourself file operations to having intrinsic
handler routines invoked from common logic which handles the file.
2018-05-25 23:07:28 +02:00
Gerhard Sittig 20358f90b4 input/logicport: unobfuscate 64-bit-clean bit mask literals
Prefer the more portable UINT64_C() macro over the UL suffix when a
literal needs to span "more than 31 bit positions". Adjust other
locations for consistency across the source file.
2018-05-21 20:15:48 +02:00
Gerhard Sittig 67765e465a input/trace32_ad: fix potential buffer overflow for unexpected input data
Commit 8c4bff1d25 introduced a routine which prints what mostly should
be text, and avoids non-printable characters. This implementation used an
incorrect format string, which could result in data getting written past
the end of a buffer. Fix the format string.
2018-05-21 20:13:27 +02:00
Uwe Hermann 090f1e1e54 hwdriver.c: Fix two scan-build warnings.
src/hwdriver.c: In function ‘log_key’:
  src/hwdriver.c:648:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    opstr = op == SR_CONF_GET ? "get" : op == SR_CONF_SET ? "set" : "list";
               ^~
  src/hwdriver.c: In function ‘check_key’:
  src/hwdriver.c:681:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    opstr = op == SR_CONF_GET ? "get" : op == SR_CONF_SET ? "set" : "list";
               ^~
2018-05-19 22:23:16 +02:00
Uwe Hermann b4580cb9d0 siglent-sds: Fix multiple scan-build warnings.
src/hardware/siglent-sds/api.c:596:3: warning: Argument to g_free() is the address of a global variable, which is not memory allocated by malloc()
                  g_free(cmd);
                  ^~~~~~~~~~~
  src/hardware/siglent-sds/api.c:641:3: warning: Argument to g_free() is the address of a global variable, which is not memory allocated by malloc()
                  g_free(cmd);
                  ^~~~~~~~~~~
2018-05-19 22:01:28 +02:00
Uwe Hermann d5db6ea7e1 lecroy-xstream: Fix a potential memory leak.
Reported by scan-build:

  src/hardware/lecroy-xstream/protocol.c:680:12: warning: Potential leak of memory pointed to by 'analog.data'
                                  return SR_ERR;
                                         ^~~~~~
2018-05-19 22:01:26 +02:00
Uwe Hermann 4fc4b8e7aa hameg-hmo: Fix two potential memory leaks.
Reported by scan-build:

  src/hardware/hameg-hmo/api.c:533:12: warning: Potential leak of memory pointed to by 'pod_enabled'
                                  return SR_ERR;
                                         ^~~~~~
2018-05-19 22:01:21 +02:00
Uwe Hermann 24801f4e80 input/logicport: Fix outdated format_match().
Reported by scan-build:

  src/input/logicport.c:1186:18: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
    .format_match = format_match,
                    ^~~~~~~~~~~~
2018-05-19 22:01:18 +02:00
Gerhard Sittig c83bdde9da input: provide accessor routine for (struct sr_input *)->module
Add a public API routine which allows applications to query the
sr_input_module from an sr_input.
2018-05-17 22:31:27 +02:00
Gerhard Sittig 83df004be1 input/trace32_ad: data type nits, log verbosity in header parsing
Log determined header format when parsing trace32 file headers. Keep
another log message during regular processing, but silence it during
format match.

Use more appropriate data types for local and instance variables. Adjust
format strings accordingly.
2018-05-17 22:30:44 +02:00
Gerhard Sittig 80430d4d20 input/trace32_ad: rephrase the header parse logic
There were several issues with the previous implementation of the logic
which parses trace32 input files: A string comparison was inverted, and
compared a seven character literal to a five character copy of the input.
One more character was trimmed before CTRL-Z (the CP/M EOF), which often
is SPACE in input files, but might be excessive on other input files.

Replace a DIY character search while we are here. Use symbolic names for
special characters. Factor out a test and memory release, to simplify
error code paths in the remaining logic. Extend comments.
2018-05-17 22:30:44 +02:00
Gerhard Sittig 8c4bff1d25 input/trace32_ad: silence format match logging, improve robustness
There is not much point in log messages about format mismatch in the
auto detect phase, where each module gets queried in turn and most are
supposed to not match.

Do not print non-printable characters in log messages. Those could occur
in the format detection phase, or in the regular processing of input
files that either are unexpected or invalid (or is there a binary header
format variant even?).
2018-05-17 22:30:44 +02:00
Gerhard Sittig f54a55da2d input/chronovu_la8: address file size data type nits
Although the file format handled by this input module appears to be of
fixed size (8MiB plus 5 more bytes), it's more reliable to use a data
type for the file size that is larger than "an int". Although off_t
would be most portable, use uint64_t to match the code which passes the
parameter to the input module.
2018-05-17 22:25:40 +02:00
Gerhard Sittig 0dabb880af input: pass larger buffer to auto format detection
The previous implementation already was inconsistent (used to allocate
255 bytes and claimed that 128 bytes were sufficient). While existing
formats already required more than a few bytes of input (regular VCD
files' header sections exceed 255 bytes length).

Increase the buffer size that gets passed to input modules' match
method. Use 4MiB for consistency with other locations. Do not enforce a
minimum size, as there are valid input files which are shorter than 128
bytes. Auto-detection failed on those.

This addresses part of bug #1200.
2018-05-17 22:25:40 +02:00
Gerhard Sittig 54ee427df0 input: add confidence (detection strength) to format_match()
When users don't specify the input format, applications can try to have
the format auto-detected. Some of the tests were weak and could result
in false positives.

Add a 'confidence' parameter to the input modules' format_match()
method. Claim high confidence (1) for those formats which can check
magic strings or the presence of essential keywords (vcd, wav). Claim
medium confidence (10) for those formats which happened to mis-detect
inputs in the past (trace32_ad). Claim weak confidence (100) for those
formats which totally lack reliable conditions and rather guess than
detect (chronovu_la8).

Prefer the best match in public scan routines. Return at most one module
to callers even if multiple modules matched, to keep the current API.

This addresses part of bug #1200.
2018-05-17 22:23:35 +02:00
Uwe Hermann 7102443a4a input/logicport: Drop some unneeded allocation checks. 2018-05-17 21:09:48 +02:00
Gerhard Sittig e1b115bd4d input/logicport: introduce input module for LogicPort File (*.lpf)
Implement an input module for .lpf files, the "LogicPort File" format of
the Intronix LA1034 vendor software. This version supports wires with
enabled and inverted state, compressed samples, signal names, signal
groups (but not multiple assignment), and automatic format detection.

The logic which determines whether "the file header" was completely
received, and sample data can get sent to the session, implements an
assumption in the absence of a better and more reliable condition.

Invalid input gets rejected, but diagnostics is rather limited. Since
all channels get to be the member of a channel group, either specified
by the user in the input file, or arranged for in the input module, the
"missing separator" part of bug 1186 has become obsolete.
2018-05-17 21:07:42 +02:00
Uwe Hermann 0519db864b sr_analog_to_float(): Fix multiple compiler warnings (-Wshadow).
src/analog.c:205:23: warning: declaration of ‘i’ shadows a previous local [-Wshadow]
       for (unsigned int i = 0; i < count; i++) {
                         ^
  src/analog.c:178:18: note: shadowed declaration is here
    unsigned int b, i, count;
                    ^
[...]
2018-05-16 23:57:58 +02:00
Uwe Hermann 741bcf503d sr_analog_to_float(): Fix a compiler warning (-Wshadow).
src/analog.c: In function ‘sr_analog_to_float’:
  src/analog.c:194:9: warning: declaration of ‘offset’ shadows a previous local [-Wshadow]
   float offset = analog->encoding->offset.p / (float)analog->encoding->offset.q;
         ^~~~~~
  src/analog.c:177:8: note: shadowed declaration is here
  float offset;
        ^~~~~~
2018-05-16 22:48:35 +02:00
Gerhard Sittig 53ea24610e demo: optionally accept frame limit spec at scan time
Allow developers to specify the (default) number of frames at compile
time (default to "off" as before). Accept the frame limit spec at scan()
time as well. This is useful when applications don't run config_set() at
runtime.

Tested with:
$ pulseview -d demo:logic_channels=0:analog_channels=1:limit_frames=4
2018-05-13 20:03:21 +02:00
Gerhard Sittig fb193945b6 demo: make frame generation (and maximum frame count) a runtime option
The previous implementation supported the generation of frames as a
compile time option. This change lets users adjust the feature at
runtime.

In the absence of a frame count limit no frame begin/end markers get
sent (the default behaviour of the previous implementation). When a
frame count limit is specified, the respective number of frames gets
sent and acquisition stops.

The fixed amount of 1000 samples per frame is an arbitrary choice. This
compile time option is easily adjusted in the source code.
2018-05-13 20:03:21 +02:00
Gerhard Sittig 0373343046 demo: introduce graycode generator mode
Introduce support for the "graycode" logic pattern. Generate up to
64 bits of graycode output (all logic lines, no repetition, not limited
by the generator's internal pattern buffer). The implementation was
tested with 16 channels.
2018-05-13 19:45:46 +02:00
Gerhard Sittig 015f09702a demo: add convenient bit mask for "all logic channels"
Keep a context variable around with a bit mask for all logic channels.
This is convenient in setup and generation routines, to avoid garbage
in unassigned bit positions of session feed packets.
2018-05-13 19:40:00 +02:00
Gerhard Sittig 817e759ddc demo: data type nits in the device context (enum, unsigned int)
Move the declaration of codes for pattern types before the declaration
of the context container such that the latter can reference the former.
Add 'int' to an unsigned variable that omitted the base type.
2018-05-13 19:27:51 +02:00
Gerhard Sittig cdb134eb19 input/trace32_ad: silence format errors during input format match
When auto-detection tries to find the input module that can handle a
file, unexpected input format should be considered non-fatal. Only emit
error messages when process_header() got invoked from process_buffer()
after initialization. Emit debug messages in early stages where no input
module context exists yet.
2018-04-28 23:42:42 +02:00
Uwe Hermann 55bcd7ad45 dreamsourcelab-dslogic: Properly set initial voltage threshold.
The initial voltage threshold in dev_open() was being set to a
default value in the devc->cur_threshold variable but not actually set
in the device itself.

Patch by Jörg Alpers <jalpers@gmx.net>, thanks a lot!
2018-04-28 23:39:59 +02:00
Uwe Hermann 8a14fc0828 dmm/ms8250d: Fix two log messages. 2018-04-27 00:07:21 +02:00
Mandl 67070942cc Add support for the MASTECH MS8250D multimeter 2018-04-27 00:07:21 +02:00
Uwe Hermann 2bd5d17c70 hantek-4032l: Emit FPGA version log message. 2018-04-24 21:09:42 +02:00
Uwe Hermann eca9772971 soft-trigger: Fix an issue causing triggers to not work. 2018-04-24 16:56:07 +02:00
Uwe Hermann ce97fc3f6a rigol-ds: Fix an issue causing only one channel to be acquired.
This fixes bug #1018.
2018-04-22 18:36:12 +02:00
Uwe Hermann 350501d0c3 rigol-ds: Make two log messages more specific.
Slightly modified version of a suggested change by Aleksander Alsekseev.
2018-04-22 16:49:33 +02:00
Andrej Valek a5b9880eb2 hantek-4032l: Add option to abort acquisition.
Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-04-22 11:16:34 +02:00
Andrej Valek 74c4c1747f hantek-4032l: Fix mismatch in magic number.
- fix LIBUSB_TIMEOUT errors
- fix same data receiving
- send reset vendor request before new data getting
- decrease USB polling timeout

This fixes bug #1190.

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-04-22 11:15:05 +02:00
Andrej Valek e80e1858ef hantek-4032l: Fix structure packing.
- use pragma to handle different behavior between gcc and minGW bit-field packing
- bit-field integer variables needs to be align to 2-byte boundary
Compiler does not produce an error when accessing into non-__packed pointer.
However, the field might not be properly aligned for this type.
More information could be found on:
 - https://sourceforge.net/p/mingw-w64/bugs/275/
 - http://www.keil.com/support/man/docs/ARMCC/armcc_chr1359124990875.htm

Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-04-22 11:11:06 +02:00
Andrej Valek 972001561b hantek-4032l: Fix typo from device porting to new lib version.
Signed-off-by: Andrej Valek <andy@skyrain.eu>
2018-04-22 11:11:06 +02:00
Uwe Hermann 2c267f6819 log: Move log level check so that it affects all handlers.
Before this change, the loglevel check would only be performed for the
default log handler in libsigrok, but not for other handlers set
via sr_log_callback_set().

This fixes bug #698.
2018-04-22 00:23:10 +02:00
Uwe Hermann 7c59d8f310 output/csv: Make the label values option a list.
This allows UIs to display a drop-down with all possible choices,
instead of forcing the user to look up / remember all of them.
2018-04-21 23:30:44 +02:00
Uwe Hermann 31c41782e4 input/csv: Make the data format option a list.
This allows UIs to display a drop-down with all possible choices,
instead of forcing the user to look up / remember all of them.
2018-04-21 23:28:58 +02:00
Uwe Hermann d52107a159 soft-trigger: Use g_try_malloc() for potentially large allocation.
This fixes bug #1000.
2018-04-21 23:27:00 +02:00
Uwe Hermann 567fe53822 session_driver: Quickfix to prevent looped analog data reads.
A local buffer was too small, snprintf() was used to write the
name of the analog-1-1-xxx ZIP archive names in that buffer.

Due to the limited size, only 3 characters were usable for the last
number component, i.e. the code would loop around from analog-1-1-999
to analog-1-1-100 (instead of analog-1-1-1000).

As a quickfix, increase the buffer size by a large margin, a nicer
fix should be used later on.
2018-04-19 23:29:22 +02:00
Uwe Hermann 2003be8cec input/null: Add a null module that discards all data.
This is useful for testing purposes.
2018-04-19 22:15:54 +02:00
Uwe Hermann 1af7497d67 output/null: Add a null module that discards all data.
This is useful for testing purposes.
2018-04-19 20:10:50 +02:00
Uwe Hermann b20eb52055 input/output: Slightly improved module descriptions. 2018-04-19 18:21:07 +02:00
Uwe Hermann 9a4fd01af8 input modules: Increase chunk size to 4MB for all modules.
This reduces overhead and can slightly increase performance, depending
on the module.
2018-04-19 17:39:15 +02:00
Uwe Hermann 8bc2fa6d82 input modules: Name chunk size #defines CHUNK_SIZE consistently. 2018-04-19 17:38:05 +02:00
Uwe Hermann 1fb31414f2 input/trace32_ad: Drop unused #define. 2018-04-19 17:37:15 +02:00
Uwe Hermann 2cff7a2ba7 input/wav: Put internal buffer on the heap instead of the stack.
Increasing the buffer/chunk size could cause issues when trying to put
large arrays on the stack.
2018-04-19 17:37:15 +02:00
Uwe Hermann a33e4be826 input/binary: Increase chunk size from 4KB to 4MB.
This can slightly increase performance when loading larger files.
2018-04-14 22:23:02 +02:00
Uwe Hermann 408b6ab42b input/binary: Only calculate unitsize once. 2018-04-14 19:46:43 +02:00
Uwe Hermann 867293a101 input modules: Improve option names and descriptions.
These should be slightly more useful and contain more information
(should also work reasonably well for 'sigrok-cli --show' and as
tooltips in UIs).
2018-04-14 18:47:49 +02:00
Uwe Hermann d4b3f44fa7 zketech-ebd-usb: Drop unneeded log message.
The number of bytes sent is already logged by the libsigrok serial code.
2018-04-08 20:56:34 +02:00
Uwe Hermann 330a32b240 zketech-ebd-usb: Shorten function name prefix for better readability. 2018-04-08 19:59:25 +02:00
Uwe Hermann cb8a0efc5c zketech-ebd-usb: Make a few functions static. 2018-04-08 19:59:25 +02:00
Uwe Hermann ec4806dcf5 zketech-ebd-usb: Add some underscores to #defines. 2018-04-08 19:59:25 +02:00
Sven Bursch-Osewold 9890fb1f08 zketech-ebd-usb: First version of the driver. 2018-04-08 19:59:25 +02:00
Sven Bursch-Osewold c527132aec zketech-ebd-usb: Initial driver skeleton. 2018-04-08 19:59:25 +02:00
Uwe Hermann 23d68466f8 usbtmc: Silence some overly verbose log messages.
These trigger quite often with unrelated devices and confuse people.

  scpi_usbtmc: Failed to get configuration descriptor: LIBUSB_ERROR_NOT_FOUND, ignoring device.
2018-04-08 19:49:41 +02:00
Uwe Hermann 66d2cc3a27 rdtech-dps: User ternary operator. 2018-03-29 15:45:52 +02:00
James Churchill 69b0558395 rdtech-dps: New driver for RDTech DPS/DPH series PSUs. 2018-03-29 15:41:30 +02:00
James Churchill 0549416e36 rdtech-dps: Initial driver skeleton. 2018-03-26 15:41:01 +10:00
James Churchill 7b50a9b869 modbus: Return explicit SR_ERR values as required by modbus.c
The Modbus RTU implementation was inappropriately returning lengths
from the serial functions when the calling functions expect only an
sr_error_code value.
2018-03-26 15:41:01 +10:00
James Churchill d4e0701771 modbus: Increase modbus reply timeout to 500ms.
Needed by rdtech-dps driver, 100ms is too short.
2018-03-26 15:41:01 +10:00
Soeren Apel 366ccb8ab7 resource.c: Fix firmware loading bug (#1140) 2018-03-20 16:13:46 +01:00
Uwe Hermann 410883baf6 backend: Emit firmware search paths in a log message. 2018-03-18 18:26:57 +01:00
Soeren Apel addb7340dd Introduce sr_resourcepaths_get()
This provides an interface to fix #1128.
2018-03-18 18:25:36 +01:00
Axel Hinrichs e843992dda korad-kaxxxxp: Korad OEM: RND KA3005P 2018-03-12 16:34:43 +01:00
Gerhard Sittig 823b0e29ae output/csv: fix out-of-bounds array access in process_analog()
Make sure to not exceed the ctx->analog_samples[] array bounds. Don't
use the (huge) channel's index in the device's(!) channel list, instead
use the zero-based and dense index into the array of analog samples in
the accumulation buffer, before writing to the external file.

This fixes the segfault reported in bug #1124.
2018-03-12 15:55:22 +01:00
Gerhard Sittig a551cb0927 output/csv: use longer names for iteration variables
The process_analog() logic is rather complex, dealing with the total
list of channels in the device (which can be of different types), and a
number of submitted samples for a specified list of channels. Replace
the rather short variable names for i, j, c (and num_channels) with
something longer that hopefully increases readability of the complex
loop bodies.

Note that this change merely renames identifiers, and does not change
behaviour.
2018-03-12 15:55:22 +01:00
Gerhard Sittig b078dddb84 output/csv: reduce indentation in process_analog()
Instead of nesting indentation levels upon equality of a value, skip
iterations upon inequality. This reduces indentation, and might improve
readability.

[ Indentation changes, see 'diff -w -b' for the essence. ]
2018-03-12 15:55:22 +01:00
Frank Stettner 94cf02d0c2 hp-3478a: Remove unnecessary curly brackets. 2018-03-06 19:02:33 +01:00
Frank Stettner a575c90e81 hp-3478a: Set correct number of digits 2018-03-06 17:40:13 +01:00
Frank Stettner acc587ff24 hp-3478a: spec_digits must be parsed before range parsing. 2018-03-06 17:40:13 +01:00
Frank Stettner c3f8e1abf0 arachnid-labs-re-load-pro: Replace C++-style comments with C-style comments. 2018-03-06 17:39:37 +01:00
Frank Stettner cd97e39d89 metex14: Fix wrong measurement modes 2018-03-05 20:23:35 +01:00
Frank Stettner fd8dc1db01 metex14: Add power factor measurement mode 2018-03-05 20:23:26 +01:00
Uwe Hermann 0aaaee2dd3 arachnid-labs-re-load-pro: Simplify a code chunk. 2018-03-03 19:25:05 +01:00
Frank Stettner d7e348f481 arachnid-labs-re-load-pro: Add encoding.digits to analog packet 2018-03-03 19:25:05 +01:00
Frank Stettner 2153093941 arachnid-labs-re-load-pro: Index for channel "I" 2018-03-03 19:25:05 +01:00
Frank Stettner b3e715e528 arachnid-labs-re-load-pro: Get a response when in acquision mode. 2018-03-03 19:25:02 +01:00
Frank Stettner 706350360a arachnid-labs-re-load-pro: Make SR_CONF_REGULATION listable 2018-03-03 19:22:59 +01:00
Frank Stettner 3d70d77709 arachnid-labs-re-load-pro: Add SR_CONF_UNDER_VOLTAGE_THRESHOLD. 2018-03-03 19:10:51 +01:00
Frank Stettner 9edda1d25b arachnid-labs-re-load-pro: Setting correct current limit.
Use round() instead of just truncate the value.
2018-03-03 19:10:51 +01:00
Frank Stettner a217289951 arachnid-labs-re-load-pro: Change serial read in acquisition mode.
Use serial_readline in acquisition mode, otherwise data from the
Re:load Pro could get lost.
Use reloadpro_receive_data() for all commands when in acquisition
mode. When not using a single point of receiving data, data could get
lost.
2018-03-03 19:10:51 +01:00