libsigrokdecode.git
21 months agocfp: Drop unused self.out_python.
Uwe Hermann [Sun, 10 Jun 2018 14:09:40 +0000 (16:09 +0200)]
cfp: Drop unused self.out_python.

21 months agocfp: Fix incorrect copy-paste description.
Uwe Hermann [Sun, 10 Jun 2018 14:09:21 +0000 (16:09 +0200)]
cfp: Fix incorrect copy-paste description.

21 months agoRevert "mdio: Add 'TURNAROUND' long/full annotation." in order to comply with the...
Elias Oenal [Fri, 18 May 2018 14:49:17 +0000 (16:49 +0200)]
Revert "mdio: Add 'TURNAROUND' long/full annotation." in order to comply with the naming used in the Ethernet standard.

This reverts commit 30d775b095a4b76e5fa755b19d5521affa3c053c.

21 months agoAdd a CFP decoder.
Elias Oenal [Fri, 18 May 2018 14:48:50 +0000 (16:48 +0200)]
Add a CFP decoder.

22 months agocounter: Drop unneeded tuple braces.
Uwe Hermann [Wed, 30 May 2018 06:20:10 +0000 (08:20 +0200)]
counter: Drop unneeded tuple braces.

(minor readability / consistency improvement)

22 months agocounter: emit wider annotations for data and word counts
Gerhard Sittig [Sun, 27 May 2018 07:56:49 +0000 (09:56 +0200)]
counter: emit wider annotations for data and word counts

Track the start of a data or word cycle. Avoid narrow ss=es annotations
which may be tedious to inspect by users in GUI applications. This
resolves the issue initially reported in bug #1210.

22 months agocounter: prepare for variable width annotations
Gerhard Sittig [Sun, 27 May 2018 07:46:01 +0000 (09:46 +0200)]
counter: prepare for variable width annotations

Explicitly pass a start sample number to the .putc() method, to prepare
annotations where ss differs from es. This is motivated by bug #1210.
Stick with the narrow ss=es annotations for backwards compatibility.

22 months agocounter: explicit string formatting for annotation text
Gerhard Sittig [Sun, 27 May 2018 07:41:19 +0000 (09:41 +0200)]
counter: explicit string formatting for annotation text

Replace str() conversion with explicit number text formatting, for
improved awareness and easier future adjustment during maintenance.

22 months agocounter: use local variables instead of instance variables
Gerhard Sittig [Sun, 27 May 2018 07:35:25 +0000 (09:35 +0200)]
counter: use local variables instead of instance variables

Since values get accessed within the .decode() method exclusively, we need
not store data in instance variables of the decoder object. Use another
variable for the "reset edge" option as well for consistency.

22 months agocounter: move some init code to the start of decode()
Gerhard Sittig [Sun, 27 May 2018 07:27:08 +0000 (09:27 +0200)]
counter: move some init code to the start of decode()

Since PD API v3 the .decode() method is called exactly once, and
contains a main loop itself. Move initialization code that sets up
.decode() related logic to the start of the .decode() routine.

22 months agocounter: use symbolic names for input pins, wait conditions, annotation rows
Gerhard Sittig [Sun, 27 May 2018 07:18:09 +0000 (09:18 +0200)]
counter: use symbolic names for input pins, wait conditions, annotation rows

Replace magic numbers by symbolic references to (fixed and optional)
decoder input signals, .wait() conditions, as well as annotation rows.

Move some empty lines, to better reflect which code lines form groups of
similar activity ("blocks" that logically belong together).

22 months agocounter: explicit option text to .wait() edge mapping
Gerhard Sittig [Sun, 27 May 2018 07:06:48 +0000 (09:06 +0200)]
counter: explicit option text to .wait() edge mapping

The previous implementation used the fact that libsigrok's internal API
happens to use the first letter of the user visible English option text.
Two locations mapped edge choices to API literals in different ways.
Unify them, introduce an explicit option text to literal value mapping.

(Many if not all decoder implementations do that. More adjustment to use
common code could be beneficial.)

22 months agoatsha204a: Add the reset() method.
Uwe Hermann [Fri, 25 May 2018 23:51:06 +0000 (01:51 +0200)]
atsha204a: Add the reset() method.

