From c449c5832bb560ca543b9d6c962c405d1a227312 Mon Sep 17 00:00:00 2001
From: Gerhard Sittig <gerhard.sittig@gmx.net>
Date: Mon, 20 Jul 2020 22:21:30 +0200
Subject: ir_sirc: fixup decoder boilerplate

The SIRC decoder was written to an older API, and failed to load in a
recent environment (tag missing, ambiguous annotation names). Unbreak
the decoder's boilerplate, and address other nits while we are here:
There is no Python output. Use the same declaration syntax as in other
decoders for improved maintenance (greppability). Call reset() from
__init__() to avoid surprises when a future version does have vars. Do
provide a doc string in the module initialization, to keep the URL for
the protocol description at hand.
---
 decoders/ir_sirc/__init__.py |  6 ++++++
 decoders/ir_sirc/pd.py       | 22 ++++++++++------------
 2 files changed, 16 insertions(+), 12 deletions(-)

(limited to 'decoders/ir_sirc')

diff --git a/decoders/ir_sirc/__init__.py b/decoders/ir_sirc/__init__.py
index 7e1342c..4061ed7 100644
--- a/decoders/ir_sirc/__init__.py
+++ b/decoders/ir_sirc/__init__.py
@@ -17,4 +17,10 @@
 ## along with this program; if not, see <http://www.gnu.org/licenses/>.
 ##
 
+'''
+Decoder for the Sony IR remote control protocol (SIRC).
+
+https://www.sbprojects.net/knowledge/ir/sirc.php
+'''
+
 from .pd import Decoder
diff --git a/decoders/ir_sirc/pd.py b/decoders/ir_sirc/pd.py
index 9aba8a5..b713c56 100644
--- a/decoders/ir_sirc/pd.py
+++ b/decoders/ir_sirc/pd.py
@@ -33,41 +33,39 @@ class Decoder(srd.Decoder):
     api_version = 3
     id = 'ir_sirc'
     name = 'IR SIRC'
-    longname = 'IR SIRC'
-    desc = 'Sony SIRC infrared remote control protocol.'
+    longname = 'Sony IR (SIRC)'
+    desc = 'Sony infrared remote control protocol (SIRC).'
     license = 'gplv2+'
+    tags = ['IR']
     inputs = ['logic']
-    outputs = ['ir_sirc']
+    outputs = []
     channels = (
-        dict(id='ir', name='IR', desc='Data line'),
+        {'id': 'ir', 'name': 'IR', 'desc': 'IR data line'},
     )
     options = (
-        dict(id='polarity', desc='Polarity', default='active-low',
-            values=('active-low', 'active-high')),
+        {'id': 'polarity', 'desc': 'Polarity', 'default': 'active-low',
+            'values': ('active-low', 'active-high')},
     )
     annotations = (
         ('bit', 'Bit'),
         ('agc', 'AGC'),
         ('pause', 'Pause'),
-
         ('start', 'Start'),
         ('command', 'Command'),
         ('address', 'Address'),
         ('extended', 'Extended'),
-
         ('remote', 'Remote'),
-
-        ('warnings', 'Warnings'),
+        ('warning', 'Warning'),
     )
     annotation_rows = (
         ('bits', 'Bits', (0, 1, 2)),
         ('fields', 'Fields', (3, 4, 5, 6)),
-        ('remote', 'Remote', (7,)),
+        ('remotes', 'Remotes', (7,)),
         ('warnings', 'Warnings', (8,)),
     )
 
     def __init__(self):
-        pass
+        self.reset()
 
     def reset(self):
         pass
-- 
cgit v1.2.3-70-g09d2