]> sigrok.org Git - libsigrokdecode.git/commitdiff
ds2432: Simplify MAC printing.
authorUwe Hermann <redacted>
Thu, 19 Oct 2017 07:36:17 +0000 (09:36 +0200)
committerUwe Hermann <redacted>
Thu, 19 Oct 2017 09:41:17 +0000 (11:41 +0200)
decoders/ds2432/pd.py

index 269a23e38b010daaff91aac75cbf0a577bd404db..d50a6d846c9ab53bc1594a93dc3c4e10c17d4472 100644 (file)
@@ -177,13 +177,9 @@ class Decoder(srd.Decoder):
                     self.ss = ss
                 elif 24 == len(self.bytes):
                     self.es = es
-                    self.putx([0, ['Message authentication code: '
-                                   + (','.join(format(n, '#04x')
-                                       for n in self.bytes[4:24])),
-                                   'MAC: '
-                                   + (','.join(format(n, '#04x')
-                                       for n in self.bytes[4:24])),
-                                   ]])
+                    mac = ','.join(format(n, '#04x') for n in self.bytes[4:24])
+                    self.putx([0, ['Message authentication code: ' + mac,
+                                   'MAC: ' + mac]])
                 elif 24 < len(self.bytes):
                     self.ss, self.es = ss, es
                     if (0xaa == self.bytes[-1] or 0x55 == self.bytes[-1]):
@@ -218,13 +214,9 @@ class Decoder(srd.Decoder):
                     self.ss = ss
                 elif 58 == len(self.bytes):
                     self.es = es
-                    self.putx([0, ['Message authentication code: '
-                                   + (','.join(format(n, '#04x')
-                                       for n in self.bytes[38:58])),
-                                   'MAC: '
-                                   + (','.join(format(n, '#04x')
-                                       for n in self.bytes[38:58])),
-                                   ]])
+                    mac = ','.join(format(n, '#04x') for n in self.bytes[38:58])
+                    self.putx([0, ['Message authentication code: ' + mac,
+                                   'MAC: ' + mac]])
                 elif 59 == len(self.bytes):
                     self.ss = ss
                 elif 60 == len(self.bytes):