]> sigrok.org Git - libsigrok.git/log
libsigrok.git
6 years agosiglent-sds: Add 100s timebase (seen on e.g. SDS1202X-E).
Uwe Hermann [Fri, 16 Feb 2018 23:00:31 +0000 (00:00 +0100)]
siglent-sds: Add 100s timebase (seen on e.g. SDS1202X-E).

6 years agosiglent-sds: Add SDS1052DL+ model.
Uwe Hermann [Fri, 16 Feb 2018 22:24:33 +0000 (23:24 +0100)]
siglent-sds: Add SDS1052DL+ model.

6 years agosiglent-sds: Various cosmetics and coding-style fixes.
Uwe Hermann [Fri, 16 Feb 2018 19:33:44 +0000 (20:33 +0100)]
siglent-sds: Various cosmetics and coding-style fixes.

Also, drop some unneeded comments and log messages.

6 years agohantek-4032l: Minor cosmetics.
Uwe Hermann [Thu, 15 Feb 2018 21:45:35 +0000 (22:45 +0100)]
hantek-4032l: Minor cosmetics.

6 years agostd.c: Add missing <sys/time.h> #include and _XOPEN_SOURCE.
Uwe Hermann [Tue, 13 Feb 2018 20:54:46 +0000 (21:54 +0100)]
std.c: Add missing <sys/time.h> #include and _XOPEN_SOURCE.

This is required for gettimeofday() to be available (at least on
FreeBSD), causes compiler warnings otherwise.

6 years agosiglent-sds: Replace non-portable strcasestr() with g_strstr_len().
Uwe Hermann [Tue, 13 Feb 2018 21:37:01 +0000 (22:37 +0100)]
siglent-sds: Replace non-portable strcasestr() with g_strstr_len().

The strcasestr() function is non-portable (e.g. not available on
MinGW, possibly elsewhere). Replace it with g_strstr_len() for the time
being. While the latter is not case-insensitive it appears that
that property doesn't matter here ("." should not be relevant anyway,
and e.g. an SDS1202X-E does indeed report "Mpts" as such).

Should it become necessary to have this code be case-insensitive,
we'll have to find a more portable solution than strcasestr().

6 years agosiglent-sds: Drop currently unused <rpc/rpc.h> #include.
Uwe Hermann [Tue, 13 Feb 2018 20:52:25 +0000 (21:52 +0100)]
siglent-sds: Drop currently unused <rpc/rpc.h> #include.

This causes some compile errors on platforms where RPC is not available, e.g.

  siglent-sds/api.c:25:21: fatal error: rpc/rpc.h: No such file or directory

Surrounding the #include (and later code) with "#if HAVE_RPC" should avoid
these compile errors, but since it's not used at all for now, drop it.

6 years agoREADME.devices: add Siglent SDS to the firmware and conn= sections
Gerhard Sittig [Sun, 11 Feb 2018 14:49:11 +0000 (15:49 +0100)]
README.devices: add Siglent SDS to the firmware and conn= sections

6 years agousbtmc: only reset Siglent (and Atten) devices in open
Gerhard Sittig [Sun, 11 Feb 2018 15:16:17 +0000 (16:16 +0100)]
usbtmc: only reset Siglent (and Atten) devices in open

Make the USB reset for USB TMC devices conditional. Check a whitelist,
which in this implementation exclusively contains the Siglent VID.

The whitelist's comment may need adjustment. The VID probably not only
applies to SDS devices, but could be used for SDG and others as well.
And lsusb output suggests the VID is used by Atten, too.

6 years agousbtmc: add the Siglent VID and reset USB devices in open
Gerhard Sittig [Sun, 11 Feb 2018 15:30:34 +0000 (16:30 +0100)]
usbtmc: add the Siglent VID and reset USB devices in open

Add the Siglent's VID to a list of blacklisted USB TMC devices.
Unconditionally reset USB devices in the open routine.

This was taken from marchel's development for Siglent SDS. Though the
reset should probably be conditional, and only get applied to devices
which are known to need it.

The comment may need adjustment, maybe individual PID entries are
required. The VID probably not only applies to SDS devices, but could
be used for SDG and other gear as well. And lsusb output suggests the
VID is used by Atten, too.

6 years agosiglent-sds: initial driver implementation for Siglent SDS
mhooijboer [Sun, 11 Feb 2018 17:11:58 +0000 (18:11 +0100)]
siglent-sds: initial driver implementation for Siglent SDS

Implement a first version of the driver for the Siglent SDS1000 and
SDS2000 oscilloscopes.