22 months agoatsha204a: Rename a few methods for consistency.
Uwe Hermann [Fri, 25 May 2018 23:49:58 +0000 (01:49 +0200)]
atsha204a: Rename a few methods for consistency.

22 months agoatsha204a: Shorten a few more code chunks, add helpers.
Uwe Hermann [Fri, 25 May 2018 23:47:26 +0000 (01:47 +0200)]
atsha204a: Shorten a few more code chunks, add helpers.

22 months agoatsha204a: Shorten self.opcode to op in a few places.
Uwe Hermann [Fri, 25 May 2018 23:13:51 +0000 (01:13 +0200)]
atsha204a: Shorten self.opcode to op in a few places.

22 months agoatsha204a: Use the Python 'in' keyword to improve readability.
Uwe Hermann [Fri, 25 May 2018 22:32:14 +0000 (00:32 +0200)]
atsha204a: Use the Python 'in' keyword to improve readability.

22 months agoatsha204a: Shorten output_tx_bytes()/output_rx_bytes() a bit.
Uwe Hermann [Fri, 25 May 2018 22:26:20 +0000 (00:26 +0200)]
atsha204a: Shorten output_tx_bytes()/output_rx_bytes() a bit.

22 months agoAdd decoder for Microchip ATSHA204A crypto module
Michalis Pappas [Thu, 26 Apr 2018 16:35:40 +0000 (19:35 +0300)]
Add decoder for Microchip ATSHA204A crypto module

22 months agoAdd ON Semi CAT24C256, CAT24M01.
whitequark [Mon, 21 May 2018 15:55:19 +0000 (15:55 +0000)]
Add ON Semi CAT24C256, CAT24M01.

22 months agoDecoder_put(): Avoid a g_malloc()/g_free() pair per binary out.
Uwe Hermann [Sat, 19 May 2018 00:37:14 +0000 (02:37 +0200)]
Decoder_put(): Avoid a g_malloc()/g_free() pair per binary out.

22 months agoDecoder_put(): Avoid a g_malloc()/g_free() pair per annotation.
Uwe Hermann [Fri, 18 May 2018 22:19:54 +0000 (00:19 +0200)]
Decoder_put(): Avoid a g_malloc()/g_free() pair per annotation.

22 months agosrd_inst_find_by_obj(): Minor performance improvement.
Uwe Hermann [Fri, 18 May 2018 18:14:19 +0000 (20:14 +0200)]
srd_inst_find_by_obj(): Minor performance improvement.

Handle the most common case of one session and one decoder first so
we can exit early. This has a small, but measurable performance benefit.

22 months agosrd_*inst_find_by_obj(): Suggest inlining for performance reasons.
Uwe Hermann [Fri, 18 May 2018 18:11:38 +0000 (20:11 +0200)]
srd_*inst_find_by_obj(): Suggest inlining for performance reasons.

This has a small, but measurable performance benefit.

22 months agosrd_*inst_find_by_obj(): Move functions, make them static.
Uwe Hermann [Fri, 18 May 2018 17:50:16 +0000 (19:50 +0200)]
srd_*inst_find_by_obj(): Move functions, make them static.

These functions are only used in type_decoder.c. Move them there and
make them static.

22 months agosample_matches(): Force inlining for performance reasons.
Uwe Hermann [Fri, 18 May 2018 07:01:40 +0000 (09:01 +0200)]
sample_matches(): Force inlining for performance reasons.

22 months agoSimplify code by dropping session_is_valid().
Uwe Hermann [Thu, 17 May 2018 23:02:13 +0000 (01:02 +0200)]
Simplify code by dropping session_is_valid().

A simple NULL check is sufficient here, max_session_id is being
properly handled by srd_init(), srd_exit(), srd_session_new().

This might also have a small performance benefit.

22 months agoconvert_meta(): Use g_variant_type_equal().
Uwe Hermann [Thu, 17 May 2018 22:27:57 +0000 (00:27 +0200)]
convert_meta(): Use g_variant_type_equal().

