summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2012-07-04 01:19:35 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2012-07-04 01:50:44 +0200
commit0631e33dc11b621914af0e76a1864567557ebdc4 (patch)
treea3531e44cd1c7e5613fd0df20f5a1e4f980ca43e /decoders
parent48eee789a15ebd4c26d469a29dd79e7971f031fe (diff)
downloadlibsigrokdecode-0631e33dc11b621914af0e76a1864567557ebdc4.tar.gz
libsigrokdecode-0631e33dc11b621914af0e76a1864567557ebdc4.zip
unfinished update to onewire protocol decoder
Diffstat (limited to 'decoders')
-rw-r--r--decoders/Makefile.am3
-rw-r--r--decoders/onewire/onewire.py14
2 files changed, 8 insertions, 9 deletions
diff --git a/decoders/Makefile.am b/decoders/Makefile.am
index 9f3f269..3e3ff53 100644
--- a/decoders/Makefile.am
+++ b/decoders/Makefile.am
@@ -42,5 +42,6 @@ SUBDIRS = \
uart_dump \
usb \
usb_signalling \
- usb_protocol
+ usb_protocol \
+ onewire
diff --git a/decoders/onewire/onewire.py b/decoders/onewire/onewire.py
index 38cc0b8..92cc7dc 100644
--- a/decoders/onewire/onewire.py
+++ b/decoders/onewire/onewire.py
@@ -94,7 +94,7 @@ class Decoder(srd.Decoder):
pass
def decode(self, ss, es, data):
- for (self.samplenum, (owr, pwr)) in data:
+ for (self.samplenum, owr) in data:
# Data link layer
@@ -133,7 +133,7 @@ class Decoder(srd.Decoder):
if (self.lnk_bit) : self.lnk_state = 'WAIT FOR FALLING EDGE'
else : self.lnk_state = 'WAIT FOR RISING EDGE'
else:
- raise Exception('Invalid lnk_state: %s' % self.lnk_state)
+ raise Exception('Invalid lnk_state: %d' % self.lnk_state)
# Network layer
@@ -149,10 +149,8 @@ class Decoder(srd.Decoder):
self.net_cnt = self.net_cnt + 1
self.net_cmd = (self.net_cmd << 1) & self.lnk_bit
if (self.lnk_cnt == 8):
- self.put(self.startsample, self.samplenum,
- self.out_proto, ['LNK: BYTE', self.lnk_byte])
- self.put(self.startsample, self.samplenum, self.out_ann,
- [ANN_DEC, ['LNK: BYTE: ' + self.lnk_byte]])
+ self.put(self.startsample, self.samplenum, self.out_proto, ['LNK: BYTE', self.lnk_byte])
+ self.put(self.startsample, self.samplenum, self.out_ann , ['LNK: BYTE', self.lnk_byte])
if (self.net_cmd == 0x33):
# READ ROM
break
@@ -179,9 +177,9 @@ class Decoder(srd.Decoder):
#
break
else:
- raise Exception('Invalid net_state: %s' % self.net_state)
+ raise Exception('Invalid net_state: %d' % self.net_state)
elif not (self.lnk_event == "NONE"):
- raise Exception('Invalid net_event: %s' % self.net_event)
+ raise Exception('Invalid net_event: %d' % self.net_event)