[ gsi: This commit corresponds to git 0228126017e6 of marchelh's tree,
  I adjusted the source to closer match the project's coding style. The
  conversion was verified by this command:

  $ git diff --word-diff=color -w -b <branch>:<dir> <branch>:<dir>

  Changes include: Whitespace adjustment, dead code removal, separation
  of variable declaration and assignment, alpha-sorted includes. Line
  length was not addressed and not every location got adjusted, to keep
  the diff minimal and to reduce effort during review of this version. ]

6 years agosiglent-sds: Initial driver skeleton.
mhooijboer [Sun, 11 Feb 2018 14:18:57 +0000 (15:18 +0100)]
siglent-sds: Initial driver skeleton.

6 years agoREADME.devices: discuss conn= and USB/TCP/VXI in addition to RS232
Gerhard Sittig [Sun, 11 Feb 2018 14:43:38 +0000 (15:43 +0100)]
README.devices: discuss conn= and USB/TCP/VXI in addition to RS232

The conn= specification is not strictly related to RS232 communication.
Provide examples for other USB specs (as they are used for some DMM and
LCR drivers), as well as TCP and VXI (which are often found with MSO
drivers).

6 years agokorad-kaxxxxp: Simplify korad_kaxxxxp_receive_data() event loop function.
Frank Stettner [Mon, 8 Jan 2018 12:31:41 +0000 (13:31 +0100)]
korad-kaxxxxp: Simplify korad_kaxxxxp_receive_data() event loop function.

6 years agokorad-kaxxxxp: Use locale independent sr_snprintf_ascii() function
Frank Stettner [Sun, 7 Jan 2018 17:06:03 +0000 (18:06 +0100)]
korad-kaxxxxp: Use locale independent sr_snprintf_ascii() function

6 years agokorad-kaxxxxp: Synchronize read and write operations.
Frank Stettner [Sat, 6 Jan 2018 20:27:42 +0000 (21:27 +0100)]
korad-kaxxxxp: Synchronize read and write operations.

6 years agokorad-kaxxxxp: Add two channels "V" and "I", remove channel "CH1"
Frank Stettner [Fri, 5 Jan 2018 20:09:47 +0000 (21:09 +0100)]
korad-kaxxxxp: Add two channels "V" and "I", remove channel "CH1"

6 years agotests: Tests for the locale independent sr_vsnprintf_ascii() function.
Frank Stettner [Fri, 26 Jan 2018 12:56:19 +0000 (13:56 +0100)]
tests: Tests for the locale independent sr_vsnprintf_ascii() function.

6 years agostrutil: Locale independent snprintf() and vsnprintf() functions
Frank Stettner [Fri, 26 Jan 2018 12:53:45 +0000 (13:53 +0100)]
strutil: Locale independent snprintf() and vsnprintf() functions

6 years agohameg-hmo: fix potential NULL dereference
Gerhard Sittig [Sat, 10 Feb 2018 11:20:05 +0000 (12:20 +0100)]
hameg-hmo: fix potential NULL dereference

Check for successful allocation before accessing struct members. Return
with an error from device initialization when allocation fails.

This was reported by clang's scan-build.

6 years agohameg-hmo: fix potential memory leak
Gerhard Sittig [Sat, 10 Feb 2018 09:26:23 +0000 (10:26 +0100)]
hameg-hmo: fix potential memory leak

Make sure to release the allocated "pod enabled" memory, too, when SCPI
communication during channel setup fails. Defer the return with an error
(instead of duplicating the free() invocation).

This was reported by clang's scan-build.

6 years agooutput/srzip: fix potential "use after free"
Gerhard Sittig [Sat, 10 Feb 2018 09:18:20 +0000 (10:18 +0100)]
output/srzip: fix potential "use after free"

The compiler marks a potential use after free, which the current
implementation won't trigger. The error only occurs when a sigrok
channel is neither logic nor analog.

Address the issue nevertheless, to silence the compiler warning, and to
protect against possible programming errors when a future implementation
should support more channel types.

This was reported by clang's scan-build.

6 years agosession: fix another potential memory leak
Gerhard Sittig [Sat, 10 Feb 2018 09:12:51 +0000 (10:12 +0100)]
session: fix another potential memory leak

This was reported by clang's scan-build.

6 years agooutput/wav: fixup coding style nits, adjust data types
Gerhard Sittig [Sun, 23 Oct 2016 10:12:33 +0000 (12:12 +0200)]
output/wav: fixup coding style nits, adjust data types

Fixup unbalanced braces for more complex if statements, to better
reflect the project's official coding style.

Adjust data types in the float_to_le() routine. A float value gets
copied to a buffer of bytes (uint8_t). Don't use 'char' on the other
side of assignments, to not assume a specific width for char, and to
avoid potential signedness issues. Copy from bytes to bytes instead.

