summaryrefslogtreecommitdiff
path: root/decoders/usb_signalling
diff options
context:
space:
mode:
Diffstat (limited to 'decoders/usb_signalling')
-rw-r--r--decoders/usb_signalling/pd.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/decoders/usb_signalling/pd.py b/decoders/usb_signalling/pd.py
index a21fe8d..59db0d4 100644
--- a/decoders/usb_signalling/pd.py
+++ b/decoders/usb_signalling/pd.py
@@ -73,6 +73,9 @@ sym_idx = {
'SE1': 3,
}
+class SamplerateError(Exception):
+ pass
+
class Decoder(srd.Decoder):
api_version = 2
id = 'usb_signalling'
@@ -217,8 +220,8 @@ class Decoder(srd.Decoder):
self.oldsym = sym
def decode(self, ss, es, data):
- if self.samplerate is None:
- raise Exception("Cannot decode without samplerate.")
+ if not self.samplerate:
+ raise SamplerateError('Cannot decode without samplerate.')
for (self.samplenum, pins) in data:
# State machine.
if self.state == 'IDLE':