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.
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.
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.
[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.]
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.
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.
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.
Stefan Brüns [Sun, 29 Oct 2017 19:57:11 +0000 (20:57 +0100)]
cleanup udev part of README.devices, reflect split rules
Remove vague statements from the README. On all current distributions,
the udev paths are identical, anyone deliberately deviating from the
defaults should be able to handle it by themselves.
Rules in /etc/udev/rules.d/ should only be used for customization, or
for locally built packages.
Stefan Brüns [Sun, 29 Oct 2017 19:03:53 +0000 (20:03 +0100)]
contrib: Split device access policy from the device database
Split the distribution independent database from the access policy rules.
This avoids warnings due to granting permissions to the commonly unknown
plugdev group, and allows simple overrides of the used access policy.
Stefan Brüns [Sun, 29 Oct 2017 17:35:06 +0000 (18:35 +0100)]
contrib: rename udev rules for correct rule ordering on systemd systems
The "uaccess" tag has to be added before the "seat" rule is evaluated.
The upstream default for the seat rule is "71-seat.rules", so use
60-libsigrok.rules for appropriate lexicographical sorting.
Also use a dash instead of underscore, the latter is commonly used as a
replacement character of unsafe characters in autogenerated identifiers.
Frank Stettner [Thu, 2 Nov 2017 17:04:59 +0000 (18:04 +0100)]
drivers: Fix locale dependent string to float conversion
Some drivers used locale dependent functions for converting strings
to float/double values. These functions fail when the decimal mark
is a "," in the locale settings but the string contains a ".".
Soeren Apel [Wed, 11 Oct 2017 16:14:56 +0000 (18:14 +0200)]
demo: Properly handle low samplerates
A "low samplerate" in this case means anything where
samples_todo is less than SAMPLES_PER_FRAME. This case
wasn't handled properly before, resulting in wrong
amounts of data being sent out.
Soeren Apel [Mon, 9 Oct 2017 05:32:31 +0000 (07:32 +0200)]
lecroy-xstream: Fix sample rate
We can't use the memory size command because it returns
the *maximum* memory used, not the *actual* memory used.
Hence, we only know the number of samples per div once
sample data actually comes in.
Soeren Apel [Tue, 3 Oct 2017 11:29:46 +0000 (13:29 +0200)]
lecroy-xstream: Use best-effort strategy for unknown models
As there is a huge range of supported LeCroy scopes, naming
the IDN response for every single one of them is going to be
impossible. Hence, it makes more sense to treat all LeCroy
devices as if they were scopes and supported. This approach
lets users try to see how far they get and if they run into
issues, they can then be treated separately - e.g. by creating
a custom device profile.
Unless we do this, the vast majority of LeCroy scopes will
not be recognized by the driver.
beaglelogic: Changes for proper operation in PulseView
Set samplelimit to a sane value (was causing PulseView to
crash earlier), as well as advertise samplerate using SR_CONF_LIST
so that PulseView can show the sample rates.
The function drains off all the remaining data in the receive socket
and is triggered before starting a capture and after a capture is
completed. In the absence of this function, there is a possibility of
data corruption and also the NodeJS TCP server throws an error if the
buffer is not completely read out before the socket is closed.
BeagleLogic now supports two modes of interface - one being the
native mode running on an ARM system like the BeagleBone Black
and the other mode acting like a TCP client for the BeagleLogic
server running off a BeagleBone compatible system. This makes it
convenient for desktop users to retrieve samples from BeagleLogic,
no more copying files and SSHing into the BeagleBone hardware in
order to use BeagleLogic.
Stefan Brüns [Sat, 23 Sep 2017 20:16:24 +0000 (22:16 +0200)]
strutil: Fix sr_parse_rational for integral parts between -0 and -1
Values like '-0.1' would be parsed as being positive, as the integral
type does not discern +0 and -0. Also allow values without leading
integral value, to match behaviour of strtod/sr_atof.
Uwe Hermann [Sun, 17 Sep 2017 14:55:50 +0000 (16:55 +0200)]
Drop libftdi 0.x support, require libftdi 1.x.
There were some issues when using libftdi 0.x recently that are fixed
when switching to libftdi 1.x (not really worth the effort to investigate).
libftdi 1.x has been around several years now and should be available
in most recent distros and OSes. For the rare cases where it is not,
it's easy enough to get it via backport packages, or build from source,
or sigrok users can just use our binary installers for most OSes.