summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2019-11-29 19:47:35 +0100
committerUwe Hermann <uwe@hermann-uwe.de>2019-11-29 20:10:06 +0100
commit7714a23058fcf1fbffa1208fb02f854947f0617f (patch)
tree05df1dbf11876ebdf061a055ee9d8a687d228ba6
parent77c986b311272b5298f86653639e7cec2e2c01fc (diff)
downloadlibsigrokdecode-7714a23058fcf1fbffa1208fb02f854947f0617f.tar.gz
libsigrokdecode-7714a23058fcf1fbffa1208fb02f854947f0617f.zip
modbus: Ignore unknown/unsupported types.
Without this, e.g. the recently added 'IDLE' ptype of the UART decoder would cause issues.
-rw-r--r--decoders/modbus/pd.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/decoders/modbus/pd.py b/decoders/modbus/pd.py
index cc42721..1d012e4 100644
--- a/decoders/modbus/pd.py
+++ b/decoders/modbus/pd.py
@@ -929,6 +929,10 @@ class Decoder(srd.Decoder):
def decode(self, ss, es, data):
ptype, rxtx, pdata = data
+ # Ignore unknown/unsupported ptypes.
+ if ptype not in ('STARTBIT', 'DATA', 'STOPBIT'):
+ return
+
# Decide what ADU(s) we need this packet to go to.
# Note that it's possible to go to both ADUs.
if rxtx_channels[rxtx] == self.options['scchannel']: