From 0631e33dc11b621914af0e76a1864567557ebdc4 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Wed, 4 Jul 2012 01:19:35 +0200 Subject: unfinished update to onewire protocol decoder --- decoders/Makefile.am | 3 ++- decoders/onewire/onewire.py | 14 ++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) (limited to 'decoders') 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) -- cgit v1.2.3-70-g09d2