Subversion Repositories freemyipod

Rev

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

Rev 473 Rev 475
Line 616... Line 616...
616
        result.product = self.readstring(result.productptr)
616
        result.product = self.readstring(result.productptr)
617
        result.revision = self.readstring(result.revisionptr)
617
        result.revision = self.readstring(result.revisionptr)
618
        return result
618
        return result
619
    
619
    
620
    @command(timeout = 50000)
620
    @command(timeout = 50000)
621
    def storage_read_sectors_md(self, volume, sector, count, size = 100000, addr = None):
621
    def storage_read_sectors_md(self, volume, sector, count, size = 0x100000, addr = None):
622
        """ Read sectors from as storage device. If addr is not given it allocates a buffer itself. """
622
        """ Read sectors from as storage device. If addr is not given it allocates a buffer itself. """
623
        if addr is None:
623
        if addr is None:
624
            addr = self.malloc(size)
624
            addr = self.malloc(size)
625
            malloc = True
625
            malloc = True
626
        else:
626
        else:
Line 631... Line 631...
631
            if malloc == True:
631
            if malloc == True:
632
                self.free(addr)
632
                self.free(addr)
633
        if result.rc > 0x80000000:
633
        if result.rc > 0x80000000:
634
            raise DeviceError("storage_read_sectors_md(volume=%d, sector=%d, count=%d, addr=0x%08X) failed with RC 0x%08X" % (volume, sector, count, addr, rc))
634
            raise DeviceError("storage_read_sectors_md(volume=%d, sector=%d, count=%d, addr=0x%08X) failed with RC 0x%08X" % (volume, sector, count, addr, rc))
635
    
635
    
636
    def storage_write_sectors_md(self, volume, sector, count, size = 100000, addr = None):
636
    def storage_write_sectors_md(self, volume, sector, count, size = 0x100000, addr = None):
637
        """ Read sectors from as storage device. If addr is not given it allocates a buffer itself. """
637
        """ Read sectors from as storage device. If addr is not given it allocates a buffer itself. """
638
        if addr is None:
638
        if addr is None:
639
            addr = self.malloc(size)
639
            addr = self.malloc(size)
640
            malloc = True
640
            malloc = True
641
        else:
641
        else:
Line 663... Line 663...
663
        if result.size > 0x80000000:
663
        if result.size > 0x80000000:
664
            raise DeviceError("file_size(fd=%d) failed with RC=0x%08X, errno=%d" % (fd, result.size, self.errno()))
664
            raise DeviceError("file_size(fd=%d) failed with RC=0x%08X, errno=%d" % (fd, result.size, self.errno()))
665
        return result.size
665
        return result.size
666
    
666
    
667
    @command(timeout = 30000)
667
    @command(timeout = 30000)
668
    def file_read(self, fd, size = 100000, addr = None):
668
    def file_read(self, fd, size = 0x100000, addr = None):
669
        """ Reads data from a file referenced by a handle. If addr is not given it allocates a buffer itself. """
669
        """ Reads data from a file referenced by a handle. If addr is not given it allocates a buffer itself. """
670
        if addr is None:
670
        if addr is None:
671
            addr = self.malloc(size)
671
            addr = self.malloc(size)
672
            malloc = True
672
            malloc = True
673
        else:
673
        else:
Line 680... Line 680...
680
        if result.rc > 0x80000000:
680
        if result.rc > 0x80000000:
681
            raise DeviceError("file_read(fd=%d, addr=0x%08X, size=0x%08X) failed with RC=0x%08X, errno=%d" % (fd, addr, size, result.rc, self.errno()))
681
            raise DeviceError("file_read(fd=%d, addr=0x%08X, size=0x%08X) failed with RC=0x%08X, errno=%d" % (fd, addr, size, result.rc, self.errno()))
682
        return result.rc
682
        return result.rc
683
    
683
    
684
    @command(timeout = 30000)
684
    @command(timeout = 30000)
685
    def file_write(self, fd, size = 100000, addr = None):
685
    def file_write(self, fd, size = 0x100000, addr = None):
686
        """ Writes data from a file referenced by a handle. If addr is not given it allocates a buffer itself. """
686
        """ Writes data from a file referenced by a handle. If addr is not given it allocates a buffer itself. """
687
        if addr is None:
687
        if addr is None:
688
            addr = self.malloc(size)
688
            addr = self.malloc(size)
689
            malloc = True
689
            malloc = True
690
        else:
690
        else: