Uwe Hermann [Fri, 17 Jan 2014 16:56:08 +0000 (17:56 +0100)]
configure.ac: Check for all known Python3 pkg-config names.
Even when using pkg-config not all distro/platform specific issues are
transparent, unfortunately. On some systems the pkg-config file is
named "python3.pc" on others it's versioned, e.g. "python-3.2.pc".
See also: http://sigrok.org/wiki/Libsigrokdecode/Python
This should fix the build on e.g. FreeBSD, NetBSD, Mac OS X (some
versions), and possibly various Linux distros, e.g. Gentoo.
Also, drop manual AC_MSG_ERROR() and let PKG_CHECK_MODULES() output a
more verbose and standardized error message if Python 3 is not found.
Uwe Hermann [Fri, 3 Jan 2014 16:41:24 +0000 (17:41 +0100)]
Link against libm to avoid Python related linking errors.
The python3-config script reported "-lm" as linker option previously,
but we switched to using pkg-config (among other things for
cross-compile support) which doesn't report "-lm" though (this is a
common behaviour across multiple distros and OSes).
Bert Vermeulen [Wed, 11 Dec 2013 17:31:56 +0000 (18:31 +0100)]
Load decoders from all search paths, not just the default.
srd_decoder_load_all() was really only getting a list of decoders
from the default (installation) path, so could not find uninstalled
decoders, or those in a custom added search path.
This broke development of new PDs when using the SIGROKDECODE_DIR
environment variable, and broke many of the unit tests in the tests/
directory -- those actually tested against the already-installed
decoders, not the ones about to be installed.
Bert Vermeulen [Tue, 10 Dec 2013 16:17:38 +0000 (17:17 +0100)]
Add protocol decoder testing framework.
This adds a tool in the tests directory, called pdtest. It uses the
"test/" directory in every PD directory, if present, to run the
PD against dumps found in the sigrok-dumps repository, and compares
the output against ".output" files in the "test/" directory. The file
"test/test.conf" is used to configure which tests to run.
A separate tool (tests/runtc.c) is used to run the actual decoding and
report output.
To get an overview of the options, run tests/pdtest without any options.
Bert Vermeulen [Wed, 27 Nov 2013 15:47:04 +0000 (16:47 +0100)]
Automate protocol decoder installation.
This automatically figures out the files to install for each protocol
decoder, without involving autotools.
All python files (filenames ending in .py) are always installed. If a
protocol decoder requires installation of a non-python file, a small
file called 'config' can be created in that protocol decoder's
directory, with the following content:
# comments are ok
extra-install vendorlist.txt commands.txt
Uwe Hermann [Tue, 19 Nov 2013 20:14:03 +0000 (21:14 +0100)]
Add a missing #include.
This causes compiler errors in some setups otherwise, e.g.:
CC libsigrokdecode_la-session.lo
session.c: In function 'srd_session_metadata_set':
session.c:195:46: error: expected ')' before 'PRIu64'
srd_dbg("Setting session %d samplerate to %"PRIu64".",
^
session.c: In function 'srd_session_send':
session.c:242:15: error: expected ')' before 'PRIu64'
"number %" PRIu64 ", %" PRIu64 " bytes at 0x%p",
^
Bert Vermeulen [Mon, 18 Nov 2013 09:44:28 +0000 (10:44 +0100)]
Don't try to load an already-loaded module
Python silently uses the existing module anyway, but the library
was counting it as an extra module. This was exposed by a test
case in the test suite.
Bert Vermeulen [Sun, 10 Nov 2013 11:42:11 +0000 (12:42 +0100)]
Implement OUTPUT_BINARY
This requires the PD to have a tuple in its class called 'binary',
which contains a list of strings describing the different binary
classes it can output. For the SPI decoder this might be 'MOSI' and
'MISO', for example.
The data is submitted to the frontend as struct srd_proto_data_binary,
which contains the class that data belongs to.
'id' defaults to the protocol decoder instance id, and only needs changing
if a decoder chain needs to fork.
'object-type' refers to a Python object, such as int or str.
After registering, the PD submits data as usual with Decoder.put(), with
the only argument a value of the registered object-type.
Bert Vermeulen [Wed, 30 Oct 2013 15:30:05 +0000 (16:30 +0100)]
Pass metadata to PDs only at runtime, not at decoder start
The SRD_CONF_NUM_PROBES metadata key was removed. It wasn't actually
used for anything, since this is trivially available via the configured
(or default) probe list.
The SRD_CONF_UNITSIZE key was removed. The unit size is instead derived
from the probe list: the number of probes packed into the least amount
of space possible defines the unit size.
PD changes:
* The start() method no longer takes a 'metadata' parameter.
* Metadata now comes in only via the metadata() method, which takes
a key and value. The only key defined so far is SRD_CONF_SAMPLERATE,
which is exported into the module namespace.
API changes:
* srd_session_send() now takes an end_samplenum parameter, and had its
options rearranged.
* srd_session_config_set() is now srd_session_metadata_set(). This keeps
"config" options for a future feature to allow PDs or frontends to
configure each other's options on the fly, up and down the stack.