| Line 670... |
Line 670... |
| 670 |
self.logger.info("done\n")
|
670 |
self.logger.info("done\n")
|
| 671 |
data = self.embios.read(destination, sha1size)
|
671 |
data = self.embios.read(destination, sha1size)
|
| 672 |
hash = ord(data)
|
672 |
hash = ord(data)
|
| 673 |
self.logger.info("The generated hash is "+self._hex(hash))
|
673 |
self.logger.info("The generated hash is "+self._hex(hash))
|
| 674 |
|
674 |
|
| - |
|
675 |
@command
|
| - |
|
676 |
def ipodnano2g_getnandinfo(self):
|
| - |
|
677 |
"""
|
| - |
|
678 |
Target-specific function: ipodnano2g
|
| - |
|
679 |
Gathers some information about the NAND chip used
|
| - |
|
680 |
"""
|
| - |
|
681 |
data = self.embios.ipodnano2g_getnandinfo()
|
| - |
|
682 |
self.logger.info("NAND chip type: "+self._hex(data["type"])+"\n")
|
| - |
|
683 |
self.logger.info("Number of banks: "+str(data["banks"])+"\n")
|
| - |
|
684 |
self.logger.info("Number of blocks: "+str(data["blocks"])+"\n")
|
| - |
|
685 |
self.logger.info("Number of user blocks: "+str(data["userblocks"])+"\n")
|
| - |
|
686 |
self.logger.info("Pages per block: "+str(data["pagesperblock"]))
|
| - |
|
687 |
|
| - |
|
688 |
@command
|
| - |
|
689 |
def ipodnano2g_nandread(self, addr, start, count, doecc, checkempty):
|
| - |
|
690 |
"""
|
| - |
|
691 |
Target-specific function: ipodnano2g
|
| - |
|
692 |
Reads data from the NAND chip into memory
|
| - |
|
693 |
"""
|
| - |
|
694 |
addr = self._hexint(addr)
|
| - |
|
695 |
start = self._hexint(start)
|
| - |
|
696 |
count = self._hexint(count)
|
| - |
|
697 |
doecc = int(doecc)
|
| - |
|
698 |
checkempty = int(checkempty)
|
| - |
|
699 |
self.logger.info("Reading "+self._hex(count)+" NAND pages starting at "+self._hex(start)+" to "+self._hex(addr)+"...")
|
| - |
|
700 |
self.embios.lib.dev.timeout = 20000
|
| - |
|
701 |
self.embios.ipodnano2g_nandread(addr, start, count, doecc, checkempty)
|
| - |
|
702 |
self.logger.info("done\n")
|
| - |
|
703 |
|
| - |
|
704 |
@command
|
| - |
|
705 |
def ipodnano2g_nandwrite(self, addr, start, count, doecc):
|
| - |
|
706 |
"""
|
| - |
|
707 |
Target-specific function: ipodnano2g
|
| - |
|
708 |
Writes data to the NAND chip
|
| - |
|
709 |
"""
|
| - |
|
710 |
addr = self._hexint(addr)
|
| - |
|
711 |
start = self._hexint(start)
|
| - |
|
712 |
count = self._hexint(count)
|
| - |
|
713 |
doecc = int(doecc)
|
| - |
|
714 |
self.logger.info("Writing "+self._hex(count)+" NAND pages starting at "+self._hex(start)+" from "+self._hex(addr)+"...")
|
| - |
|
715 |
self.embios.lib.dev.timeout = 20000
|
| - |
|
716 |
self.embios.ipodnano2g_nandwrite(addr, start, count, doecc)
|
| - |
|
717 |
self.logger.info("done\n")
|
| - |
|
718 |
|
| - |
|
719 |
@command
|
| - |
|
720 |
def ipodnano2g_nanderase(self, addr, start, count):
|
| - |
|
721 |
"""
|
| - |
|
722 |
Target-specific function: ipodnano2g
|
| - |
|
723 |
Erases blocks on the NAND chip and stores the results to memory
|
| - |
|
724 |
"""
|
| - |
|
725 |
addr = self._hexint(addr)
|
| - |
|
726 |
start = self._hexint(start)
|
| - |
|
727 |
count = self._hexint(count)
|
| - |
|
728 |
self.logger.info("Erasing "+self._hex(count)+" NAND blocks starting at "+self._hex(start)+" and logging to "+self._hex(addr)+"...")
|
| - |
|
729 |
self.embios.lib.dev.timeout = 20000
|
| - |
|
730 |
self.embios.ipodnano2g_nanderase(addr, start, count)
|
| - |
|
731 |
self.logger.info("done\n")
|
| - |
|
732 |
|
| 675 |
if __name__ == "__main__":
|
733 |
if __name__ == "__main__":
|
| 676 |
if len(sys.argv) < 2:
|
734 |
if len(sys.argv) < 2:
|
| 677 |
usage("No command specified")
|
735 |
usage("No command specified")
|
| 678 |
interface = Commandline()
|
736 |
interface = Commandline()
|
| 679 |
interface._parsecommand(sys.argv[1], sys.argv[2:])
|
737 |
interface._parsecommand(sys.argv[1], sys.argv[2:])
|
| 680 |
|
738 |
|