-
-
Save dimaryaz/2bb353f93ae1ec11a9335519ffe96e21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from jdmtool.device import GarminProgrammerDevice | |
from jdmtool.main import with_usb | |
@with_usb | |
def debug(dev: GarminProgrammerDevice): | |
dev.before_read() | |
BLOCKS_PER_PAGE = 16 | |
start = 0x0000 | |
end = 0x0400 | |
try: | |
for page in range(start, end, 0x10): | |
print(f"Trying page {page:04X}...") | |
dev.select_page(page) | |
blocks1 = [dev.read_block() for _ in range(BLOCKS_PER_PAGE)] | |
dev.select_page(page) | |
blocks2 = [dev.read_block() for _ in range(BLOCKS_PER_PAGE)] | |
if blocks1 != blocks2: | |
print(" Empty") | |
continue | |
filename = f'{page:04X}.bin' | |
print(f" Found data! Saving to {filename}") | |
with open(filename, 'wb') as fd: | |
for b in blocks1: | |
fd.write(b) | |
finally: | |
dev.set_led(False) | |
if __name__ == '__main__': | |
debug() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment