summaryrefslogtreecommitdiff
path: root/decoders/atsha204a
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2018-05-26 00:32:14 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2018-05-26 00:34:28 +0200
commitd62ee705a0807493781bf1e314c73399bb8d72c5 (patch)
tree79d0192d5fca292077e51ec06b1945f40bc2c309 /decoders/atsha204a
parentd6430dffc1cd39c0996278186b949c99d33e3171 (diff)
downloadlibsigrokdecode-d62ee705a0807493781bf1e314c73399bb8d72c5.tar.gz
libsigrokdecode-d62ee705a0807493781bf1e314c73399bb8d72c5.zip
atsha204a: Use the Python 'in' keyword to improve readability.
Diffstat (limited to 'decoders/atsha204a')
-rw-r--r--decoders/atsha204a/pd.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/decoders/atsha204a/pd.py b/decoders/atsha204a/pd.py
index 3d6fd41..3b7ee53 100644
--- a/decoders/atsha204a/pd.py
+++ b/decoders/atsha204a/pd.py
@@ -163,10 +163,8 @@ class Decoder(srd.Decoder):
self.put(data[0], data[1], self.out_ann, [2, ['Opcode: %s' % OPCODES[data[2]]]])
def display_param1(self, data):
- if (self.opcode == OPCODE_CHECK_MAC) or (self.opcode == OPCODE_DEV_REV) or \
- (self.opcode == OPCODE_HMAC) or (self.opcode == OPCODE_MAC) or \
- (self.opcode == OPCODE_NONCE) or (self.opcode == OPCODE_RANDOM) or \
- (self.opcode == OPCODE_SHA):
+ if self.opcode in (OPCODE_CHECK_MAC, OPCODE_DEV_REV, OPCODE_HMAC, \
+ OPCODE_MAC, OPCODE_NONCE, OPCODE_RANDOM, OPCODE_SHA):
self.put(data[0], data[1], self.out_ann, [3, ['Mode: %02X' % data[2]]])
elif self.opcode == OPCODE_DERIVE_KEY:
self.put(data[0], data[1], self.out_ann, [3, ['Random: %s' % data[2]]])
@@ -190,14 +188,13 @@ class Decoder(srd.Decoder):
def display_param2(self, data):
if self.opcode == OPCODE_DERIVE_KEY:
self.put(data[0][0], data[1][1], self.out_ann, [4, ['TargetKey: {:02x} {:02x}'.format(data[1][2], data[0][2])]])
- elif (self.opcode == OPCODE_NONCE) or (self.opcode == OPCODE_PAUSE) or (self.opcode == OPCODE_RANDOM):
+ elif self.opcode in (OPCODE_NONCE, OPCODE_PAUSE, OPCODE_RANDOM):
self.put(data[0][0], data[1][1], self.out_ann, [4, ['Zero: {:02x} {:02x}'.format(data[1][2], data[0][2])]])
- elif (self.opcode == OPCODE_HMAC) or (self.opcode == OPCODE_MAC) or \
- (self.opcode == OPCODE_CHECK_MAC) or (self.opcode == OPCODE_GEN_DIG):
+ elif self.opcode in (OPCODE_HMAC, OPCODE_MAC, OPCODE_CHECK_MAC, OPCODE_GEN_DIG):
self.put(data[0][0], data[1][1], self.out_ann, [4, ['SlotID: {:02x} {:02x}'.format(data[1][2], data[0][2])]])
elif self.opcode == OPCODE_LOCK:
self.put(data[0][0], data[1][1], self.out_ann, [4, ['Summary: {:02x} {:02x}'.format(data[1][2], data[0][2])]])
- elif (self.opcode == OPCODE_READ) or (self.opcode == OPCODE_WRITE):
+ elif self.opcode in (OPCODE_READ, OPCODE_WRITE):
self.put(data[0][0], data[1][1], self.out_ann, [4, ['Address: {:02x} {:02x}'.format(data[1][2], data[0][2])]])
elif self.opcode == OPCODE_UPDATE_EXTRA:
self.put(data[0][0], data[1][1], self.out_ann, [4, ['NewValue: {:02x}'.format(data[0][2])]])