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.
Uwe Hermann [Sun, 18 Jan 2015 15:02:54 +0000 (16:02 +0100)]
sr_input_new(): Add missing @param comment.
This fixes a Doxygen warning:
src/input/input.c:209: warning: The following parameters of sr_input_new(const struct sr_input_module *imod, GHashTable *options) are not documented:
parameter 'imod'
Uwe Hermann [Sat, 17 Jan 2015 18:53:44 +0000 (19:53 +0100)]
libsigrokcxx: Drop Requires.private entry.
libsigrokcxx.pc has a "Requires" field listing "libsigrok" which
will cause libsigrok's "Requires.private" entries to be used/inherited
when 'pkg-config --libs --static libsigrokcxx' is used.
Mathias Katzer [Sun, 11 Jan 2015 00:40:28 +0000 (01:40 +0100)]
scpi: Fix incomplete data issue for e.g. Hameg HMO1024.
On a Hameg HMO1024 you get incomplete data because the USB transfer takes
longer than the scpi->read_timeout_ms of 1 second that is defined in
scpi_dev_inst_new(). Therefore reset the timeout in sr_scpi_get_string()
whenever the device sends a partial response.
Janne Huttunen [Sat, 20 Dec 2014 15:33:24 +0000 (17:33 +0200)]
Limit frames instead of samples.
Since every individual measurement is represented by a single frame
and a "sample" isn't all that meaningful concept in this context,
it makes more sense to define possible limit in number of frames.
Make the es51919 driver to support setting a frame limit instead of
a sample limit.
Janne Huttunen [Sat, 20 Dec 2014 15:32:26 +0000 (17:32 +0200)]
Use frames to group a single measurement result together.
In most, but not all, modes the ES51919 reports two separate
analog values for each measurement sample. These values are
mapped to two separate channels and sent in two separate
packets.
A client program needs a way to determine which results are
parts of the same measurement and also know when a complete
measurement is received so it can process the sample. Use
the frame begin and end packets to separate groups that each
represent a single complete measurement.
Jiří Pinkava [Sun, 23 Nov 2014 16:38:28 +0000 (17:38 +0100)]
Do not check for JDK headers if Java bindings are disabled.
This removes an unnecessary build dependency on JDK and fixes
build troubles on systems where javac is present but JDK is not
installed and Java bindings are disabled by ./configure --disable-java.
Vincent Palatin [Mon, 10 Nov 2014 16:17:07 +0000 (08:17 -0800)]
usb_get_port_path(): fix libusb error checking
When libusb cannot access a device, libusb_get_port_numbers() will return
an error. Check the return code rather than doing invalid pointer
operations (out-of-bound read).
Avoid segfaults at sigrok-cli startup on my setup where some USB devices are
not accessible and also make Valgrind happier.
Tim Hatch [Sun, 2 Nov 2014 23:29:38 +0000 (15:29 -0800)]
saleae-logic16: Downgrade error during capture to a message.
Some clone doesn't set this to the exact same value, and both bits in 0x48 are
marked as unknown at
http://sigrok.org/wiki/Saleae_Logic16/Firmware#FPGA_variables
Uwe Hermann [Sat, 22 Nov 2014 21:06:02 +0000 (22:06 +0100)]
python: Silence some warnings via -Wno-uninitialized.
Silence some warnings when building the Python bindings:
sigrok/core/classes_wrap.cpp: In function ‘PyObject* _wrap_new_OutputFormatMap(PyObject*, PyObject*)’:
sigrok/core/classes_wrap.cpp:5232:4: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
^
sigrok/core/classes_wrap.cpp:14383:13: note: ‘argv[0]’ was declared here
PyObject *argv[2];
^
sigrok/core/classes_wrap.cpp: In function ‘PyObject* _wrap_new_ChannelGroupMap(PyObject*, PyObject*)’:
sigrok/core/classes_wrap.cpp:5232:4: warning: ‘argv[0]’ may be used uninitialized in this function [-Wmaybe-uninitialized]
res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<map_type>(),0);
^
sigrok/core/classes_wrap.cpp:23356:13: note: ‘argv[0]’ was declared here
PyObject *argv[2];
^
We add -Wno-uninitialized since the warnings are harmless and we really
don't care about them in the generated classes_wrap.cpp.
Uwe Hermann [Fri, 21 Nov 2014 18:02:10 +0000 (19:02 +0100)]
Use g_malloc0() consistently, simplify error handling.
Use g_malloc0() for small allocations and assume they always
succeed. Simplify error handling in a few places accordingly.
Don't always sanity-check parameters for non-public (SR_PRIV)
functions, we require the developers to invoke them correctly.
This allows further error handling simplifications.