Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add iPod Nano 2G post-mortem memory dumper by Michael Sparmann

The files are downloaded from https://www.rockbox.org/tracker/task/11701

Change-Id: Ic6415f76207868661c231cb534cb179160eb60e0

authored by

Vencislav Atanasov and committed by
Solomon Peachy
0781195c bf2320d2

+86
+55
utils/rbpms/librbpms.py
··· 1 + #!/usr/bin/env python 2 + 3 + import sys 4 + import struct 5 + import usb 6 + 7 + 8 + class rbpms: 9 + def __init__(self): 10 + self.handle = usb.core.find(idVendor=0xffff, idProduct=0xa112) 11 + if self.handle is None: 12 + raise Exception("Could not find specified device") 13 + self.handle.set_configuration() 14 + print("Connected to Rockbox Post-Mortem Stub on iPod Nano 2G") 15 + 16 + 17 + @staticmethod 18 + def __myprint(data): 19 + sys.stdout.write(data) 20 + sys.stdout.flush() 21 + 22 + 23 + def read(self, offset, size): 24 + if offset & 15 != 0: 25 + raise Exception("Unaligned data read!") 26 + 27 + data = "" 28 + 29 + while True: 30 + blocklen = size 31 + if blocklen == 0: break 32 + if blocklen > 256 * 1024: blocklen = 256 * 1024 33 + self.handle.write(4, struct.pack("<II", offset, blocklen), 0, 100) 34 + block = struct.unpack("%ds" % blocklen, self.handle.read(0x83, blocklen, 0, 1000))[0] 35 + offset += blocklen 36 + data += block 37 + size -= blocklen 38 + 39 + return data 40 + 41 + 42 + def download(self, offset, size, file): 43 + self.__myprint("Downloading 0x%x bytes from 0x%8x to %s..." % (size, offset, file)) 44 + f = open(file, "wb") 45 + 46 + while True: 47 + blocklen = size 48 + if blocklen == 0: break 49 + if blocklen > 2048 * 1024: blocklen = 2048 * 1024 50 + f.write(self.read(offset, blocklen)) 51 + offset += blocklen 52 + size -= blocklen 53 + self.__myprint(".") 54 + 55 + self.__myprint(" done\n")
+31
utils/rbpms/rbpms.py
··· 1 + #!/usr/bin/env python 2 + import sys 3 + import librbpms 4 + 5 + 6 + def usage(): 7 + print "" 8 + print "Please provide a command and (if needed) parameters as command line arguments" 9 + print "" 10 + print "Available commands:" 11 + print "" 12 + print " download <address> <size> <file>" 13 + print " Downloads <size> bytes of data from the specified address on the device," 14 + print " and stores it in the specified file." 15 + print "" 16 + print "All numbers are hexadecimal!" 17 + exit(2) 18 + 19 + 20 + def parsecommand(dev, argv): 21 + if len(argv) < 2: usage() 22 + 23 + elif argv[1] == "download": 24 + if len(argv) != 5: usage() 25 + dev.download(int(argv[2], 16), int(argv[3], 16), argv[4]) 26 + 27 + else: usage() 28 + 29 + 30 + dev = librbpms.rbpms() 31 + parsecommand(dev, sys.argv)