]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/can/pd.py
can: avoid assignment to .id field during frame inspection
[libsigrokdecode.git] / decoders / can / pd.py
index 4551896a4b6be822db2a1abda7cd009ea2f2b401..bf8e10af37f83bfe9853cac203d8691345c610f2 100644 (file)
@@ -349,7 +349,7 @@ class Decoder(srd.Decoder):
             self.putb([4, ['Extended Identifier: %s' % s,
                            'Extended ID: %s' % s, 'Extended ID', 'EID']])
 
-            self.fullid = self.id << 18 | self.eid
+            self.fullid = self.ident << 18 | self.eid
             s = '%d (0x%x)' % (self.fullid, self.fullid)
             self.putb([5, ['Full Identifier: %s' % s, 'Full ID: %s' % s,
                            'Full ID', 'FID']])
@@ -474,12 +474,13 @@ class Decoder(srd.Decoder):
         elif bitnum == 11:
             bits = self.bits[1:]
             bits.reverse()
-            # BEWARE! Clobbers the decoder's .id field!
-            self.id = bitpack(bits)
-            self.fullid = self.id
-            s = '%d (0x%x)' % (self.id, self.id),
+            # BEWARE! Don't clobber the decoder's .id field which is
+            # part of its boiler plate!
+            self.ident = bitpack(bits)
+            self.fullid = self.ident
+            s = '%d (0x%x)' % (self.ident, self.ident),
             self.putb([3, ['Identifier: %s' % s, 'ID: %s' % s, 'ID']])
-            if (self.id & 0x7f0) == 0x7f0:
+            if (self.ident & 0x7f0) == 0x7f0:
                 self.putb([16, ['Identifier bits 10..4 must not be all recessive']])
 
         # RTR or SRR bit, depending on frame type (gets handled later).