]> sigrok.org Git - libsigrokdecode.git/commit - decoders/ir_nec/pd.py
ir_nec: rephrase button lookup and addr/cmd validity checks
authorGerhard Sittig <redacted>
Sat, 25 Jul 2020 15:53:27 +0000 (17:53 +0200)
committerGerhard Sittig <redacted>
Sat, 25 Jul 2020 21:16:01 +0000 (23:16 +0200)
commitd478372a132d1872426f96f5f0d06119392805f7
tree1aa96d5f40a37dcbd4a5f9fea283b34f2aa4491b
parentb3f83fda31bfeef63b0ed5610c7b2986ad80dcc5
ir_nec: rephrase button lookup and addr/cmd validity checks

Eliminate redundancy in the check for database entries of button events.

Tighten the check for valid address and command bit patterns. The former
implementation did something unexpected, wanted the AND of the first and
second 8bit patterns to become zero. But the second 8bit item has not yet
become available when the test runs after the reception of the first 8bit
item. So the test happened to "pass" unexpectedly in intermediate steps,
and failed to catch invalid input data when all fields became available.

Unfortunately the check for valid data and the emission of annotations
was combined in the implementation. So it's essential to keep running
the "check" routine to get the annotations, and update internal ss/es
state. But only emit warnings when the check fails after all involved
data became available. Check for strict XOR as per the protocol spec.
decoders/ir_nec/pd.py