Thanks everyone, I obviously missed that option completely.

I think it just never occurred to me to look into the drop-down menus much.
In Wireshark, exporting packets is a separate option,
perhaps I was subconsciously looking for something too similar :)

Save as → Save Selected Range As indeed works well for me,
so I have re-done the captures and updated my article:

https://michael.stapelberg.ch/posts/2020-09-28-nuki-scs-bticino-decoding/

https://michael.stapelberg.ch/2020-09-27-rohdaten-klingel-rev2.zip

I also fixed an off-by-one bug in my stacked SCS decoder (attached).

On Thu, Oct 1, 2020 at 4:55 PM Gerhard Sittig <gerhard.sit...@gmx.net>
wrote:

> On Thu, 2020-10-01 at 16:27 +0200, Stefan Brüns wrote:
> >
> > On Donnerstag, 1. Oktober 2020 15:22:13 CEST Michael Stapelberg wrote:
> > > Exactly!
> > >
> > > Wireshark has an option to save filtered or explicitly marked packages
> into
> > > a new file.
> > >
> > > If sigrok could add an option to save only samples in between the
> currently
> > > displayed marker, that would already go a long way.
> >
> > Pulseview has that option for well over a year.
>
> Release doc says 2016-01, version control says 2015-12. Yep,
> has been around for more than a year.
>
>
> virtually yours
> Gerhard Sittig
> --
>      If you don't understand or are scared by any of the above
>              ask your parents or an adult to help you.
>
>
> _______________________________________________
> sigrok-devel mailing list
> sigrok-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sigrok-devel
>
From 85ca063970ba256ce8f9c77f625826dc9f251487 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <stapelb...@google.com>
Date: Mon, 28 Sep 2020 08:25:52 +0200
Subject: [PATCH] add decoder for the SCS bus (Sistema Cablaggio Semplificato)

---
 decoders/scs/__init__.py | 26 ++++++++++++++
 decoders/scs/pd.py       | 77 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 103 insertions(+)
 create mode 100644 decoders/scs/__init__.py
 create mode 100644 decoders/scs/pd.py

diff --git a/decoders/scs/__init__.py b/decoders/scs/__init__.py
new file mode 100644
index 0000000..bba605b
--- /dev/null
+++ b/decoders/scs/__init__.py
@@ -0,0 +1,26 @@
+##
+## This file is part of the libsigrokdecode project.
+##
+## Copyright (C) 2020 Michael Stapelberg
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+
+'''
+Decoder for the SCS bus (Sistema Cablaggio Semplificato, i.e. Simplified Cable
+Solution), a fieldbus network protocol for home automation, used by bTicino and
+Legrand.
+'''
+
+from .pd import Decoder
diff --git a/decoders/scs/pd.py b/decoders/scs/pd.py
new file mode 100644
index 0000000..2ce9c92
--- /dev/null
+++ b/decoders/scs/pd.py
@@ -0,0 +1,77 @@
+##
+## This file is part of the libsigrokdecode project.
+##
+## Copyright (C) 2020 Michael Stapelberg
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, see <http://www.gnu.org/licenses/>.
+##
+
+import sigrokdecode as srd
+
+class Decoder(srd.Decoder):
+    api_version = 3
+    id = 'scs'
+    name = 'SCS'
+    longname = 'Sistema Cablaggio Semplificato (Simplified Cable Solution)'
+    desc = 'fieldbus network protocol for home automation, used by bTicino and Legrand'
+    license = 'gplv2+'
+    inputs = ['uart']
+    outputs = []
+    tags = ['Embedded/industrial', 'Networking']
+    channels = (
+        {'id': 'data', 'name': 'Data', 'desc': 'Data line'},
+    )
+    annotations = (
+        ('scs', 'SCS'),
+    )
+    options = ()
+
+    def __init__(self):
+        self.reset()
+
+    def reset(self):
+        self.telegram_idx = 0
+
+    # called before beginning of decoding
+    def start(self):
+        self.out_ann = self.register(srd.OUTPUT_ANN)
+
+    # called to start decoding
+    def decode(self, startsample, endsample, data):
+        ptype, rxtx, pdata = data
+        if ptype != 'DATA':
+            return
+        val = pdata[0]
+        if self.telegram_idx == 0 and val == 0xa8:
+            self.put(startsample, endsample, self.out_ann, [0, ['init']])
+        elif self.telegram_idx == 1:
+            self.crc = val
+            self.put(startsample, endsample, self.out_ann, [0, ['addr']])
+        elif self.telegram_idx == 2:
+            self.crc ^= val
+            self.put(startsample, endsample, self.out_ann, [0, ['??']])
+        elif self.telegram_idx == 3:
+            self.crc ^= val
+            self.put(startsample, endsample, self.out_ann, [0, ['request']])
+        elif self.telegram_idx == 4:
+            self.crc ^= val
+            self.put(startsample, endsample, self.out_ann, [0, ['??']])
+        elif self.telegram_idx == 5:
+            crc = 'good' if self.crc == val else 'bad'
+            self.put(startsample, endsample, self.out_ann, [0, ['%s crc' % crc]])
+        elif self.telegram_idx == 6:
+            self.put(startsample, endsample, self.out_ann, [0, ['term']])
+            self.telegram_idx = -1
+
+        self.telegram_idx += 1
-- 
2.28.0

_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to