6 years agooutput/wav: change default for scale factor from 0.0 to 1.0
Gerhard Sittig [Sun, 23 Oct 2016 09:55:07 +0000 (11:55 +0200)]
output/wav: change default for scale factor from 0.0 to 1.0

The WAV output module supports an optional 'scale' factor, in its
absence the samples will pass unmodified. The builtin help text is
unexpected, and reads:

  $ sigrok-cli -O wav --show
  ...
  Options:
    scale: Scale values by factor (default 0.0)

Setup a default scale factor of 1.0, which results in identical
behaviour and better reflects what is happening.

6 years agooutput/vcd: assume packed input data image, unbreak 2nd+ channel
Gerhard Sittig [Sun, 4 Feb 2018 22:17:39 +0000 (23:17 +0100)]
output/vcd: assume packed input data image, unbreak 2nd+ channel

The previous implementation only emitted data for the first enabled
channels, and "saw no changes" after emission of the initial value for
channels on positions that followed a disabled channel.

Assume that the received data from the session bus communicates the bits
of enabled channels in a packed representation. Skip the mapping of
output bit indices to sigrok channel numbers.

This fixes the remaining part of bug #519.

Tested by inspecting in gtkwave the result of command:
  $ sigrok-cli -d demo -C D1,D3,D6 -c samplerate=2M --samples 2500 -O vcd -o trace.vcd

When we find that all input sources (device drivers, and input modules)
provide a dense bit field, all of the mapping logic can get removed
here. This commit just quickly disables the logic.

6 years agooutput/vcd: assign adjacent names to enabled channels
Gerhard Sittig [Sun, 4 Feb 2018 22:05:59 +0000 (23:05 +0100)]
output/vcd: assign adjacent names to enabled channels

Identifiers for channels in the VCD header section could be "sparse"
when sigrok channels were disabled. Make sure to not assign names to
disabled channels. This will e.g. assign !, ", and # to channels D1, D3,
and D6, when D0, D2, D4-D5, and D7 are disabled.

This addresses part of bug #519.

6 years agoseveral DMMs: set DC flag for diode mode
Gerhard Sittig [Sun, 4 Feb 2018 21:26:23 +0000 (22:26 +0100)]
several DMMs: set DC flag for diode mode

Few DMM drivers already did it. This commit adjusts the remaining DMM
drivers, to set the "DC" flag for measurements in diode mode.

This fixes bug #144.

Although I don't have the hardware to test, the nature of the change and
the arrangement of driver code suggests it's good. When a meter already
communicated the "DC" status, the change does nothing and won't harm.
The change ensures "DC" is flagged for those meters which previously
didn't, which is desirable.

6 years agostrutil: accept trailing whitespace after number text
Gerhard Sittig [Sun, 4 Feb 2018 19:17:08 +0000 (20:17 +0100)]
strutil: accept trailing whitespace after number text

Some SCPI based drivers fail to convert response data, because strutil
conversion helpers sr_atol() and sr_atof() don't like trailing spaces
after the number's text that successfully got converted.

It's yet to get determined whether all call sites of the conversion
routines like their eating adjacent whitespace. But given that the
conversion routine explicitly checks for end of the string after the
number, no call site should expect or even depend on trailing text to
keep its whitespace.

See bug #788 for a discussion and example data.

6 years agostrutil: support tera/peta/exa suffixes in symbolic size specs
Gerhard Sittig [Sun, 4 Feb 2018 18:50:25 +0000 (19:50 +0100)]
strutil: support tera/peta/exa suffixes in symbolic size specs

Synchronize sr_parse_sizestring() with sr_si_string_u64() capabilities.
Add support for the T/P/E suffixes. Since this conversion helper deals
with integer values exclusively, there is no issue with case insensitive
matches. The value cannot be pico. Neither is there an ambiguity with
the 10e6 notation.

This addresses bug #763.

Fix a style nit while we are here. Put braces around both arms of a
complex conditional.

6 years agobeaglelogic: silence compiler warning
Gerhard Sittig [Sun, 4 Feb 2018 15:18:03 +0000 (16:18 +0100)]
beaglelogic: silence compiler warning

Explicitly assign NULL to param to avoid the "may be used uninitialized"
warning reported in bug #1094. Behaviour remains unchanged. All references
to the variable were under "if (!conn)", and the assigning arm of the
branch checked for "if (!param)" after assignment. So the error could
not happen, but compilers may not have noticed depending on the width of
their scope during compilation.

Move the initialization of 'conn' closer to the conditional assignment,
such that all paths are seen in one spot during maintenance.

This fixes bug #1094.

