From: Uwe Hermann Date: Thu, 19 Oct 2017 07:36:17 +0000 (+0200) Subject: ds2432: Simplify MAC printing. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3a9f6abf26e98198986567d83c790ad11fd1f875;p=libsigrokdecode.git ds2432: Simplify MAC printing. --- diff --git a/decoders/ds2432/pd.py b/decoders/ds2432/pd.py index 269a23e..d50a6d8 100644 --- a/decoders/ds2432/pd.py +++ b/decoders/ds2432/pd.py @@ -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):