Subversion Repositories freemyipod

Rev

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

Rev 516 Rev 517
Line 615... Line 615...
615
        if state != 0: self.logger.debug("Enabling FAT flushing\n")
615
        if state != 0: self.logger.debug("Enabling FAT flushing\n")
616
        else: self.logger.debug("Disabling FAT flushing\n")
616
        else: self.logger.debug("Disabling FAT flushing\n")
617
        self.lib.monitorcommand(struct.pack("IIII", 58, state, 0, 0), "III", (None, None, None))
617
        self.lib.monitorcommand(struct.pack("IIII", 58, state, 0, 0), "III", (None, None, None))
618
        if state != 0: self.logger.debug("Enabled FAT flushing\n")
618
        if state != 0: self.logger.debug("Enabled FAT flushing\n")
619
        else: self.logger.debug("Disabled FAT flushing\n")
619
        else: self.logger.debug("Disabled FAT flushing\n")
620
 
620
    
621
    @command(timeout = 30000)
621
    @command(timeout = 30000)
622
    def file_open(self, filename, mode):
622
    def file_open(self, filename, mode):
623
        """ Opens a file and returns the handle """
623
        """ Opens a file and returns the handle """
624
        self.logger.debug("Opening remote file %s with mode %d\n" % (filename, mode))
624
        self.logger.debug("Opening remote file %s with mode %d\n" % (filename, mode))
625
        result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(filename), 30, mode, 0, 0, filename, 0), "III", ("fd", None, None))
625
        result = self.lib.monitorcommand(struct.pack("IIII%dsB" % len(filename), 30, mode, 0, 0, filename, 0), "III", ("fd", None, None))
Line 900... Line 900...
900
    @command()
900
    @command()
901
    def free_all(self):
901
    def free_all(self):
902
        """ Frees all memory allocations created by the monitor thread """
902
        """ Frees all memory allocations created by the monitor thread """
903
        self.logger.debug("Freeing all memory allocations created by the monitor thread\n")
903
        self.logger.debug("Freeing all memory allocations created by the monitor thread\n")
904
        return self.lib.monitorcommand(struct.pack("IIII", 57, 0, 0, 0), "III", (None, None, None))
904
        return self.lib.monitorcommand(struct.pack("IIII", 57, 0, 0, 0), "III", (None, None, None))
905
    
905
 
906
 
906
 
907
class Lib(object):
907
class Lib(object):
908
    def __init__(self, logger):
908
    def __init__(self, logger):
909
        self.logger = logger
909
        self.logger = logger
910
        self.logger.debug("Initializing Lib object\n")
910
        self.logger.debug("Initializing Lib object\n")
Line 964... Line 964...
964
        self.logger = logger
964
        self.logger = logger
965
        self.logger.debug("Initializing Dev object\n")
965
        self.logger.debug("Initializing Dev object\n")
966
        
966
        
967
        self.interface = 0
967
        self.interface = 0
968
        self.timeout = 100
968
        self.timeout = 100
969
 
969
        
970
        self.connect()
970
        self.connect()
971
        self.findEndpoints()
971
        self.findEndpoints()
972
        
972
        
973
        self.logger.debug("Successfully connected to device\n")
973
        self.logger.debug("Successfully connected to device\n")
974
        
974