6 years agousb: re-use existing values, don't re-determine bus and device address
Gerhard Sittig [Mon, 29 Jan 2018 19:36:50 +0000 (20:36 +0100)]
usb: re-use existing values, don't re-determine bus and device address

Avoid repeated libusb bus number and device address retrieval operations,
instead use variables where the information previously got stored to.

6 years agolog: flush log lines, to cope with non-terminal output (pipes)
Gerhard Sittig [Mon, 29 Jan 2018 19:10:36 +0000 (20:10 +0100)]
log: flush log lines, to cope with non-terminal output (pipes)

Although log messages are terminated by a line feed, output still might
get buffered when the program does not talk to a terminal (that it is
aware of). Add an fflush(3) call to the printf(3) sequence such that log
output will immediately show up when writing to pipes or sockets, too.

6 years agobackend: fixup resource leak in sr_init() error code path
Gerhard Sittig [Sun, 26 Mar 2017 13:46:37 +0000 (15:46 +0200)]
backend: fixup resource leak in sr_init() error code path

Early sr_init() steps can just 'return' fine. After allocation of the
'context' memory, make all error paths 'goto done' before returning,
to undo the memory allocation.

6 years agoREADME.devices: the PRINT button must get pressed for Metrix MX56C
Gerhard Sittig [Sun, 28 Jan 2018 18:28:06 +0000 (19:28 +0100)]
README.devices: the PRINT button must get pressed for Metrix MX56C

6 years agosrzip: don't access non-existing option
Gerhard Sittig [Sun, 28 Jan 2018 17:58:19 +0000 (18:58 +0100)]
srzip: don't access non-existing option

The srzip output module dropped support for the "filename" option in
commit 37875f750614 on 2015-07-30, but still used to assign to slot
options[0] which clobbers the array's sentinel. Remove those accesses
to the non-existing option.

