summaryrefslogtreecommitdiff
path: root/decoders/parallel
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2014-08-11 22:53:35 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2014-08-14 17:44:20 +0200
commita573d3944c410d90adb5130323e0f3792d9ae201 (patch)
tree6c434db0316e7c6f36691898d145dcccb8d224c4 /decoders/parallel
parentf04964c696336f5699a099bbd64785f199d91f4c (diff)
downloadlibsigrokdecode-a573d3944c410d90adb5130323e0f3792d9ae201.tar.gz
libsigrokdecode-a573d3944c410d90adb5130323e0f3792d9ae201.zip
parallel: Enforce that at least one pin must be provided.
Diffstat (limited to 'decoders/parallel')
-rw-r--r--decoders/parallel/pd.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/decoders/parallel/pd.py b/decoders/parallel/pd.py
index a695ca6..cafaefc 100644
--- a/decoders/parallel/pd.py
+++ b/decoders/parallel/pd.py
@@ -61,6 +61,9 @@ def channel_list(num_channels):
l.append(d)
return tuple(l)
+class ChannelError(Exception):
+ pass
+
class Decoder(srd.Decoder):
api_version = 2
id = 'parallel'
@@ -180,6 +183,9 @@ class Decoder(srd.Decoder):
continue
self.oldpins = pins
+ if sum(1 for p in pins if p in (0, 1)) == 0:
+ raise ChannelError('At least one channel has to be supplied.')
+
if pins[0] not in (0, 1):
self.handle_bits(pins[1:])
else: