From 3a9f6abf26e98198986567d83c790ad11fd1f875 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Thu, 19 Oct 2017 09:36:17 +0200 Subject: ds2432: Simplify MAC printing. --- decoders/ds2432/pd.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) 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): -- cgit v1.2.3-70-g09d2