Subversion Repositories freemyipod

Rev

Rev 592 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 592 Rev 602
Line 561... Line 561...
561
        except struct.error:
561
        except struct.error:
562
            raise ArgumentError("The specified file is not an emCORE hard disk BBT")
562
            raise ArgumentError("The specified file is not an emCORE hard disk BBT")
563
        if bbtheader[0] != "emBIbbth":
563
        if bbtheader[0] != "emBIbbth":
564
            raise ArgumentError("The specified file is not an emCORE hard disk BBT")
564
            raise ArgumentError("The specified file is not an emCORE hard disk BBT")
565
        virtualsectors = bbtheader[2]
565
        virtualsectors = bbtheader[2]
566
        bbtsectors = bbtheader[3]
566
        bbtsectors = bbtheader[4]
567
        if tempaddr is None:
567
        if tempaddr is None:
568
            tempaddr = self.malloc(len(bbt))
568
            tempaddr = self.malloc(len(bbt))
569
            malloc = True
569
            malloc = True
570
        else:
570
        else:
571
            malloc = False
571
            malloc = False
Line 573... Line 573...
573
            self.write(tempaddr, bbt)
573
            self.write(tempaddr, bbt)
574
            sector = 0
574
            sector = 0
575
            count = 1
575
            count = 1
576
            offset = 0
576
            offset = 0
577
            for i in range(bbtsectors):
577
            for i in range(bbtsectors):
578
                if bbtheader[4][i] == sector + count:
578
                if bbtheader[5 + i] == sector + count:
579
                    count = count + 1
579
                    count = count + 1
580
                else:
580
                else:
581
                    self.ipodclassic_hddaccess(1, sector, count, tempaddr + offset)
581
                    self.ipodclassic_hddaccess(1, sector, count, tempaddr + offset)
582
                    offset = offset + count * 4096
582
                    offset = offset + count * 4096
583
                    sector = bbtheader[4][i]
583
                    sector = bbtheader[5 +i]
584
                    count = 1
584
                    count = 1
585
            self.ipodclassic_hddaccess(1, sector, count, tempaddr + offset)
585
            self.ipodclassic_hddaccess(1, sector, count, tempaddr + offset)
586
        except:
586
        finally:
587
            if malloc == True:
587
            if malloc == True:
588
                self.free(tempaddr)
588
                self.free(tempaddr)
589
            raise
-
 
590
    
589
    
591
    @command()
590
    @command()
592
    def storage_get_info(self, volume):
591
    def storage_get_info(self, volume):
593
        """ Get information about a storage device """
592
        """ Get information about a storage device """
594
        self.logger.debug("Getting storage information\n")
593
        self.logger.debug("Getting storage information\n")