Bert Vermeulen [Mon, 25 Mar 2013 19:41:28 +0000 (20:41 +0100)]
struct sr_samplerates is now obsolete
sr_config_get() of SR_CONF_SAMPLERATE now returns a GVARIANT_TYPE_DICTIONARY.
This dictionary contains a single key-value pair. Possible values for the key:
- "samplerates": the value is an array of GVARIANT_TYPE_UINT64 representing
all valid samplerates.
- "samplerate-steps": the value is an array of GVARIANT_TYPE_UINT64 with
exactly three members, which represent the lowest samplerate, highest
samplerate, and the minimum step, respectively.
Bert Vermeulen [Mon, 25 Mar 2013 14:38:44 +0000 (15:38 +0100)]
Use GVariant for sr_config_*() functions
sr_config_get() provides a GVariant owned by the caller, so it must be
released with g_variant_unref() when done.
sr_config_set() takes a GVariant from the caller which may be floating;
it will be properly sunk and release after use by this function. Thus
the output of g_variant_new_*() may be used as an argument.
sr_config_list() also provides a GVariant owned by the caller, to be
unreferenced when done.
Uwe Hermann [Tue, 9 Apr 2013 17:52:38 +0000 (19:52 +0200)]
configure.ac: Fix checks for cross-compiles.
When checking architecture-specific things, always check $host, i.e. the
architecture we're building _for_, not the one we happen to build _on_.
E.g. when cross-compiling _for_ Android (or Windows or others) it's important
to check for Android in $host; whether we happen to cross-compile _on_ a Linux
or Windows or OpenBSD or FreeBSD machine ($build) doesn't matter, only the
fact that we compile _for_ Android is important for most checks.
Uwe Hermann [Tue, 9 Apr 2013 16:47:31 +0000 (18:47 +0200)]
configure.ac: Print $host and $build.
In the configure summary at the end also print the architecture we're
building on ($build) and the target host we build for ($host). The two are
not necessarily the same, e.g. in the case of cross-compiles.
Uwe Hermann [Tue, 9 Apr 2013 16:08:16 +0000 (18:08 +0200)]
configure.ac: Mention required lib versions.
In the summary output at the end of a configure run, explicitly mention
which versions of which libraries are required, and also the version which
pkg-config has found.
Uwe Hermann [Tue, 9 Apr 2013 08:03:58 +0000 (10:03 +0200)]
configure.ac: Cosmetics for the list of drivers.
Use the canonical driver name (all-lowercase, e.g. "serial-dmm") in the
list of enabled/disabled drivers that configure prints after a run.
It's common to many drivers that they support multiple devices, so
printing one device name (e.g. "ChronoVu LA8") is seldom really correct.
E.g. the agilent-dmm, asix-sigma, brymen-dmm, colead-slm, fluke-dmm,
fx2lafw, hantek-dso, lascar-el-usb, mic-985xx, openbench-logic-sniffer,
rigol-ds1xx2, uni-t-dmm, victor-dmm, and zeroplus-logic-cube drivers
all support more than just one device.
So, just print the driver name instead which is more correct anyway
since it's specifically a list of enabled/disabled drivers.
Uwe Hermann [Mon, 8 Apr 2013 13:56:54 +0000 (15:56 +0200)]
configure.ac: Improve a libusb-1.0 related check.
Don't rely on the "heuristic" that 'libusb_CFLAGS' will be non-empty if
libusb-1.0 was found, but rather use the proper method of checking the
variable 'have_libusb1_0' which pkg-config will set to "yes"/"no"
depending on whether it finds the library.
Uwe Hermann [Mon, 8 Apr 2013 13:40:57 +0000 (15:40 +0200)]
configure.ac: Improve USB/EZUSB/serial checks.
- If libusb-1.0 is not found, do not compile in ezusb.c and usb.c since
they require libusb.h. The respective hardware drivers that use
libusb-1.0, and usb.c and/or ezusb.c will be excluded from the build
elsewhere in configure.ac. Rename NEED_EZUSB to NEED_USB.
- Drop the NEED_SERIAL check and always compile in serial.c. This is a
very small chunk of code, it does not depend on any external
libraries that might be missing, and it compiles on all architectures.
Thus there's no need to conditionally include or exclude it.
Uwe Hermann [Tue, 9 Apr 2013 10:32:30 +0000 (12:32 +0200)]
configure.ac: Fix the order of some entries.
In order for lib autodetection and disabling of drivers (which require
libs that cannot be found) to work, the order of AC_ARG_ENABLEs,
AM_CONDITIONALs, and AC_DEFINEs needs to be changed.
All drivers start out enabled or disabled (depending on whether
the --disable-drivers option was supplied or not). Then, any driver can
be enabled or disabled explicitly via --enable-<drivername> or the
resp. --disable-<drivername> option. Finally, pkg-config checks for all
libraries are performed, and all drivers which require a library that
cannot be found are disabled explicitly (regardless of any
--enable-<drivername> option that might have been supplied).
Uwe Hermann [Mon, 8 Apr 2013 12:46:13 +0000 (14:46 +0200)]
configure.ac: Improve pkg-config related checks.
Until now, we checked for certain (optional) libraries via pkg-config and
the configure script would abort if any of them was not found, even
though they were optional. It was up to the user to then figure out which
combination of --disable-<drivername> switches were required for his
specific OS (and set of installed libs) to get a working configure run.
Only if the user already specified enough --disable-<drivername>
switches beforehand, so that all drivers which require a missing library
were disabled, would the configure run not check for that specific lib
(and would thus not fail).
With this change, we now always unconditionally check for all libs
(required and optional) via pkg-config. However, whether an (optional) lib
is found or not, configure will not abort. Instead, it'll just disable
all drivers which need a lib that cannot be found.
The user will no longer have to supply --disable-<drivername> parameters
in order to get a working build.
Uwe Hermann [Sun, 17 Mar 2013 12:19:57 +0000 (13:19 +0100)]
configure.ac: Drop std-options, unneeded.
The automake 'std-options' option checks whether all installed tools
and scripts have a --help and --version CLI option. This check is not
needed for libsigrok though, since it doesn't install any tools.
Bert Vermeulen [Sat, 16 Mar 2013 19:17:41 +0000 (20:17 +0100)]
add SR_CONF_SAMPLE_INTERVAL
Expresses the time between samples, in milliseconds. This can be used
for devices with a samplerate > 1 second, such as dataloggers, which
cannot be expressed with SR_CONF_SAMPLERATE.
Uwe Hermann [Thu, 7 Mar 2013 08:37:42 +0000 (09:37 +0100)]
Add a testsuite for libsigrok.
This adds a suite of unit tests for libsigrok. It uses the 'Check'
tool/library (apt-get install check) to run the tests.
The configure tool tries to find libcheck. If it succeeds, a
"make check" will run all tests. Otherwise, none of the tests will
be built and "make check" will not run any tests.
This also means that users who don't have 'check' installed will still
be able to build and install libsigrok just fine.
Bert Vermeulen [Thu, 21 Feb 2013 13:48:43 +0000 (14:48 +0100)]
input: feed the filename to the module's init() function
This is essential if a format contains e.g. the number of probes; the
init() function needs to initialize the sr_dev_inst struct, but needs
access to the file to properly add the probes to it.
Uwe Hermann [Fri, 8 Feb 2013 22:13:33 +0000 (23:13 +0100)]
zeroplus: Only report supported samplerates.
The currently supported model LAP-C(16032) doesn't support the
samplerates 150MHz and 200MHz which some of the other models have.
Thus, do not report these samplerates to the frontends. E.g. sigrok-cli
should not show them via --show and GUIs should not list them in their
"Samplerates" drop-down.
Uwe Hermann [Wed, 6 Feb 2013 18:57:32 +0000 (19:57 +0100)]
Add and use std_session_send_df_header().
This is a small helper function which sends the SR_DF_HEADER packet that
drivers usually emit in their hw_dev_acquisition_start() API callback.
It simplifies and shortens the hw_dev_acquisition_start() functions
quite a bit.
It also simplifies the input modules which send an SR_DF_HEADER packet, too.
This patch also automatically removes some unneeded malloc/free in some
drivers for the 'packet' and 'header' structs used for SR_DF_HEADER.
Uwe Hermann [Fri, 1 Feb 2013 21:58:54 +0000 (22:58 +0100)]
hw_dev_close(): Move common checks to wrapper.
Check the relevant arguments for != NULL before calling the actual
driver-specific function, so that the driver can safely assume those
arguments are non-NULL. This removes the need to duplicate these
checks in every driver.
This patch might also work for a number of other Brymen models
-- 859(a), 867, 869---
including their respective rebadges from Greenlee, Extech, and Amprobe.
Uwe Hermann [Mon, 28 Jan 2013 19:00:54 +0000 (20:00 +0100)]
sr_driver_scan(): Improve checks.
Check the relevant arguments for != NULL before calling the actual
driver-specific function, so that the driver can safely assume those
arguments are non-NULL. This removes the need to duplicate these
checks in every driver.
Also, do some minor whitespace and consistency improvements.