Uwe Hermann [Wed, 7 Dec 2011 01:03:25 +0000 (02:03 +0100)]
srd: Add initial UART decoder.
Works with any baudrate, number of bits, parity types, number of stop
bits and so on, in theory. Not all options are fully implemented or
tested though. Various TODOs remain.
Gareth McMullin [Mon, 5 Dec 2011 07:31:32 +0000 (20:31 +1300)]
srd: Initialise struct members by name. Minor other fixes.
Restored some prototypes in sigrokdecode.h.
Abort sigrok-cli on error while decoding (includes KeyboardInterrupt).
Fixed passing metadata to Decoder.start() method.
Bert Vermeulen [Sun, 4 Dec 2011 09:33:02 +0000 (10:33 +0100)]
refactored PD framework, now using new sigrok.Decoder object
This uses the new python unified type/class object API to construct
an object for PDs to subclass. The sigrok.Decoder class has a method
put() which is implemented as a C function, and receives the PD's
object instance as its first parameter.
Uwe Hermann [Mon, 28 Nov 2011 20:46:55 +0000 (21:46 +0100)]
srd: nunchuk.py: Convert to new decoder API.
This is not really finished, or tested, or working. It's also a decoder
which stacks on top of the I2C decoder, and the infrastructure for
stacking decoders is not yet usable.
Uwe Hermann [Sun, 27 Nov 2011 21:27:36 +0000 (22:27 +0100)]
decoders: Drop psyco stuff, seems obsolete.
The psyco module seems to be mostly unmaintained at this point, it does
not support Python 2.7 or higher at all, it only supports x86, it doesn't
support 64 bit systems at all, etc. etc.
We should try to find other ways to optimize our decoders for speed.
Gareth McMullin [Sun, 27 Nov 2011 06:17:13 +0000 (19:17 +1300)]
srd: Pass metadata to decoders only on SR_DF_HEADER.
Before this was passed to the decoder's constuctor, but the parameters
may not all be known at construction. Decoders now have a method start()
which is called at the start of the capture, and metadata is passed as
an arg to this function.
The .py decoder files are not technically scripts and should not be
executable and can not be invoked on the command line
(via ./foo.py --help or similar).
Uwe Hermann [Wed, 2 Feb 2011 09:25:52 +0000 (10:25 +0100)]
Fix build when no libusb-LA is compiled.
Until now the build would break if the user doesn't enable at least one
of the libusb1.0-based LAs. I.e., you could not compile only OLS, or
only the demo driver.
Uwe Hermann [Thu, 27 Jan 2011 23:11:00 +0000 (00:11 +0100)]
libsigrokdecode: Always load all decoders upon init.
Let sigrokdecode_init() always load all decoders it can find in the
decoders directory, i.e., the user doesn't need to manually load decoders.
Instead he can just look up the list via sigrokdecode_list_decoders()
after sigrokdecode_init() has run.
This is not a problem, as sigrokdecode_init() is only run once per
sigrok-cli or sigrok-gui invocation, and even with many decoders this
should not take too long.
The list of decoders within libsigrokdecode is no longer a string, but
rather a list of 'struct sigrokdecode_decoder *' pointers.
Add sigrokdecode_get_decoder_by_id() API function which returns the
decoder with the specified ID (file name without ".py" suffix, for now),
or NULL if it cannot be found.
sigrokdecode_load_decoder() is now a private function and not exported
via the lib, i.e. not available to users of libsigrokdecode.
Uwe Hermann [Thu, 27 Jan 2011 21:53:29 +0000 (22:53 +0100)]
Use Py_XINCREF/Py_XDECREF, not Py_INCREF/Py_DECREF.
They're defined like this in Python.h:
/* Macros to use in case the object pointer may be NULL: */
#define Py_XINCREF(op) if ((op) == NULL) ; else Py_INCREF(op)
#define Py_XDECREF(op) if ((op) == NULL) ; else Py_DECREF(op)
I.e., the performance penalty we take by using Py_XINCREF/Py_XDECREF is
pretty much non-existant.
Uwe Hermann [Sat, 15 Jan 2011 02:30:26 +0000 (03:30 +0100)]
Only load decoders from $(datadir)/sigrok/decoders.
Drop convenience locations which were supposed to allow running
./cli/sigrok-cli in the build directory. That will not really work fine
due to some other reasons. We only support running sigrok-cli after an
installation (into /usr/local or /opt or $HOME/sigrokinst or whatever).
Uwe Hermann [Sat, 15 Jan 2011 01:32:03 +0000 (02:32 +0100)]
Install decoders into a decoders/ subdir.
Use $(datadir)/sigrok/decoders as subdirectory for the protocol decoders
(instead of installing them in the top-level $(datadir)/sigrok), just
as we do for $(datadir)/sigrok/firmware.
Uwe Hermann [Sat, 15 Jan 2011 00:44:41 +0000 (01:44 +0100)]
CLI: Support for running protocol decoders.
Add a new -A | --list-protocol-decoders option to show the list of
protocol decoders we could find.
Add -a | --protocol-decoders to specify a list of decoders that shall
be applied to the datastream. Currently only works for one decoder.
Define DECODERS_DIR, which is the directory where the decoders will be
installed upon 'make install', and where libsigrokdecode_init() will
search for them.
Thanks Olivier Fauchon <redacted> for the initial patch,
merged in slightly different form.
Uwe Hermann [Sat, 8 Jan 2011 16:00:18 +0000 (17:00 +0100)]
Fix compile for Python >= 3.0.
Python docs tells us more about string functions:
"These functions have been renamed to PyBytes_* in Python 3.x. Unless
otherwise noted, the PyBytes functions available in 3.x are aliased to
their PyString_* equivalents to help porting."
(http://docs.python.org/c-api/string.html)
Use #defines to map the new names and fix the compile for Python >= 3.0.
Uwe Hermann [Fri, 23 Apr 2010 23:04:20 +0000 (01:04 +0200)]
Various Python decoder infrastructure improvements.
- Introduce 'struct sigrokdecode_decoder'.
- Decoders are now handled via two C functions:
- sigrokdecode_load_decoder(): Fills a 'struct sigrokdecode_decoder'.
- sigrokdecode_run_decoder(): Runs a decoder function.
- There are now two decoder API functions a script needs to implement:
- register(): Returns a Python dict with certain metadata.
- decode(): Runs the actual decoder code.
- libsigrokdecode: Add and use some more #defines for errors:
- SIGROKDECODE_ERR_ARGS
- SIGROKDECODE_ERR_PYTHON
- Various other smaller Python decode script infrastructure issues.