6 years agohantek-4032l: Fix a compiler warning.
Uwe Hermann [Fri, 9 Feb 2018 20:26:38 +0000 (21:26 +0100)]
hantek-4032l: Fix a compiler warning.

  api.c: In function 'config_set':
  api.c:352:5: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'uint64_t' [-Wformat=]
       sr_err("invalid sample range 2k...64M: %ld",
       ^

6 years agobeaglelogic: Fix a compiler warning.
Uwe Hermann [Fri, 9 Feb 2018 20:25:18 +0000 (21:25 +0100)]
beaglelogic: Fix a compiler warning.

 beaglelogic_tcp.c: In function 'beaglelogic_tcp_send_cmd':
 beaglelogic_tcp.c:114:3: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'size_t' [-Wformat=]
     sr_dbg("Only sent %d/%lu bytes of command: '%s'.", out,
     ^

6 years agoyokogawa-dlm: fix several compiler warnings (assignment, memory)
Gerhard Sittig [Fri, 9 Feb 2018 18:32:12 +0000 (19:32 +0100)]
yokogawa-dlm: fix several compiler warnings (assignment, memory)

Check pointers' validity before dereferencing them. Release partially
allocated memory in an error path. Remove an assignment which never took
effect.

This was reported by clang's scan-build.

6 years agotondaj-sl-814: fix a potential memory leak
Gerhard Sittig [Fri, 9 Feb 2018 18:30:45 +0000 (19:30 +0100)]
tondaj-sl-814: fix a potential memory leak

Release an allocated device instance in an error path.

This was reported by clang's scan-build.

6 years agosysclk-lwla: silence potential NULL dereference compiler warning
Gerhard Sittig [Fri, 9 Feb 2018 18:30:00 +0000 (19:30 +0100)]
sysclk-lwla: silence potential NULL dereference compiler warning

Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.

6 years agoscpi-pps: silence potential NULL dereference compiler warning
Gerhard Sittig [Fri, 9 Feb 2018 18:29:08 +0000 (19:29 +0100)]
scpi-pps: silence potential NULL dereference compiler warning

Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.

6 years agosaleae-logic-pro: silence "assigned, not used" compiler warning
Gerhard Sittig [Fri, 9 Feb 2018 18:27:52 +0000 (19:27 +0100)]
saleae-logic-pro: silence "assigned, not used" compiler warning

Remove an assignment that never took effect.

This was reported by clang's scan-build.

6 years agorigol-ds: silence potential NULL dereference compiler warning
Gerhard Sittig [Fri, 9 Feb 2018 18:26:42 +0000 (19:26 +0100)]
rigol-ds: silence potential NULL dereference compiler warning

Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.

6 years agools, pipistrello-ols: silence "assigned, not used" compiler warning
Gerhard Sittig [Fri, 9 Feb 2018 18:23:31 +0000 (19:23 +0100)]
ols, pipistrello-ols: silence "assigned, not used" compiler warning

Each code path either assigns to 'flags', or leaves the routine. There
is no potential path that leaves the variable at the initially assigned
value, so the assignment took no effect. Remove it.

Nit: Trim the source code line length while we are here.

This was reported by clang's scan-build.

6 years agonorma-dmm: fix a potential memory leak
Gerhard Sittig [Fri, 9 Feb 2018 18:22:14 +0000 (19:22 +0100)]
norma-dmm: fix a potential memory leak

Release an allocated buffer in an error path.

This was reported by clang's scan-build.

6 years agomotech-lps-30x: fix several compiler warnings
Gerhard Sittig [Fri, 9 Feb 2018 18:17:13 +0000 (19:17 +0100)]
motech-lps-30x: fix several compiler warnings

Check pointers' validity before dereferencing them. Explicitly assign a
default value to variables, before conversion routines conditionally
assign the "real" value (and don't in case of conversion errors). This
avoids processing "garbage" data.

Strictly speaking I cannot see how the conversion routine returns OK and
has _not_ assigned a result. But the explicit assignment won't harm
either, and matches the fallback when the conversion fails (detectibly).
Which means that runtime behaviour won't change.

This was reported by clang's scan-build.

6 years agomaynuo-m97: fix potential NULL dereference
Gerhard Sittig [Fri, 9 Feb 2018 18:15:51 +0000 (19:15 +0100)]
maynuo-m97: fix potential NULL dereference

Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.

6 years agomanson-hcs-3xxx: fix potential NULL dereference
Gerhard Sittig [Fri, 9 Feb 2018 18:14:31 +0000 (19:14 +0100)]
manson-hcs-3xxx: fix potential NULL dereference

Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.

6 years agolecroy-xstream: fix several compiler warnings (assignment, memory)
Gerhard Sittig [Fri, 9 Feb 2018 18:12:12 +0000 (19:12 +0100)]
lecroy-xstream: fix several compiler warnings (assignment, memory)

Remove an assignment that won't take effect. Check pointers' validity
before dereferencing. Fix a memory leak.

This was reported by clang's scan-build.

6 years agolascar-el-usb: fix potential NULL dereference and memory leak
Gerhard Sittig [Fri, 9 Feb 2018 18:09:27 +0000 (19:09 +0100)]
lascar-el-usb: fix potential NULL dereference and memory leak

Check for successful allocation of multiple memory ranges, and release
partial allocations in the error path when one of them failed. This
fixes a potential memory leak, as well as avoids NULL dereferences.

This was reported by clang's scan-build.

6 years agokorad-kaxxxxp: fix potential NULL dereference
Gerhard Sittig [Fri, 9 Feb 2018 18:08:11 +0000 (19:08 +0100)]
korad-kaxxxxp: fix potential NULL dereference

Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.

6 years agohp-3457a: fix potential NULL dereference
Gerhard Sittig [Fri, 9 Feb 2018 18:05:38 +0000 (19:05 +0100)]
hp-3457a: fix potential NULL dereference

Check the active channels' list for not being empty, before
dereferencing pointers.

This was reported by clang's scan-build.

6 years agohantek-6xxx: fix potential NULL dereference
Gerhard Sittig [Fri, 9 Feb 2018 18:03:06 +0000 (19:03 +0100)]
hantek-6xxx: fix potential NULL dereference

Check pointers' validity before dereferencing.

This was reported by clang's scan-build.

6 years agohameg-hmo: fix several compiler warnings (assignments, memory)
Gerhard Sittig [Fri, 9 Feb 2018 17:57:49 +0000 (18:57 +0100)]
hameg-hmo: fix several compiler warnings (assignments, memory)

Silence warnings about assigned values that never get used, potential
NULL deference, and potential memory leaks.

This was reported by clang's scan-build.

6 years agogmc-mh-1x-2x: fix potential memory leak
Gerhard Sittig [Fri, 9 Feb 2018 17:50:53 +0000 (18:50 +0100)]
gmc-mh-1x-2x: fix potential memory leak

The scan_2x_bd232() routine used to always prepare one spare context,
and filled it in when a device was found, just to allocate another one
and continue scanning.

Free the last allocated context unconditionally, as it was allocated
unconditionally, and never used.

This was reported by clang's scan-build.

6 years agofx2lafw: silence "NULL dereference" compiler warning
Gerhard Sittig [Fri, 9 Feb 2018 17:48:29 +0000 (18:48 +0100)]
fx2lafw: silence "NULL dereference" compiler warning

Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.

6 years agoftdi-la: silence "assigned but never used" compiler warning
Gerhard Sittig [Thu, 8 Feb 2018 22:19:00 +0000 (23:19 +0100)]
ftdi-la: silence "assigned but never used" compiler warning

Stick with the prepared but unfinished "limit msec" code path, but
silence the warning about an unused variable value.

This was reported by clang's scan-build.

6 years agodreamsourcelab-dslogic: avoid division by zero
Gerhard Sittig [Thu, 8 Feb 2018 22:16:40 +0000 (23:16 +0100)]
dreamsourcelab-dslogic: avoid division by zero

Do not align to block_size when its value is zero.

This was reported by clang's scan-build.

6 years agodreamsourcelab-dslogic: avoid NULL pointer dereference
Gerhard Sittig [Thu, 8 Feb 2018 22:11:59 +0000 (23:11 +0100)]
dreamsourcelab-dslogic: avoid NULL pointer dereference

Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.

6 years agochronovu-la: avoid NULL pointer dereference
Gerhard Sittig [Thu, 8 Feb 2018 21:44:16 +0000 (22:44 +0100)]
chronovu-la: avoid NULL pointer dereference

Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.

6 years agobeaglelogic: fixup use of uninitialized data in TCP routines
Gerhard Sittig [Thu, 8 Feb 2018 21:31:48 +0000 (22:31 +0100)]
beaglelogic: fixup use of uninitialized data in TCP routines

Make sure that failure to communicate via TCP results in access to
uninitialized data.

This was reported by clang's scan-build.

6 years agobeaglelogic: fixup memory leak in the TCP command send routine
Gerhard Sittig [Thu, 8 Feb 2018 21:22:56 +0000 (22:22 +0100)]
beaglelogic: fixup memory leak in the TCP command send routine

Release allocated memory in an error code path.

This was reported by clang's scan-build.

6 years agoatten-pps3xxx: silence NULL dereference compiler warnings
Gerhard Sittig [Thu, 8 Feb 2018 21:02:59 +0000 (22:02 +0100)]
atten-pps3xxx: silence NULL dereference compiler warnings

Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.

6 years agosession_driver: avoid division by zero, catch API violation
Gerhard Sittig [Thu, 8 Feb 2018 21:18:02 +0000 (22:18 +0100)]
session_driver: avoid division by zero, catch API violation

Avoid a division by zero, by not using a zero unitsize in a modulo
operation. As a byproduct, avoid processing and counting input that
neither has analog nor logic data. This should never have happened,
but the change now catches the error if invalid input is seen.

This was reported by clang's scan-build.

6 years agosession: fixup access to uninitialized memory
Gerhard Sittig [Thu, 8 Feb 2018 21:11:58 +0000 (22:11 +0100)]
session: fixup access to uninitialized memory

The sr_packet_copy() routine could have written to an arbitrary memory
location. Make sure to allocate the space before writing to it, and
check for successful allocation before accessing the memory.

It's assumed that this error never took effect, as the routine appears
to be unused.

This was reported by clang's scan-build.

6 years agoscpi: avoid uninitialized use of a variable
Gerhard Sittig [Thu, 8 Feb 2018 21:08:54 +0000 (22:08 +0100)]
scpi: avoid uninitialized use of a variable

The 'opc' variable was only conditionally assigned to (depends on
successful SCPI communication). Ensure there always is a known value.

This was reported by clang's scan-build.

6 years agooutput/srzip: silence "use after free" compiler warning
Gerhard Sittig [Thu, 8 Feb 2018 21:06:53 +0000 (22:06 +0100)]
output/srzip: silence "use after free" compiler warning

Defer memory g_free() until after the data gets accessed one last time.

This was reported by clang's scan-build.

6 years agooutput/csv: silence NULL dereference compiler warnings
Gerhard Sittig [Thu, 8 Feb 2018 21:04:49 +0000 (22:04 +0100)]
output/csv: silence NULL dereference compiler warnings

Check pointers' validity before dereferencing them.

This was reported by clang's scan-build.

6 years agoinput/raw_analog: silence "use after free" compiler warning
Gerhard Sittig [Thu, 8 Feb 2018 20:47:21 +0000 (21:47 +0100)]
input/raw_analog: silence "use after free" compiler warning

The cleanup() call will void the memory which 'inc' points to. Move the
dereference before the release.

This was reported by clang's scan-build.

6 years agolecroy-xstream: Wait for trigger before acquiring additional frames
Soeren Apel [Wed, 3 Jan 2018 23:23:12 +0000 (00:23 +0100)]
lecroy-xstream: Wait for trigger before acquiring additional frames

6 years agolecroy-xstream: Properly handle a stopping acquisition
Soeren Apel [Wed, 3 Jan 2018 22:44:27 +0000 (23:44 +0100)]
lecroy-xstream: Properly handle a stopping acquisition

6 years agolecroy-xstream: Keep acquiring infinitely if no frame limit is set
Soeren Apel [Sun, 3 Dec 2017 21:10:56 +0000 (22:10 +0100)]
lecroy-xstream: Keep acquiring infinitely if no frame limit is set

6 years agohantek-dso: Capture ratio is a uint64_t.
Uwe Hermann [Wed, 10 Jan 2018 21:20:45 +0000 (22:20 +0100)]
hantek-dso: Capture ratio is a uint64_t.

From src/hwdriver.c:

  {SR_CONF_CAPTURE_RATIO, SR_T_UINT64, "captureratio",
          "Pre-trigger capture ratio", NULL},

6 years agohantek-dso: config_set(): Shorten SR_CONF_CAPTURE_RATIO case.
Uwe Hermann [Wed, 10 Jan 2018 21:16:37 +0000 (22:16 +0100)]
hantek-dso: config_set(): Shorten SR_CONF_CAPTURE_RATIO case.

The sr_config_set() wrapper already checks for SR_CONF_CAPTURE_RATIO
being 0..100.

6 years agohantek-dso: Add missing SR_PRIV.
Uwe Hermann [Wed, 10 Jan 2018 19:05:20 +0000 (20:05 +0100)]
hantek-dso: Add missing SR_PRIV.

6 years agohantek-dso: Sample rate is a uint64_t.
Uwe Hermann [Wed, 10 Jan 2018 19:03:54 +0000 (20:03 +0100)]
hantek-dso: Sample rate is a uint64_t.

Also make 'base' uint64_t, otherwise there'll be compiler warnings.

6 years agohantek-dso: Random cosmetics, drop unneeded debug output.
Uwe Hermann [Wed, 10 Jan 2018 19:01:40 +0000 (20:01 +0100)]
hantek-dso: Random cosmetics, drop unneeded debug output.

6 years agohantek-dso: dso2250: Fix capture runaway, only do the requested number of frames.
Philipp Marek [Wed, 20 Dec 2017 15:10:59 +0000 (16:10 +0100)]
hantek-dso: dso2250: Fix capture runaway, only do the requested number of frames.

After the first capture ->num_frames never got to be _equal_
to ->limit_frames; fixed by resetting to zero in dev_acquisition_stop(),
and protected against similar problems in the future by switching to
greater-or-equal instead.

6 years agohantek-dso: dso2250: Allow setting TRIGGER_LEVEL as well.
Philipp Marek [Wed, 20 Dec 2017 14:32:42 +0000 (15:32 +0100)]
hantek-dso: dso2250: Allow setting TRIGGER_LEVEL as well.

6 years agohantek-dso: Fix a memory leak.
Philipp Marek [Tue, 21 Nov 2017 15:10:33 +0000 (16:10 +0100)]
hantek-dso: Fix a memory leak.

6 years agohantek-dso: Fix segfault when accessing already free()d memory.
Philipp Marek [Tue, 21 Nov 2017 13:50:18 +0000 (14:50 +0100)]
hantek-dso: Fix segfault when accessing already free()d memory.

This fix was guessed from other drivers' code.

This fixes bug #458.

6 years agohantek-dso: dso2250: It's not HORIZ_TRIGGERPOS but CAPTURE_RATIO.
Philipp Marek [Sun, 19 Nov 2017 18:44:29 +0000 (19:44 +0100)]
hantek-dso: dso2250: It's not HORIZ_TRIGGERPOS but CAPTURE_RATIO.

Seems a bit unfortunately named; if my current guess is right,
perhaps it should be
  :%s/SR_CONF_HORIZ_TRIGGERPOS/SR_CONF_HORIZ_DISPLAYOFFSET/g

6 years agohantek-dso: dso2250: Support sample rates correctly.
Philipp Marek [Sat, 18 Nov 2017 15:02:02 +0000 (16:02 +0100)]
hantek-dso: dso2250: Support sample rates correctly.

Fast mode not done yet, only 125MHz allowed right now.

6 years agohantek-dso: dso2250: Report the sample rate back.
Philipp Marek [Sat, 18 Nov 2017 14:04:03 +0000 (15:04 +0100)]
hantek-dso: dso2250: Report the sample rate back.

So that cursor (and other) measurements and the time axis are correct.

6 years agohantek-dso: dso2250: Initial support for the Hantek DSO 2250.
Philipp Marek [Fri, 17 Nov 2017 09:29:24 +0000 (10:29 +0100)]
hantek-dso: dso2250: Initial support for the Hantek DSO 2250.

Crashes after first acquiration, but at least it _does_ acquire data.

6 years agoudev rules: Add Hantek 4032L IDs.
Uwe Hermann [Fri, 5 Jan 2018 18:36:01 +0000 (19:36 +0100)]
udev rules: Add Hantek 4032L IDs.

6 years agohantek-4032l: Add initial driver implementation.
Andreas Zschunke [Sat, 5 Mar 2016 20:55:02 +0000 (21:55 +0100)]
hantek-4032l: Add initial driver implementation.

[Note: This patch is basically a squashed version of the initial driver
commits by Andreas Zschunke <redacted>, two fixes by
Andrej Valek <redacted>, and various coding style / cosmetic
fixes by Uwe Hermann <redacted> to make the driver a lot more
consistent with the rest of the libsigrok code-base.]

6 years agohantek-4032l: Initial driver skeleton.
Andreas Zschunke [Sat, 5 Mar 2016 06:56:33 +0000 (07:56 +0100)]
hantek-4032l: Initial driver skeleton.

6 years agozeroplus-logic-cube: Add LAP-16032U
Michał Janiszewski [Mon, 1 Jan 2018 13:37:39 +0000 (14:37 +0100)]
zeroplus-logic-cube: Add LAP-16032U

6 years agorigol-ds: Fix crash when fetching logic channels
Stefan Brüns [Mon, 11 Dec 2017 03:17:26 +0000 (04:17 +0100)]
rigol-ds: Fix crash when fetching logic channels

When refactoring the code, some places where sr_scpi_send was replaced
by rigol_ds_config_set the first argument was not changed from sdi->conn
to sdi. Fix the remaining ones.

Fix: https://sigrok.org/bug/1073

Signed-off-by: Stefan Brüns <redacted>
6 years agozeroplus-logic-cube: Fix Logian-16L metadata.
Uwe Hermann [Mon, 25 Dec 2017 14:42:06 +0000 (15:42 +0100)]
zeroplus-logic-cube: Fix Logian-16L metadata.

According to a vendor software screenshot of a user on IRC, this
device is detected as having 200MHz max. samplerate and 128kBit
memory per channel.

6 years agozeroplus: Add support for Meilhaus Logian-16L.
Uwe Hermann [Mon, 25 Dec 2017 13:30:00 +0000 (14:30 +0100)]
zeroplus: Add support for Meilhaus Logian-16L.

Untested yet, but pretty likely to work.

6 years agosysclk-lwla: Fix a regression with (at least) the LWLA1034.
Uwe Hermann [Sun, 24 Dec 2017 14:42:27 +0000 (15:42 +0100)]
sysclk-lwla: Fix a regression with (at least) the LWLA1034.

This regression was introduced in f1ba6b4b2c9a8ecf90bb31efb218752aa7e49d1a.

Due to how the sysclk-lwla driver does up to 3 open/close operations in
one dev_open() API callback we cannot rely on the sr_dev_open() and
sr_dev_close() wrappers setting the sdi->status variable in this case.

Tested on LWLA1034.

6 years agosysclk-lwla: Fix a segfault in dev_close().
Uwe Hermann [Sun, 24 Dec 2017 14:24:35 +0000 (15:24 +0100)]
sysclk-lwla: Fix a segfault in dev_close().

6 years agosr_dev_close(): Drop unneeded variable.
Uwe Hermann [Sun, 24 Dec 2017 14:23:40 +0000 (15:23 +0100)]
sr_dev_close(): Drop unneeded variable.

6 years agoinput/vcd: fixup VCD timestamp to sigrok samplenum mapping
Gerhard Sittig [Mon, 13 Mar 2017 12:17:05 +0000 (13:17 +0100)]
input/vcd: fixup VCD timestamp to sigrok samplenum mapping

When processing of large VCD input files was spread across multiple
parse_contents() invocations, the resulting sigrok stream of sample data
had gaps in them and total timing was off. For instance 74ms of input
data were interpreted as spanning some 600ms or 300ms, depending on the
number of channels in the input stream.

Move the "previous timestamp" variable to the input module context. This
eliminates the inappropriate gaps and fixes the translation of VCD file
timestamps to sigrok sample numbers.

This fixes bug #1075.

6 years agooutput/csv: Fix a typo.
Uwe Hermann [Thu, 21 Dec 2017 15:06:48 +0000 (16:06 +0100)]
output/csv: Fix a typo.

6 years ago60-libsigrok.rules: Add note about sigrok-androidutils.
Uwe Hermann [Sun, 17 Dec 2017 19:38:27 +0000 (20:38 +0100)]
60-libsigrok.rules: Add note about sigrok-androidutils.

6 years agofx2lafw: Update comments listing supported devices.
Uwe Hermann [Sun, 17 Dec 2017 19:19:13 +0000 (20:19 +0100)]
fx2lafw: Update comments listing supported devices.