summaryrefslogtreecommitdiff
path: root/decoders/cec
diff options
context:
space:
mode:
authorRyan Jarvis <ryan@shopboxretail.com>2019-01-19 00:05:07 -0800
committerUwe Hermann <uwe@hermann-uwe.de>2019-01-30 00:08:39 +0100
commit16d2031b149ff67be83b5600bdf5ad561add312d (patch)
tree242478dfaba1fa4e1542cfa492e328e4f8ffa6d0 /decoders/cec
parentf78b814d54b19233d5e3f7cfef3d30a7a5ac8d40 (diff)
downloadlibsigrokdecode-16d2031b149ff67be83b5600bdf5ad561add312d.tar.gz
libsigrokdecode-16d2031b149ff67be83b5600bdf5ad561add312d.zip
Rename values that shadow built-in keywords
Diffstat (limited to 'decoders/cec')
-rw-r--r--decoders/cec/pd.py26
-rw-r--r--decoders/cec/protocoldata.py8
2 files changed, 17 insertions, 17 deletions
diff --git a/decoders/cec/pd.py b/decoders/cec/pd.py
index 6e8ddec..e4a40f3 100644
--- a/decoders/cec/pd.py
+++ b/decoders/cec/pd.py
@@ -116,41 +116,41 @@ class Decoder(srd.Decoder):
return
i = 0
- str = ''
+ string = ''
while i < len(self.cmd_bytes):
- str += '{:02x}'.format(self.cmd_bytes[i]['val'])
+ string += '{:02x}'.format(self.cmd_bytes[i]['val'])
if i != (len(self.cmd_bytes) - 1):
- str += ':'
+ string += ':'
i += 1
- self.put(self.frame_start, self.frame_end, self.out_ann, [7, [str]])
+ self.put(self.frame_start, self.frame_end, self.out_ann, [7, [string]])
i = 0
operands = 0
- str = ''
+ string = ''
while i < len(self.cmd_bytes):
if i == 0: # Parse header
(src, dst) = decode_header(self.cmd_bytes[i]['val'])
- str = 'HDR: ' + src + ', ' + dst
+ string = 'HDR: ' + src + ', ' + dst
elif i == 1: # Parse opcode
- str += ' | OPC: ' + opcodes.get(self.cmd_bytes[i]['val'], 'Invalid')
+ string += ' | OPC: ' + opcodes.get(self.cmd_bytes[i]['val'], 'Invalid')
else: # Parse operands
if operands == 0:
- str += ' | OPS: '
+ string += ' | OPS: '
operands += 1
- str += '0x{:02x}'.format(self.cmd_bytes[i]['val'])
+ string += '0x{:02x}'.format(self.cmd_bytes[i]['val'])
if i != len(self.cmd_bytes) - 1:
- str += ', '
+ string += ', '
i += 1
# Header only commands are PINGS
if i == 1:
- str += ' | OPC: PING' if self.eom else ' | OPC: NONE. Aborted cmd'
+ string += ' | OPC: PING' if self.eom else ' | OPC: NONE. Aborted cmd'
# Add extra information (ack of the command from the destination)
- str += ' | R: NACK' if is_nack else ' | R: ACK'
+ string += ' | R: NACK' if is_nack else ' | R: ACK'
- self.put(self.frame_start, self.frame_end, self.out_ann, [8, [str]])
+ self.put(self.frame_start, self.frame_end, self.out_ann, [8, [string]])
def process(self):
zero_time = ((self.rise - self.fall_start) / self.samplerate) * 1000.0
diff --git a/decoders/cec/protocoldata.py b/decoders/cec/protocoldata.py
index 833ac7f..78c3b6f 100644
--- a/decoders/cec/protocoldata.py
+++ b/decoders/cec/protocoldata.py
@@ -101,15 +101,15 @@ opcodes = {
0x9A: 'SET_AUDIO_RATE',
}
-def resolve_logical_address(id, is_initiator):
- if id < 0 or id > 0x0F:
+def resolve_logical_address(id_, is_initiator):
+ if id_ < 0 or id_ > 0x0F:
return 'Invalid'
# Special handling of 0x0F.
- if id == 0x0F:
+ if id_ == 0x0F:
return 'Unregistered' if is_initiator else 'Broadcast'
- return logical_adresses[id]
+ return logical_adresses[id_]
def decode_header(header):
src = (header & 0xF0) >> 4