freemyipod r602 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r601‎ | r602 | r603 >
Date:02:21, 13 February 2011
Author:theseven
Status:new
Tags:
Comment:
[lib]emcore.py: Fix ipodclassic_writebbt command
Modified paths:
  • /emcore/trunk/tools/emcore.py (modified) (history)
  • /emcore/trunk/tools/libemcore.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/emcore.py
@@ -814,8 +814,7 @@
815815 Uploads the bad block table <filename> to memory at <tempaddr>
816816 (or an allocated block if not given) and writes it to the hard disk
817817 """
818 - if tempaddr != None:
819 - tempaddr = to_int(tempaddr)
 818+ tempaddr = to_int(tempaddr)
820819 try:
821820 f = open(filename, 'rb')
822821 except IOError:
Index: emcore/trunk/tools/libemcore.py
@@ -563,7 +563,7 @@
564564 if bbtheader[0] != "emBIbbth":
565565 raise ArgumentError("The specified file is not an emCORE hard disk BBT")
566566 virtualsectors = bbtheader[2]
567 - bbtsectors = bbtheader[3]
 567+ bbtsectors = bbtheader[4]
568568 if tempaddr is None:
569569 tempaddr = self.malloc(len(bbt))
570570 malloc = True
@@ -575,18 +575,17 @@
576576 count = 1
577577 offset = 0
578578 for i in range(bbtsectors):
579 - if bbtheader[4][i] == sector + count:
 579+ if bbtheader[5 + i] == sector + count:
580580 count = count + 1
581581 else:
582582 self.ipodclassic_hddaccess(1, sector, count, tempaddr + offset)
583583 offset = offset + count * 4096
584 - sector = bbtheader[4][i]
 584+ sector = bbtheader[5 +i]
585585 count = 1
586586 self.ipodclassic_hddaccess(1, sector, count, tempaddr + offset)
587 - except:
 587+ finally:
588588 if malloc == True:
589589 self.free(tempaddr)
590 - raise
591590
592591 @command()
593592 def storage_get_info(self, volume):