Daniel Elstner [Sat, 15 Aug 2015 00:28:54 +0000 (02:28 +0200)]
Build: Simplify the hardware driver selection
Replace DRIVER() and DRIVER2() by a single SR_DRIVER() macro.
Derive the names of shell variables and preprocessor defines
programatically to cut down on repetition.
Daniel Elstner [Sat, 15 Aug 2015 16:33:05 +0000 (18:33 +0200)]
Build: Do not distribute generated headers
version.h and enums.hpp are generated at build time and should
not be included in the distribution tarball. This seems to have
triggered a weird error when doing a VPATH build of the dist
tarball.
Daniel Elstner [Sat, 15 Aug 2015 16:10:50 +0000 (18:10 +0200)]
Build: Pass nostdinc option to automake
It seems automake automatically adds the directory containing
the generated version.h to the include path. Use nostdinc to
disable default includes altogether.
Daniel Elstner [Sat, 15 Aug 2015 14:10:36 +0000 (16:10 +0200)]
Build: Prefix directory to include of enums.hpp
This fixes a build problem due to the reduced include search paths
introduced by my recent changes. Also fix a couple of other
includes to use angle brackets.
Daniel Elstner [Fri, 14 Aug 2015 19:01:59 +0000 (21:01 +0200)]
Build: Append git revision hash to version
Append the git revision hash to the libsigrok package version,
unless HEAD exactly matches a release tag. Note that this does
not affect the version known to autoconf -- e.g. source tarballs
created by make dist will not receive a revision suffix.
Changes to git HEAD automatically trigger a reconfiguration.
Uncommitted changes do not, which is why I left out the -dirty
suffix.
Daniel Elstner [Fri, 14 Aug 2015 16:03:47 +0000 (18:03 +0200)]
Build: Delay expansion of $datadir in FIRMWARE_DIR
Make it so that $(datadir) is resolved at make time, as per
autotools recommendations. Note that $datadir is not fully
resolved at configure time to begin with, i.e. part of it
already was evaluated at make time.
Daniel Elstner [Fri, 14 Aug 2015 15:53:06 +0000 (17:53 +0200)]
Build: Make version.h a configuration header
Use the proper tool for the job and make libsigrok/version.h
a secondary configuration header, so that autoconf's AC_DEFINE
machinery can be used to generate it. Note that the header
template is still hand-written, enabling fine control of the
content.
Daniel Elstner [Wed, 12 Aug 2015 23:18:51 +0000 (01:18 +0200)]
Build: Set local include directories in Makefile.am
Move the include flags for files in the source tree from
configure.ac to Makefile.am where they belong. Also use
AM_CPPFLAGS instead of CFLAGS/CXXFLAGS to make sure the
files in the build/source tree are always picked up first.
Also, remove the include/libsigrok sub-directory from the
search path, thereby making the <libsigrok/> prefix mandatory
when building libsigrok itself. This matches the convention
already imposed on users of the library.
libsigrok: demo: close pipes on dev_acquisition_stop()
Fixes a bug where new acquisition failes due to leftover pipes from
previous acquisitions:
sr: demo: dev_acquisition_start: pipe() failed
Indeed, PulseView had 2024 pipes opened. With this fix, it stabilizes at
33 with sampling thread active.
baylibre-acme: Add a workaround for slow data acquisition.
At high sampling rates and maximum channels we are not able to acquire
samples fast enough, even though frontends still think that samples
arrive on time. This causes visible shifts in frontend plots.
To compensate for the delay introduce the following workaround: check
if we are late (if any clock events have been missed) and resend the
last frame n times (n == number of missed clock events).
Daniel Lezcano [Thu, 4 Jun 2015 17:01:27 +0000 (19:01 +0200)]
baylibre-acme: Use timerfd instead of a fake pipe.
Currently baylibre-acme uses a fake pipe as the input channel required by
libsigrok API and calls sleep() in the data acquisition callback to create
intervals between measurements.
Switch to a more elegant approach: use Linux' timerfd and set a periodic
timer equal to the sampling rate. Then read the data every time the timer
expires.
Signed-off-by: Daniel Lezcano <redacted> Signed-off-by: Bartosz Golaszewski <redacted>
Daniel Lezcano [Wed, 27 May 2015 18:22:02 +0000 (20:22 +0200)]
baylibre-acme: Optimize reading of values from sysfs.
Opening a file has a cost (security, allocation, syscalls). The
read_sample() function always does an open/read/close sequence.
In order to optimize that, let's open the file at the moment the
acquisition starts, close it when the acquisition stops and make
read_sample() only lseek() to the beginning of the file and read
the value.
Signed-off-by: Daniel Lezcano <redacted> Signed-off-by: Bartosz Golaszewski <redacted>
Daniel Elstner [Wed, 24 Jun 2015 17:16:49 +0000 (19:16 +0200)]
sysclk-lwla: Do not create channels in reverse order
This was originally done as an optimization in combination with a list
reversal which has since been removed from the code. Thus, un-reverse
the channels so that the UI lists them in the correct order again.
bindings/python: Handle import failures without crashing
When the import of gi.repository.GLib failed, we would get a NULL
pointer that we passed along without any checking. In this situation,
the entire program would crash with a segmentation fault, and no
message to indicate the problem.
When the import fails, abort the SWIG init and print a message. The
Python interpreter then prints out a backtrace, which can be useful
in tracking down the problem.
scpi-pps: Chroma 62000P: Get capabilities from device name
The Chroma 62000P series comes in various models with different
current and voltage capabilities. These are encoded in the *IDN
string, so just get them from there, rather than needing a profile
for every model.
Aurelien Jacobs [Sun, 15 Mar 2015 17:43:06 +0000 (18:43 +0100)]
Rename SR_CONF_OUTPUT_* to SR_CONF_*.
All those options are currently applied only to power-supplies
but they could apply as well to electronic loads, except for the
fact that electronic loads channels are called inputs and not
outputs.
Also when you think about an SMU (or any kind of 4-quadrants
power-supply), their channels can both source and sink current,
so they can be considered as input as much as output.
Those SR_CONF_* are thus renamed so that they can be used in all
those situations.
Aurelien Jacobs [Sat, 9 May 2015 21:06:10 +0000 (23:06 +0200)]
scpi-pps: don't fail acquisition start for devices with no CMD_SELECT_CHANNEL
For devices such as the HP 6632B the following invocation was failing due to
scpi_cmd(sdi, SCPI_CMD_SELECT_CHANNEL, ...) returning SR_OK_CONTINUE.
./sigrok-cli -d scpi-pps:conn=/dev/ttyUSB0:serialcomm=9600/8n1 --continuous
sr: session: sr_session_start: could not start an acquisition (not enough data to decide error status yet)
Failed to start session.
scpi-pps: Add infrastructure for controlling output frequency
This patch only adds the needed infrastructure to control output
frequency in the same manner as output voltage or current limit. This
does require a new field in the channel_spec struct, for the sake of
symmetry.
global: Treat SR_CONF_OUTPUT_FREQUENCY as float instead of uint64_t
This makes 'output_frequency' symmetrical with 'output_current' and
'output_voltage'. On a more fundamental level, there's no reason why
frequency should be treated as a discrete quantity, other than
"es51919 used it this way".
Only the capabilities which map directly to SCPI commands supported by
sigrok are implemented at this time. This is sufficient to control
the most often used functionality of this AC source
scpi: Accept *IDN responses with more than four tokens
Some devices with more than one microcontroller report the firmware
version for each of them, giving us more than four tokens. When that
happens, sigrok aborts, even though it received a valid response.
This happens, for example with the Chroma 61604:
'Chroma ATE,61604,001060,1.25,1.34,1.20'
Compile with -std=c11 along with _POSIX_C_SOURCE=200112L.
With gcc 5.1 released and defaulting to std=gnu11, the code will be compiled
according to different standards depending on the compiler version so we
should better specify explicitly what standard we are targetting.
C11 is now quite mature, it is supported in the just release Debian stable
(gcc 4.9) and also in old-stable (gcc 4.7), so there should be no reason to
use anything more ancient.
We also should have no reason to need any non-standard GNU extension.
So using only C11 + POSIX sounds like the best option right now.
isascii() is a superset of isalpha() and isblank() so the current
code doesn't really make sense.
Moreover, isascii(x) is just a funky and non standard way to
write x < 128.
Uwe Hermann [Sun, 12 Apr 2015 17:28:03 +0000 (19:28 +0200)]
windows: Fix various compiler warnings.
Add LIBUSB_CALL where needed to avoid warnings such as the following:
In file included from src/hardware/hantek-dso/api.c:34:0:
src/hardware/hantek-dso/dso.h:212:13:
note: expected 'libusb_transfer_cb_fn' but argument is of type 'void (*)(struct libusb_transfer *)'
SR_PRIV int dso_get_channeldata(const struct sr_dev_inst *sdi,
^