Martin Ling [Thu, 19 Mar 2015 16:15:52 +0000 (16:15 +0000)]
rigol-ds: Add DS1000Z series support.
Tested on an MSO1104Z with firmware 00.04.02.SP4.
The analog channels are captured correctly. For the MSO series, with digital
channels, there are two outstanding issues:
1. Logic data is retrieved per-channel, one byte per sample, with the value
in the LSB of each byte. The current datafeed logic format doesn't allow
this format to be passed on directly. I suggest we resolve that rather than
making the driver buffer and interleave the data.
As stands, the code will retrieve data for all channels and pass it onto
the datafeed with unitsize=1. Channel D0 can used correctly if selected
alone. For other channels, data is passed to the frontend but the API does
not provide a way to associate it with the correct channel.
2. Channels CH3 and CH4 are multiplexed with D0-7 and D8-15 respectively, so
enabling these is mutually exclusive. We don't currently have a way to
express this constraint to the frontend.
eightdot [Mon, 16 Mar 2015 09:34:08 +0000 (10:34 +0100)]
Various fixes/updates to make the driver compile.
This patchset was originally done by eightdot <redacted> by
manually forward-porting parts of the changes done by Bert Vermeulen (see
previous commits), but then heavily modified by Uwe Hermann to be based on
top off the (git-)rebased patches from Bert Vermeulen instead.
Note: This initial DSLogic code is *not* yet in a working or usable
state. It should be considered as a basis for further work only, for now.
Uwe Hermann [Fri, 13 Mar 2015 18:12:47 +0000 (19:12 +0100)]
ols: Fix a compiler warning (unused variable).
CC src/hardware/openbench-logic-sniffer/api.lo
../src/hardware/openbench-logic-sniffer/api.c: In function 'scan':
../src/hardware/openbench-logic-sniffer/api.c:103:10: warning: unused
variable 'probefd' [-Wunused-variable]
GPollFD probefd;
^
Uwe Hermann [Fri, 13 Mar 2015 07:33:22 +0000 (08:33 +0100)]
ols: Fix detection and acquisition on Windows.
Use the more portable sp_input_waiting() instead of g_poll() with FDs.
Thanks to Martin Ling for the hints. This is tested on Linux and Win7
using an OLS; scanning for the device and starting an acquisition works.
Current exclude patterns lead to unwanted exclusion of all paths
containing common directory names like output, bindings etc. even
if those names occur higher in the directory structure.
Make exclude patterns more specific by prefixing them with src/.
Uwe Hermann [Mon, 16 Feb 2015 00:53:15 +0000 (01:53 +0100)]
baylibre-acme: Drop unneeded comment.
There's indeed no g_fclose() unfortunately. The g_*() wrappers for file
handling are mainly there to deal with portability issues in file names
(encoding, character sets, etc) on different platforms.
Uwe Hermann [Mon, 16 Feb 2015 00:51:53 +0000 (01:51 +0100)]
baylibre-acme: Fix a compiler warning.
Use PRIu64 to avoid the following compiler warning:
CC src/hardware/baylibre-acme/gpio.lo
protocol.c: In function 'bl_acme_set_shunt':
protocol.c:341:2: warning: format '%llu' expects argument of type 'long long unsigned int', but argument 3 has type 'uint64_t' [-Wformat=]
g_fprintf(fd, "%llu\n", MOHM_TO_UOHM(shunt));
^
baylibre-acme: Add support for probe factor setting.
Implement support for SR_CONF_PROBE_FACTOR setting in BayLibre ACME
driver. Given the channel-group parameter this allows to set the
shunt resistance for each probe.
Aurelien Jacobs [Sat, 14 Feb 2015 22:48:36 +0000 (23:48 +0100)]
rigol-ds: fix search for the closest vdiv.
We try to find the smallest diff by comparing each diff with
the previously known smallest diff, so initially, this smallest diff
should be INFINITY so that we are sure to find a smaller one.
This fixes the following exception:
sr: rigol-ds: Negative vdiv index: -1.
Caught exception: not applicable
Uwe Hermann [Sat, 14 Feb 2015 18:08:39 +0000 (19:08 +0100)]
rigol-ds: Add missing 20/50/100V vdiv entries.
These are available on e.g. Rigol DS1102E (or "upgraded" DS1052E).
Without this, if one of the channels happens to have been set to
one of the missing vdiv settings frontends (e.g. PulseView) will
have some trouble using the scope:
Aurelien Jacobs [Thu, 12 Feb 2015 10:30:52 +0000 (11:30 +0100)]
input/vcd: fix parse_header() return value check.
Mixing tests for both a boolean and an SR_ERR at the same time is not
really a good idea.
parse_header() actually returns a boolean so only check if it returns FALSE.
This fixes the following gcc-5 warning:
src/input/vcd.c: In function 'receive':
src/input/vcd.c:506:34: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
if (!parse_header(in, in->buf) != SR_OK)
^
Aurelien Jacobs [Thu, 12 Feb 2015 10:24:11 +0000 (11:24 +0100)]
Remove the inline qualification from sr_rational_set().
Inlining can only happen in the same compilation unit where the
function was defined, so there is no sense declaring an inline
function in a header if this function is not defined in this
same header.
This fixes the following gcc-5 warning:
In file included from include/libsigrok/libsigrok.h:1066:0,
from src/version.c:21:
include/libsigrok/proto.h:36:20: warning: inline function 'sr_rational_set' declared but never defined
SR_API inline void sr_rational_set(struct sr_rational *r, uint64_t p, uint64_t q);
^
Aurelien Jacobs [Thu, 12 Feb 2015 10:14:37 +0000 (11:14 +0100)]
Correctly copy sr_datafeed_meta in sr_packet_copy().
Commit 5801d558 replaced g_slist_copy_deep() by some incorrect code
that actually leaks the newly allocated memory, instead of doing
a deep copy.
This new version should be more correct, more concise, and it fixes
the following warning:
src/session.c: In function 'sr_packet_copy':
src/session.c:1025:38: warning: passing argument 2 of 'g_slist_foreach' from incompatible pointer type [-Wincompatible-pointer-types]
g_slist_foreach(meta_copy->config, (GCopyFunc)copy_src, NULL);
^
In file included from /usr/include/glib-2.0/glib/gmain.h:26:0,
from /usr/include/glib-2.0/glib/giochannel.h:33,
from /usr/include/glib-2.0/glib.h:54,
from src/session.c:24:
/usr/include/glib-2.0/glib/gslist.h:125:10: note: expected 'GFunc {aka void (*)(void *, void *)}' but argument is of type 'void * (*)(const void *, void *)'
void g_slist_foreach (GSList *list,
^
In order to determine the target OS when cross-compiling libsigrok
we need autotools to set the 'target_os' variable. This macro
determines the system type and sets output variables to the names
of the canonical system types.
Daniel Elstner [Sat, 31 Jan 2015 20:04:14 +0000 (21:04 +0100)]
sysclk-lwla: Widen constant to 64 bit before shifting
(lwla_convert_trigger): Fix trigger mask computation bug introduced
by recent change: Widen constant to 64 bit before shifting so that
channel nunmbers beyond 32 are processed correctly.
Uwe Hermann [Thu, 29 Jan 2015 07:51:31 +0000 (08:51 +0100)]
Lower dependency to glib 2.32.
By avoiding g_slist_copy_deep() for now, we can easily allow libsigrok
to build against glib 2.32 (less hassle for users of stable/older
distros or OSes).
Uwe Hermann [Tue, 27 Jan 2015 08:00:34 +0000 (09:00 +0100)]
output/gnuplot: Use .dat as suggested file extension.
Gnuplot doesn't have any "official" file name extension(s). It uses
(at least) two different types of files basically:
- "control files": These can have many different somewhat commonly
used extensions such as .gpi, .gnu, .gnuplot, .gp, .plt, .gih,
others. These files don't contain data, only Gnuplot commands such
as 'set yrange [75:105]', 'set ylabel "foo" offset 1', and so on.
- "data files": This is what libsigrok reads and writes. These files
contain actual data to be graphed by Gnuplot (with the help of a
specially-crafted control file, see above). The data is usually in
a tab-separated format. The common file extension is usually .dat,
though many others are possible as well.
Uwe Hermann [Mon, 26 Jan 2015 14:26:15 +0000 (15:26 +0100)]
cxx: Fix a linking issue.
Fix "undefined reference to `sigrok::EnumValue<sigrok::LogLevel,
sr_loglevel>::_values'", which happens at least when using clang(++),
e.g. on Linux, Mac OS X, or FreeBSD.
This fixes bug #534.
Thanks to Uffe Jakobsen and Martin Ling for reporting and investigating!
Uffe Jakobsen [Thu, 22 Jan 2015 00:11:22 +0000 (01:11 +0100)]
Fix FreeBSD issue with libusb_get_port_numbers()
Currently (as of date 20150122) an ioctl problem within the
FreeBSD kernel is preventing libusb_get_port_numbers() from working.
Hence calls to libusb_get_port_numbers() will always return 0.
This makes it impossible to establish a physical path the the usb device.
This problem has existed "forever" -
meaning that libusb_get_port_numbers() has never worked.
A fix is committed to FreeBSD "current" head -
and will later be merged (MFC'ed) to maintenance branches.
See: https://svnweb.freebsd.org/base?view=revision&revision=277417
Additionally FreeBSD requires that devices prior to calling
libusb_get_port_numbers() have been opened with libusb_open().
The patch is "forwards-compatible".
Currently it acts specificly to libusb_get_port_numbers()
currently returning 0 on FreeBSD.
In these situations it constructs an artificial path to the device.
When FreeBSD kernels appears with proper working ioctl
supporting libusb_get_port_numbers() the code will construct
proper physical paths for newer kernels - while still generating
artificial physical paths for older defective kernels.
Add new config options to libsigrok - 'averaging', which allows to
enable averaging of samples and 'avg_samples' for setting the number
of samples to be averaged over in each cycle.