Skip to content

Commit

Permalink
Derps
Browse files Browse the repository at this point in the history
  • Loading branch information
penn5 committed Jun 8, 2019
1 parent c77005a commit cfd1b7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions idtconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_images(cfg: bytes):
try:
tree = etree.fromstring(cfg)
except:
return get_simple(cfg.decode("utf-8"))
return get_simple(cfg)
ddr_images = tree.xpath("(//configurations/configuration)[1]/bootloaderimage_ddr/image")
std_images = tree.xpath("(//configurations/configuration)[1]/bootloaderimage/image")
images = {int(img.get("address"), 0):img.text for img in ddr_images}
Expand All @@ -27,10 +27,10 @@ def get_images(cfg: bytes):

def get_simple(cfg):
ret = {}
for line in cfg.readlines:
for line in cfg.split("\n"):
match = re.fullmatch(r"(\w+)(?:\W+)(.+)")
if not match:
return None
continue
addr = int(match[1], 0)
file = match[2]
ret[addr] = file
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ def main(config, device, chip=""):
parser.add_argument("--device", "-d")
parser.add_argument("config")
args = parser.parse_args()
with open(args.config, "rb") as f:
with open(args.config, "r") as f:
main(f, args.device if args.run else False)

0 comments on commit cfd1b7b

Please sign in to comment.