freemyipod r123 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r122‎ | r123 | r124 >
Date:17:26, 13 August 2010
Author:cmwslw
Status:new
Tags:
Comment:
Fix uploadint and downloadint. Values weren't packed.
Modified paths:
  • /embios/trunk/tools/libembios.py (modified) (history)

Diff [purge]

Index: embios/trunk/tools/libembios.py
@@ -415,6 +415,7 @@
416416
417417 def uploadint(self, offset, data, silent = 0):
418418 self.__myprint("Uploading 0x%08x to 0x%08x..." % (data, offset), silent)
 419+ data = struct.pack('<I', data)
419420 self.write(offset, data, 0, 0)
420421 self.__myprint(" done\n", silent)
421422
@@ -422,7 +423,8 @@
423424 def downloadint(self, offset, silent = 0):
424425 self.__myprint("Downloading an integer from 0x%08x..." % (offset), silent)
425426 data = self.read(offset, 4, 0, 0)
426 - self.__myprint(" done\nValue was: 0x%08x\n" % (data), silent)
 427+ number = struct.unpack('<I', data)
 428+ self.__myprint(" done\nValue was: 0x%08x\n" % (number), silent)
427429
428430 return data
429431
@@ -966,4 +968,4 @@
967969 self.i2csend(0, 0xe6, 0x31, struct.pack("<B", 2), 1)
968970 self.__myprint(" done\n", silent)
969971 else: self.__myprint(" unsupported (%s)\n" % self.devtype2name(self.devtype), silent)
970 -
\ No newline at end of file
 972+