Subversion Repositories freemyipod

Rev

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

Rev 238 Rev 260
Line 341... Line 341...
341
 
341
 
342
    @command
342
    @command
343
    def uploadint(self, addr, integer):
343
    def uploadint(self, addr, integer):
344
        """
344
        """
345
            Uploads a single integer to the device
345
            Uploads a single integer to the device
346
            <offset>: the address to upload the integer to
346
            <addr>: the address to upload the integer to
347
            <data>: the integer to upload
347
            <integer>: the integer to upload
348
        """
348
        """
349
        addr = self._hexint(addr)
349
        addr = self._hexint(addr)
350
        integer = self._hexint(integer)
350
        integer = self._hexint(integer)
351
        if integer > 0xFFFFFFFF:
351
        if integer > 0xFFFFFFFF:
352
            raise ArgumentError("Specified integer too long")
352
            raise ArgumentError("Specified integer too long")
353
        data = chr(integer)
353
        data = struct.pack("I", integer)
354
        self.embios.write(addr, data)
354
        self.embios.write(addr, data)
355
        self.logger.info("Integer '"+self._hex(integer)+"' written successfully to "+self._hex(addr)+"\n")
355
        self.logger.info("Integer '"+self._hex(integer)+"' written successfully to "+self._hex(addr)+"\n")
356
 
356
 
357
    @command
357
    @command
358
    def downloadint(self, addr):
358
    def downloadint(self, addr):
359
        """
359
        """
360
            Downloads a single integer from the device and prints it to the console window
360
            Downloads a single integer from the device and prints it to the console window
361
            <addr>: the address to download the integer from
361
            <addr>: the address to download the integer from
362
        """
362
        """
363
        addr = self._hexint(addr)
363
        addr = self._hexint(addr)
364
        data = self.embios.read(addr, 1)
364
        data = self.embios.read(addr, 4)
365
        integer = ord(data)
365
        integer = struct.unpack("I", data)[0]
366
        self.logger.info("Integer '"+self._hex(integer)+"' read from address "+self._hex(addr)+"\n")
366
        self.logger.info("Integer '"+self._hex(integer)+"' read from address "+self._hex(addr)+"\n")
367
 
367
 
368
    @command
368
    @command
369
    def i2cread(self, bus, slave, addr, size):
369
    def i2cread(self, bus, slave, addr, size):
370
        """
370
        """