freemyipod r260 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r259‎ | r260 | r261 >
Date:03:18, 14 November 2010
Author:theseven
Status:new
Tags:
Comment:
embios.py: Fix uploadint/downloadint functions
Modified paths:
  • /embios/trunk/tools/embios.py (modified) (history)

Diff [purge]

Index: embios/trunk/tools/embios.py
@@ -343,14 +343,14 @@
344344 def uploadint(self, addr, integer):
345345 """
346346 Uploads a single integer to the device
347 - <offset>: the address to upload the integer to
348 - <data>: the integer to upload
 347+ <addr>: the address to upload the integer to
 348+ <integer>: the integer to upload
349349 """
350350 addr = self._hexint(addr)
351351 integer = self._hexint(integer)
352352 if integer > 0xFFFFFFFF:
353353 raise ArgumentError("Specified integer too long")
354 - data = chr(integer)
 354+ data = struct.pack("I", integer)
355355 self.embios.write(addr, data)
356356 self.logger.info("Integer '"+self._hex(integer)+"' written successfully to "+self._hex(addr)+"\n")
357357
@@ -361,8 +361,8 @@
362362 <addr>: the address to download the integer from
363363 """
364364 addr = self._hexint(addr)
365 - data = self.embios.read(addr, 1)
366 - integer = ord(data)
 365+ data = self.embios.read(addr, 4)
 366+ integer = struct.unpack("I", data)[0]
367367 self.logger.info("Integer '"+self._hex(integer)+"' read from address "+self._hex(addr)+"\n")
368368
369369 @command