freemyipod r615 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r614‎ | r615 | r616 >
Date:05:48, 14 February 2011
Author:theseven
Status:new
Tags:
Comment:
libemcore.py: Automatically reload BBT after writing it (iPod Classic)
Modified paths:
  • /emcore/trunk/tools/libemcore.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/libemcore.py
@@ -570,6 +570,20 @@
571571 if (rc.rc > 0x80000000):
572572 raise DeviceError("HDD access (type=%d, sector=%d, count=%d, addr=0x%08X) failed with RC 0x%08X" % (type, sector, count, addr, rc.rc))
573573
 574+ @command(timeout = 30000, target = 0x4c435049)
 575+ def ipodclassic_reloadbbt(self):
 576+ """ Target-specific function: ipodclassic
 577+ Reload the ATA bbt
 578+ """
 579+ rc = self.lib.monitorcommand(struct.pack("<IIII", 0xffff0003, 0, 0, 0), "III", (None, None, None))
 580+
 581+ @command(timeout = 30000, target = 0x4c435049)
 582+ def ipodclassic_disablebbt(self):
 583+ """ Target-specific function: ipodclassic
 584+ Disable the ATA bbt
 585+ """
 586+ rc = self.lib.monitorcommand(struct.pack("<IIII", 0xffff0004, 0, 0, 0), "III", (None, None, None))
 587+
574588 @command(target = 0x4c435049)
575589 def ipodclassic_writebbt(self, bbt, tempaddr = None):
576590 """ Target-specific function: ipodclassic
@@ -590,6 +604,7 @@
591605 malloc = False
592606 try:
593607 self.write(tempaddr, bbt)
 608+ self.disk_unmount(0)
594609 sector = 0
595610 count = 1
596611 offset = 0
@@ -602,6 +617,8 @@
603618 sector = bbtheader[5 +i]
604619 count = 1
605620 self.ipodclassic_hddaccess(1, sector, count, tempaddr + offset)
 621+ self.ipodclassic_reloadbbt()
 622+ self.disk_mount(0)
606623 finally:
607624 if malloc == True:
608625 self.free(tempaddr)