From: Wolfram Sang <wsa+rene...@sang-engineering.com> 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+rene...@sang-engineering.com> --- decoders/sdcard_sd/pd.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/decoders/sdcard_sd/pd.py b/decoders/sdcard_sd/pd.py index 2d88096..6d8fdf2 100644 --- a/decoders/sdcard_sd/pd.py +++ b/decoders/sdcard_sd/pd.py @@ -65,6 +65,7 @@ def __init__(self): 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 @@ def puta(self, s, e, data): 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 @@ def handle_response_r1(self, cmd): 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 @@ def handle_response_r1b(self, cmd): 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 @@ def handle_response_r3(self, cmd): # - 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 @@ def handle_response_r6(self, cmd): 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 @@ def handle_response_r7(self, cmd): 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']]) -- 2.11.0 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ sigrok-devel mailing list sigrok-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sigrok-devel