freemyipod r404 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r403‎ | r404 | r405 >
Date:02:30, 1 January 2011
Author:farthen
Status:new
Tags:
Comment:
embios.py/libembios: Correct documentation, create defaults for some arguments, fix an argument type.
Modified paths:
  • /embios/trunk/tools/embios.py (modified) (history)
  • /embios/trunk/tools/libembios.py (modified) (history)

Diff [purge]

Index: embios/trunk/tools/embios.py
@@ -687,7 +687,7 @@
688688 self.logger.info("Pages per block: " + str(data["pagesperblock"]))
689689
690690 @command
691 - def ipodnano2g_nandread(self, addr, start, count, doecc, checkempty):
 691+ def ipodnano2g_nandread(self, addr, start, count, doecc=True, checkempty=True):
692692 """
693693 Target-specific function: ipodnano2g
694694 Reads data from the NAND chip into memory
@@ -694,14 +694,14 @@
695695 <addr>: the memory location where the data is written to
696696 <start>: start block
697697 <count>: block count
698 - <doecc>: FIXME
699 - <checkempty>: FIXME
 698+ [doecc]: use ecc error correction data
 699+ [checkempty]: set statusflags if pages are empty
700700 """
701701 addr = self._hexint(addr)
702702 start = self._hexint(start)
703703 count = self._hexint(count)
704 - doecc = int(doecc) # FIXME shouldn't this be bool?
705 - checkempty = int(checkempty)
 704+ doecc = self._bool(doecc)
 705+ checkempty = self._bool(checkempty)
706706 self.logger.info("Reading " + self._hex(count) + " NAND pages starting at " + \
707707 self._hex(start) + " to " + self._hex(addr) + "...")
708708 self.embios.ipodnano2g_nandread(addr, start, count, doecc, checkempty)
@@ -708,7 +708,7 @@
709709 self.logger.info("done\n")
710710
711711 @command
712 - def ipodnano2g_nandwrite(self, addr, start, count, doecc):
 712+ def ipodnano2g_nandwrite(self, addr, start, count, doecc=True):
713713 """
714714 Target-specific function: ipodnano2g
715715 Writes data to the NAND chip
@@ -715,12 +715,12 @@
716716 <addr>: the memory location where the data is read from
717717 <start>: start block
718718 <count>: block count
719 - <doecc>: FIXME
 719+ [doecc]: create ecc error correction data
720720 """
721721 addr = self._hexint(addr)
722722 start = self._hexint(start)
723723 count = self._hexint(count)
724 - doecc = int(doecc) # FIXME shouldn't this be bool?
 724+ doecc = self._bool(doecc)
725725 self.logger.info("Writing " + self._hex(count) + " NAND pages starting at " + \
726726 self._hex(start) + " from " + self._hex(addr) + "...")
727727 self.embios.ipodnano2g_nandwrite(addr, start, count, doecc)
@@ -825,7 +825,7 @@
826826 def getvolumeinfo(self, volume):
827827 """
828828 Gathers some information about a storage volume used
829 - <volume>: FIXME
 829+ <volume>: volume id
830830 """
831831 volume = self._hexint(volume)
832832 data = self.embios.storage_get_info(volume)
Index: embios/trunk/tools/libembios.py
@@ -550,7 +550,7 @@
551551 """ Target-specific function: ipodnano2g
552552 Reads data from the NAND chip into memory
553553 """
554 - return self.lib.monitorcommand(struct.pack("IIII", 0xffff0002, addr | (0x80000000 if doecc != 0 else 0) | (0x40000000 if checkempty != 0 else 0), start, count), "III", (None, None, None))
 554+ return self.lib.monitorcommand(struct.pack("IIII", 0xffff0002, addr | (0x80000000 if doecc else 0) | (0x40000000 if checkempty else 0), start, count), "III", (None, None, None))
555555
556556 @command(timeout = 30000, target = 0x47324e49)
557557 def ipodnano2g_nandwrite(self, addr, start, count, doecc):
@@ -557,7 +557,7 @@
558558 """ Target-specific function: ipodnano2g
559559 Writes data to the NAND chip
560560 """
561 - return self.lib.monitorcommand(struct.pack("IIII", 0xffff0003, addr | (0x80000000 if doecc != 0 else 0), start, count), "III", (None, None, None))
 561+ return self.lib.monitorcommand(struct.pack("IIII", 0xffff0003, addr | (0x80000000 if doecc else 0), start, count), "III", (None, None, None))
562562
563563 @command(timeout = 30000, target = 0x47324e49)
564564 def ipodnano2g_nanderase(self, addr, start, count):