Skip to content

Commit

Permalink
Add support for decoding SCR, CID and CSD registers
Browse files Browse the repository at this point in the history
The output can be json or human-readable.

Signed-off-by: Jan Luebbe <[email protected]>
  • Loading branch information
jluebbe committed Dec 19, 2023
1 parent 7c09767 commit 90e732c
Show file tree
Hide file tree
Showing 3 changed files with 537 additions and 13 deletions.
9 changes: 5 additions & 4 deletions usbsdmux/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import json

from .usbsdmux import autoselect_driver, UnknownUsbSdMuxRevisionException, NotInHostModeException
from .sd_regs import decoded_to_text


def main():
Expand Down Expand Up @@ -121,11 +122,11 @@ def main():
elif mode == "info":
info = ctl.get_card_info()
if args.json:
print(json.dumps(info, indent=4))
print(json.dumps(info, indent=2))
else:
print("SCR: {}".format(info["scr"]["raw"]))
print("CID: {}".format(info["cid"]["raw"]))
print("CSD: {}".format(info["csd"]["raw"]))
print("\n".join(decoded_to_text(info["scr"])))
print("\n".join(decoded_to_text(info["cid"])))
print("\n".join(decoded_to_text(info["csd"])))

except FileNotFoundError as fnfe:
error_msg = str(fnfe)
Expand Down
Loading

0 comments on commit 90e732c

Please sign in to comment.