22 months agoDoxyfile: Exclude the build/ directory.
Uwe Hermann [Thu, 17 May 2018 22:17:08 +0000 (00:17 +0200)]
Doxyfile: Exclude the build/ directory.

22 months agoAdd srd_searchpaths_get() API docs.
Uwe Hermann [Thu, 17 May 2018 22:13:42 +0000 (00:13 +0200)]
Add srd_searchpaths_get() API docs.

22 months agoDoxyfile: Update to a more recent Doxygen version.
Uwe Hermann [Thu, 17 May 2018 22:08:34 +0000 (00:08 +0200)]
Doxyfile: Update to a more recent Doxygen version.

22 months agoRandom whitespace/cosmetic/consistency fixes.
Uwe Hermann [Thu, 17 May 2018 22:01:05 +0000 (00:01 +0200)]
Random whitespace/cosmetic/consistency fixes.

22 months agotype_decoder.c: Fix a compiler warning (-Wswitch-default).
Uwe Hermann [Thu, 17 May 2018 21:25:42 +0000 (23:25 +0200)]
type_decoder.c: Fix a compiler warning (-Wswitch-default).

  type_decoder.c: In function ‘get_term_type’:
  type_decoder.c:486:2: warning: switch missing default case [-Wswitch-default]
    switch (v[0]) {
    ^~~~~~

22 months agoconfigure.ac: Add some more compiler warning options.
Uwe Hermann [Thu, 17 May 2018 20:50:45 +0000 (22:50 +0200)]
configure.ac: Add some more compiler warning options.

Add the -Wshadow -Wformat=2 -Wno-format-nonliteral -Wfloat-equal
compiler options (supported by both gcc and clang) to get notified
of more potential issues in the code.

22 months agosrd_decoder_load_all_zip_path(): Fix a compiler warning (-Wshadow).
Uwe Hermann [Wed, 16 May 2018 20:17:07 +0000 (22:17 +0200)]
srd_decoder_load_all_zip_path(): Fix a compiler warning (-Wshadow).

22 months agosrd_inst_channel_set_all(): Fix a compiler warning (-Wshadow).
Uwe Hermann [Wed, 16 May 2018 20:14:22 +0000 (22:14 +0200)]
srd_inst_channel_set_all(): Fix a compiler warning (-Wshadow).

  instance.c:266:11: warning: declaration of ‘l’ shadows a previous local [-Wshadow]
     GSList *l = g_slist_nth(di->decoder->channels, i);
             ^
  instance.c:206:9: note: shadowed declaration is here
    GList *l;
           ^

22 months agotype_decoder.c: Drop unneeded g_free() NULL check.
Uwe Hermann [Tue, 15 May 2018 22:28:56 +0000 (00:28 +0200)]
type_decoder.c: Drop unneeded g_free() NULL check.

22 months agoinstance.c: Fix a scan-build warning.
Uwe Hermann [Tue, 15 May 2018 22:24:56 +0000 (00:24 +0200)]
instance.c: Fix a scan-build warning.

  instance.c:278:25: warning: The left operand of '!=' is a garbage value
                  if (new_channelmap[i] != -1)
                      ~~~~~~~~~~~~~~~~~ ^

22 months agodecoder.c: Fix a scan-build warning.
Uwe Hermann [Tue, 15 May 2018 22:21:56 +0000 (00:21 +0200)]
decoder.c: Fix a scan-build warning.

  decoder.c:343:9: warning: Access to field 'ob_type' results in a dereference of a null pointer (loaded from variable 'py_default')
                                  if (Py_TYPE(py_default) != Py_TYPE(py_item)) {
                                      ^~~~~~~~~~~~~~~~~~~
  /usr/include/python3.6m/object.h:118:33: note: expanded from macro 'Py_TYPE'
  #define Py_TYPE(ob)             (((PyObject*)(ob))->ob_type)
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

22 months agotype_decoder.c: Fix a scan-build warning.
Uwe Hermann [Tue, 15 May 2018 22:09:53 +0000 (00:09 +0200)]
type_decoder.c: Fix a scan-build warning.

  type_decoder.c:836:3: warning: Value stored to 'ret' is never read
                ret = process_samples_until_condition_match(di, &found_match);
                ^     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

22 months agoinstance.c: Fix a memory leak reported by scan-build.
Uwe Hermann [Tue, 15 May 2018 22:13:07 +0000 (00:13 +0200)]
instance.c: Fix a memory leak reported by scan-build.

  instance.c:280:10: warning: Potential leak of memory pointed to by 'new_channelmap'
                  pdch = g_slist_nth(di->decoder->channels, i)->data;
                         ^~~~~~~~~~~

22 months agotype_decoder.c: Fix a memory leak reported by scan-build.
Uwe Hermann [Tue, 15 May 2018 23:27:30 +0000 (01:27 +0200)]
type_decoder.c: Fix a memory leak reported by scan-build.

  type_decoder.c:206:2: warning: Potential leak of memory pointed to by 'pdb'
          PyGILState_Release(gstate);
          ^~~~~~~~~~~~~~~~~~

22 months agotype_decoder.c: Fix a memory leak reported by scan-build.
Uwe Hermann [Tue, 15 May 2018 22:05:42 +0000 (00:05 +0200)]
type_decoder.c: Fix a memory leak reported by scan-build.

  type_decoder.c:197:10: warning: Potential leak of memory pointed to by 'pdb'
                 return SRD_ERR_MALLOC;
                        ^~~~~~~~~~~~~~

22 months agoConvert some g_malloc0() to g_malloc().
Uwe Hermann [Tue, 15 May 2018 21:57:31 +0000 (23:57 +0200)]
Convert some g_malloc0() to g_malloc().

For the converted calls there's no requirement for all struct fields
being memset()'d to zero, or all struct fields are explicitly set
later anyway.

22 months agoget_current_pinvalues(): Slightly simplify a code chunk.
Uwe Hermann [Tue, 15 May 2018 20:29:49 +0000 (22:29 +0200)]
get_current_pinvalues(): Slightly simplify a code chunk.

22 months agoutil.c: Add two missing PyGILState_Release() calls.
Uwe Hermann [Tue, 15 May 2018 20:29:24 +0000 (22:29 +0200)]
util.c: Add two missing PyGILState_Release() calls.

22 months agost7735: Merge reset_state() into reset().
Uwe Hermann [Sun, 13 May 2018 16:28:05 +0000 (18:28 +0200)]
st7735: Merge reset_state() into reset().

22 months agoSimple decoder for ST7735 TFT controller
Aleksander Alekseev [Sat, 5 May 2018 20:44:16 +0000 (23:44 +0300)]
Simple decoder for ST7735 TFT controller

22 months agomcs48: add reset method, make A12 optional, unassorted adjustment
Gerhard Sittig [Sat, 12 May 2018 20:21:39 +0000 (22:21 +0200)]
mcs48: add reset method, make A12 optional, unassorted adjustment

Add the reset() method which recently has become essential. Make the A12
"memory bank" address line optional. Use more Python idioms. Update
comments.

The control signals had to move, to avoid gaps between D7 and A8 as well
as between A11 and A12 in the GUI decoder properties dialog. With
dynamic assignment in the UI and with named references in the CLI this
shall not harm. Unmodified automated tests still pass.

The logic is prepared to handle data, address, and "bank" pin groups at
arbitrary locations, A[11:8] and D[7:0] need not be adjacent any longer.
Support for more than one memory bank pin is prepared, but the number of
bank pins needs to get determined at the start of decode(), when this
feature is to get added in the future.

22 months agoAdd new decoder: Intel MCS-48
fenugrec [Thu, 26 Apr 2018 22:35:39 +0000 (18:35 -0400)]
Add new decoder: Intel MCS-48

Decodes addresses and data read from an external ROM. The MCS-48
processors (8048, 8049, 8039, etc.) have an 8-bit data bus that latches
first the address then the data.

23 months agotype_decoder.c: Drop incorrect Py_DECREF() calls.
Uwe Hermann [Wed, 9 May 2018 00:38:51 +0000 (02:38 +0200)]
type_decoder.c: Drop incorrect Py_DECREF() calls.

23 months agotype_decoder: Fixup memory leak in Decoder.put() (meta, python)
Uwe Hermann [Tue, 8 May 2018 23:31:10 +0000 (01:31 +0200)]
type_decoder: Fixup memory leak in Decoder.put() (meta, python)

This fixes parts of bug #329.

23 months agotype_decoder: fixup memory leak in Decoder.put() (annotation, binary)
Gerhard Sittig [Tue, 8 May 2018 18:44:05 +0000 (20:44 +0200)]
type_decoder: fixup memory leak in Decoder.put() (annotation, binary)

The text presentation of decoder annotations' payload data was allocated
but not freed. As were the byte strings of binary output. Fix it.

This fixes parts of bug #329.

23 months agoDoxyfile: Set CREATE_SUBDIRS to NO.
Uwe Hermann [Sun, 6 May 2018 14:36:34 +0000 (16:36 +0200)]
Doxyfile: Set CREATE_SUBDIRS to NO.

The API docs for libsigrokdecode are relatively small, no need for
the many, many subdirectories this would otherwise create.

23 months agojtag_stm32: Always switch state on new instruction
George Hopkins [Thu, 30 Nov 2017 14:58:05 +0000 (15:58 +0100)]
jtag_stm32: Always switch state on new instruction

23 months agojtag_stm32: Fix handling of boundary scan TAP
George Hopkins [Thu, 30 Nov 2017 14:56:45 +0000 (15:56 +0100)]
jtag_stm32: Fix handling of boundary scan TAP

23 months agojtag: Fix shifting of registers
George Hopkins [Thu, 30 Nov 2017 14:41:02 +0000 (15:41 +0100)]
jtag: Fix shifting of registers

This fixes bug #1066.

23 months agospiflash: Add Adesto AT45DB161E metadata.
Uwe Hermann [Thu, 3 May 2018 13:15:34 +0000 (15:15 +0200)]
spiflash: Add Adesto AT45DB161E metadata.

23 months agospiflash: Add basic Adesto AT45DBxx support (WRITE1/2, STATUS).
Aleksander Alekseev [Thu, 3 May 2018 12:04:47 +0000 (14:04 +0200)]
spiflash: Add basic Adesto AT45DBxx support (WRITE1/2, STATUS).

23 months agodcf77: annotate unexpected bit numbers and values, do not abort execution
Gerhard Sittig [Mon, 16 Apr 2018 19:15:13 +0000 (21:15 +0200)]
dcf77: annotate unexpected bit numbers and values, do not abort execution

Improve robustness of the DCF77 decoder. Cope with "neiter 0 nor 1" bit
values (glitches can break the detection of pulse widths), as well as
unexpected bit numbers (more than 59 pulses per minute, can be a
follow-up error after e.g. glitches break one long pulse into two short
pulses). Do not process this invalid data, do emit error annotations.

23 months agodcf77: annotate invalid dow and month fields, do not abort execution
Gerhard Sittig [Sun, 22 Apr 2018 08:07:07 +0000 (10:07 +0200)]
dcf77: annotate invalid dow and month fields, do not abort execution

Emit error annotations for invalid day of the week or month numbers,
instead of aborting decoder execution with an exception.

Implementation detail: Neither the Python 'in' keyword nor a .get()
method are available. That's why we have to catch the IndexError
exception.

This fixes bug #1173.

23 months agodcf77, lpc: rephrase bit string formatting
Gerhard Sittig [Mon, 16 Apr 2018 19:12:16 +0000 (21:12 +0200)]
dcf77, lpc: rephrase bit string formatting

Create the text representation of a bit string by means of the builtin
.format() method and an appropriate specifier. Drop the non-obvious
sequence of bin() and slice and zfill() calls.

23 months agoinstance: return SRD_ERR_TERM_REQ when execution shall terminate
Gerhard Sittig [Mon, 23 Apr 2018 18:42:54 +0000 (20:42 +0200)]
instance: return SRD_ERR_TERM_REQ when execution shall terminate

The previous implementation internally noticed the "want terminate"
request, and skipped decoder execution to faster get to the end of the
input stream. But an OK return code was provided in that code path, and
more input data was sent by applications (sometimes for many seconds or
few minutes).

Do return a new SRD_ERR_TERM_REQ error code, such that applications can
tell failed execution from requested termination.

23 months agoinstance: drop an unneeded "want wait() to terminate" reset assignment
Gerhard Sittig [Mon, 23 Apr 2018 18:40:28 +0000 (20:40 +0200)]
instance: drop an unneeded "want wait() to terminate" reset assignment

It's uncertain why srd_inst_decode() which internally gets called by the
public srd_session_send() routine used to clear the want_wait_terminate
flag. This should be cleared upon decoder instance creation and state
reset, gets raised upon termination request, but shall not get cleared
in other spots, especially not upon the availability of new input data
while the stream shall be considered in the "about to terminate, skip
all subsequent execution" state.

23 months agolog: Move log level check so that it affects all handlers.
Uwe Hermann [Sat, 21 Apr 2018 22:17:49 +0000 (00:17 +0200)]
log: Move log level check so that it affects all handlers.

Before this change, the loglevel check would only be performed for the
default log handler in libsigrokdecode, but not for other handlers set
via srd_log_callback_set().

This fixes bug #698.

23 months agosrd_exception_catch(): Beautify traceback logging output.
Uwe Hermann [Fri, 20 Apr 2018 21:30:58 +0000 (23:30 +0200)]
srd_exception_catch(): Beautify traceback logging output.

23 months agoDecoder_register(): Drop an overly verbose log message.
Uwe Hermann [Fri, 20 Apr 2018 19:46:59 +0000 (21:46 +0200)]
Decoder_register(): Drop an overly verbose log message.

23 months agosrd_logv(): Add an explicit fflush().
Uwe Hermann [Fri, 20 Apr 2018 19:45:04 +0000 (21:45 +0200)]
srd_logv(): Add an explicit fflush().

23 months agoShow backtrace when decode() aborts due to an error.
Uwe Hermann [Fri, 20 Apr 2018 19:40:12 +0000 (21:40 +0200)]
Show backtrace when decode() aborts due to an error.

The backtrace printing was actually already there, but was emitted using
sr_dbg(), which doesn't show up by default for most users. Make it an
srd_err() so that most users will see it.

This fixes bug #1158.

23 months agocan: Fix incorrect stuff bit handling.
Uwe Hermann [Thu, 12 Apr 2018 07:02:38 +0000 (09:02 +0200)]
can: Fix incorrect stuff bit handling.

The decoder assumed a CRC cannot end with a stuffed bit but it actually can,
and the CRC delimiter then comes after the stuffed bit.

Patch by IRC/github user celeron55, wide testing by PeterMortensen, thanks!

2 years agoDrop overly verbose log messages about (un)loading PDs.
Uwe Hermann [Sun, 8 Apr 2018 17:53:56 +0000 (19:53 +0200)]
Drop overly verbose log messages about (un)loading PDs.

2 years agosda2506/qi: Add missing full stop in 'desc' field.
Uwe Hermann [Sun, 8 Apr 2018 17:29:14 +0000 (19:29 +0200)]
sda2506/qi: Add missing full stop in 'desc' field.

2 years agorc_encode: Use different annotation classes for code word addr/data.
Uwe Hermann [Sun, 8 Apr 2018 17:08:39 +0000 (19:08 +0200)]
rc_encode: Use different annotation classes for code word addr/data.

2 years agorc_encode: Use different annotation classes for different bits.
Uwe Hermann [Sun, 8 Apr 2018 17:02:35 +0000 (19:02 +0200)]
rc_encode: Use different annotation classes for different bits.

2 years agorc_encode: Add self.putx() helper.
Uwe Hermann [Sun, 8 Apr 2018 16:55:08 +0000 (18:55 +0200)]
rc_encode: Add self.putx() helper.

2 years agorc_encode: Use common self.ss/self.es naming.
Uwe Hermann [Sun, 8 Apr 2018 16:47:10 +0000 (18:47 +0200)]
rc_encode: Use common self.ss/self.es naming.

2 years agorc_encode: Use += operator where possible.
Uwe Hermann [Sun, 8 Apr 2018 16:44:09 +0000 (18:44 +0200)]
rc_encode: Use += operator where possible.

2 years agorc_encode: Drop unneeded casts.
Uwe Hermann [Sun, 8 Apr 2018 16:41:59 +0000 (18:41 +0200)]
rc_encode: Drop unneeded casts.

2 years agoAdd initial rc_encode protocol decoder.
steversig [Mon, 2 Apr 2018 17:12:16 +0000 (18:12 +0100)]
Add initial rc_encode protocol decoder.

2 years agotest: add simple "no data" test case for decoder "terminate and reset"
Gerhard Sittig [Sun, 17 Dec 2017 21:24:10 +0000 (22:24 +0100)]
test: add simple "no data" test case for decoder "terminate and reset"

Introduce a "reset" group of tests. Whip up a first test step which runs
the "terminate and reset" routine for decoder stacks after session
creation, start, and meta data setup. No input data gets processed, no
decoder output is tested yet.

2 years agosession: add "terminate and reset" support for protocol stacks
Gerhard Sittig [Sun, 17 Dec 2017 17:55:46 +0000 (18:55 +0100)]
session: add "terminate and reset" support for protocol stacks

Implement routines which terminate currently pending decoder operations
and reset internal state (on the C and Python sides) for instances as
well as sessions. This allows to re-use previously created stacks for
new input data.

2 years agoDecoder: check for duplicate register() calls in common backend code
Gerhard Sittig [Fri, 26 Jan 2018 20:02:25 +0000 (21:02 +0100)]
Decoder: check for duplicate register() calls in common backend code

Future implementations might call decoders' start() routine several
times, which makes them call register() again. It's desirable that the
common backend code copes with this condition, such that (the multitude
of) decoder implementations need not work around a specific constraint.

2 years agodecoder: rephrase .has_channel() argument parse logic
Gerhard Sittig [Sun, 17 Dec 2017 17:50:25 +0000 (18:50 +0100)]
decoder: rephrase .has_channel() argument parse logic

Have the Python C API check the argument type and do the type conversion
already. Raise an IndexError exception when the range check fails.

2 years agoinstance: make sure oldpins array is available after reset
Gerhard Sittig [Sun, 4 Feb 2018 18:12:48 +0000 (19:12 +0100)]
instance: make sure oldpins array is available after reset

Introduce an oldpins_array_seed() helper routine, to make sure that each
call site which checks previous pin state will find valid data. This was
not always the case after decoder reset, which released the old pin data
while applications would not call srd_inst_new() again.

Preset newly allocated arrays with the default initial pin state, allow
optional application calls to specify differing initial values (when
specified by users), and keep the current state after first data was
processed.

2 years agoadns5020: Python style nit, fixup whitespace
Gerhard Sittig [Sat, 13 Jan 2018 18:51:07 +0000 (19:51 +0100)]
adns5020: Python style nit, fixup whitespace

2 years agomax7219: introduce constructor and reset() method
Gerhard Sittig [Sun, 28 Jan 2018 21:59:59 +0000 (22:59 +0100)]
max7219: introduce constructor and reset() method

The "max7219" decoder used to have no constructor, which made me miss
it when reset() got introduced. Implement those two methods (which do
nothing, and thus won't change behaviour).

2 years agomicrowire: introduce constructor and reset() method
Gerhard Sittig [Sat, 13 Jan 2018 18:30:53 +0000 (19:30 +0100)]
microwire: introduce constructor and reset() method

The "microwire" decoder used to have no constructor, which made me miss
it when reset() got introduced. Implement those two methods (which do
nothing, and thus won't change behaviour).

2 years agoprint_searchpaths(): Print decoder and system search paths.
Uwe Hermann [Sun, 18 Mar 2018 16:54:11 +0000 (17:54 +0100)]
print_searchpaths(): Print decoder and system search paths.

2 years agoFix part of #1128 by adding a way to retrieve PD search paths
Soeren Apel [Sat, 17 Mar 2018 20:40:36 +0000 (21:40 +0100)]
Fix part of #1128 by adding a way to retrieve PD search paths

As this uses g_slist_copy_deep(), we now require glib 2.34.

2 years agoAdd support for SDA2506 EEPROM serial protocol.
Max Weller [Tue, 30 Jan 2018 22:22:06 +0000 (23:22 +0100)]
Add support for SDA2506 EEPROM serial protocol.

2 years agoMinor whitespace/typo fixes.
Uwe Hermann [Tue, 6 Mar 2018 22:55:34 +0000 (23:55 +0100)]
Minor whitespace/typo fixes.

2 years agodali: Avoid CamelCase in most places.
Uwe Hermann [Fri, 23 Feb 2018 15:57:22 +0000 (16:57 +0100)]
dali: Avoid CamelCase in most places.

2 years agoir_nec: optionally accept input signals that include the carrier
Gerhard Sittig [Sat, 2 Sep 2017 10:52:32 +0000 (12:52 +0200)]
ir_nec: optionally accept input signals that include the carrier

Introduce optional detection of a carrier signal. Immediately "go active"
when edges are seen. "Go inactive" again in the absence of edges in a
specified period of time. Cope with input signals that already had the
carrier removed.

By default carrier detection is disabled, to remain pixel compatible to
the previous implementation. When a carrier frequency is specified and
thus detection is enabled, edges of already filtered input are shifted
by one carrier period, and thus changes the output of the decoder. For
unfiltered inputs that still contain the carrier, detection of activity
is reliable and immediate, but the active phase is extended by one
period of the carrier frequency (which is considered acceptable).

2 years agoparallel: expand 'wordsize' description (bits vs cycles)
Gerhard Sittig [Thu, 28 Dec 2017 17:08:51 +0000 (18:08 +0100)]
parallel: expand 'wordsize' description (bits vs cycles)

Users may not know which unit the "wordsize" is supposed to get
specified in. Especially when it's not a number of bits, but instead
the number of bus cycles. Expand the description text accordingly.

2 years agostepper_motor: make samplerate meta data optional
Gerhard Sittig [Sun, 17 Dec 2017 22:59:16 +0000 (23:59 +0100)]
stepper_motor: make samplerate meta data optional

Only emit the speed annotations when a sample rate was specified. Cope
with the absence of a sample rate for the input stream. Decoding is
still possible, it's just that no timing information is available.

2 years agoi2s: make samplerate meta data optional
Gerhard Sittig [Sun, 17 Dec 2017 23:05:40 +0000 (00:05 +0100)]
i2s: make samplerate meta data optional

Only emit sound samplerate information when an input stream sample rate
was specified. Cope with the absence of a sample rate for the input
stream. Decoding is still possible, it's just that no timing information
is available.

2 years agoi2c: make input samplerate optional
Gerhard Sittig [Fri, 15 Dec 2017 18:26:29 +0000 (19:26 +0100)]
i2c: make input samplerate optional

Absence of a samplerate for the input stream should not be fatal. The
protocol decodes fine, we just cannot determine a bitrate for frames.

This addresses part of bug 1076.

2 years agoconfigure.ac: explicitly require pkg-config related macro
Gerhard Sittig [Sat, 10 Feb 2018 11:24:17 +0000 (12:24 +0100)]
configure.ac: explicitly require pkg-config related macro

Make sure the PKG_PROG_PKG_CONFIG macro has become available before it
gets used. This unbreaks configuration in the poky environment (rocko).

2 years agograycode, morse, pwm, usb_request, wiegand: cope with absent sample rate
Gerhard Sittig [Sun, 28 Jan 2018 19:49:48 +0000 (20:49 +0100)]
graycode, morse, pwm, usb_request, wiegand: cope with absent sample rate

Improve robustness of some more protocol decoders. Few of them never
checked for the availability of a sample rate in the first place, others
checked for the presence of a spec but would not cope with a value of 0.
Some checked the value only after processing it, which could result in
runtime errors.

This change is motivated by bug #1118.

2 years agospi: cope when a sample rate of 0 was configured
Gerhard Sittig [Sun, 28 Jan 2018 19:02:09 +0000 (20:02 +0100)]
spi: cope when a sample rate of 0 was configured

The explicit test for None was not good enough. Change test conditions
such that sample rates only get processed when they got specified _and_
were not zero.

This fixes bug #1118.