summaryrefslogtreecommitdiff
path: root/decoders
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2017-05-12 13:58:28 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2017-05-13 16:17:56 +0200
commitf8eb6c3f41e2c4705124c0381e64458818b52353 (patch)
treeb4cb709a3839d2036e74d1690dd6ee5fdf00ff8e /decoders
parent1cf5aeaf84f230fa13aa894f6bd719af42657169 (diff)
downloadlibsigrokdecode-f8eb6c3f41e2c4705124c0381e64458818b52353.tar.gz
libsigrokdecode-f8eb6c3f41e2c4705124c0381e64458818b52353.zip
sdcard_sd: reference latest command when displaying response
Replace the hardcoded value with the last cmd used. I'd think the whole ACMD handling could be simplified if we make further use of this new variable. But for now, let's keep it simple and make it work. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Diffstat (limited to 'decoders')
-rw-r--r--decoders/sdcard_sd/pd.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/decoders/sdcard_sd/pd.py b/decoders/sdcard_sd/pd.py
index 2d88096..4f10f7c 100644
--- a/decoders/sdcard_sd/pd.py
+++ b/decoders/sdcard_sd/pd.py
@@ -65,6 +65,7 @@ class Decoder(srd.Decoder):
self.token = []
self.is_acmd = False # Indicates CMD vs. ACMD
self.cmd = None
+ self.last_cmd = None
self.arg = None
def start(self):
@@ -84,11 +85,12 @@ class Decoder(srd.Decoder):
self.out_ann, data)
def putc(self, cmd, desc):
+ self.last_cmd = cmd
self.putt([cmd, ['%s: %s' % (self.cmd_str, desc), self.cmd_str,
self.cmd_str.split(' ')[0]]])
- def putr(self, cmd, desc):
- self.putt([cmd, ['Reply: %s' % desc]])
+ def putr(self, desc):
+ self.putt([self.last_cmd, ['Reply: %s' % desc]])
def reset(self):
self.cmd, self.arg = None, None
@@ -288,7 +290,7 @@ class Decoder(srd.Decoder):
if not self.get_token_bits(cmd, 48):
return
self.handle_common_token_fields()
- self.putr(55, 'R1')
+ self.putr('R1')
self.puta(0, 31, [136, ['Card status', 'Status', 'S']])
for i in range(32):
self.putbit(8 + i, [card_status[31 - i]])
@@ -300,7 +302,7 @@ class Decoder(srd.Decoder):
return
self.handle_common_token_fields()
self.puta(0, 31, [136, ['Card status', 'Status', 'S']])
- self.putr(55, 'R1b')
+ self.putr('R1b')
self.token, self.state = [], 'GET COMMAND TOKEN'
def handle_response_r2(self, cmd):
@@ -335,7 +337,7 @@ class Decoder(srd.Decoder):
# - Bits[00:00]: End bit (always 1)
if not self.get_token_bits(cmd, 48):
return
- self.putr(55, 'R3')
+ self.putr('R3')
# Annotations for each individual bit.
for bit in range(len(self.token)):
self.putf(bit, bit, [128, ['%d' % self.token[bit][2]]])
@@ -363,7 +365,7 @@ class Decoder(srd.Decoder):
self.handle_common_token_fields()
self.puta(0, 15, [136, ['Card status bits', 'Status', 'S']])
self.puta(16, 31, [136, ['Relative card address', 'RCA', 'R']])
- self.putr(55, 'R6')
+ self.putr('R6')
self.token, self.state = [], 'GET COMMAND TOKEN'
def handle_response_r7(self, cmd):
@@ -380,7 +382,7 @@ class Decoder(srd.Decoder):
return
self.handle_common_token_fields()
- self.putr(55, 'R7')
+ self.putr('R7')
# Arg[31:12]: Reserved bits (all-zero)
self.puta(12, 31, [136, ['Reserved', 'Res', 'R']])