freemyipod r342 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r341‎ | r342 | r343 >
Date:21:06, 19 December 2010
Author:farthen
Status:new
Tags:
Comment:
libembios: cache version and device information
Modified paths:
  • /embios/trunk/tools/libembios.py (modified) (history)

Diff [purge]

Index: embios/trunk/tools/libembios.py
@@ -117,7 +117,14 @@
118118
119119 def getversioninfo(self):
120120 """ This returns the emBIOS version and device information. """
121 - return self.lib.monitorcommand(struct.pack("IIII", 1, 0, 0, 0), "IBBBBI", ("revision", "majorv", "minorv", "patchv", "swtypeid", "hwtypeid"))
 121+ resp = self.lib.monitorcommand(struct.pack("IIII", 1, 0, 0, 0), "IBBBBI", ("revision", "majorv", "minorv", "patchv", "swtypeid", "hwtypeid"))
 122+ self.lib.dev.version.revision = resp.revision
 123+ self.lib.dev.version.majorv = resp.majorv
 124+ self.lib.dev.version.minorv = resp.minorv
 125+ self.lib.dev.version.patchv = resp.patchv
 126+ self.lib.dev.swtypeid = resp.swtypeid
 127+ self.lib.dev.hwtypeid = resp.hwtypeid
 128+ return resp
122129
123130 def getpacketsizeinfo(self):
124131 """ This returns the emBIOS max packet size information.
@@ -132,7 +139,10 @@
133140
134141 def getusermemrange(self):
135142 """ This returns the memory range the user has access to. """
136 - return self.lib.monitorcommand(struct.pack("IIII", 1, 2, 0, 0), "III", ("lower", "upper", None))
 143+ resp = self.lib.monitorcommand(struct.pack("IIII", 1, 2, 0, 0), "III", ("lower", "upper", None))
 144+ self.lib.dev.usermem.lower = resp.lower
 145+ self.lib.dev.usermem.upper = resp.upper
 146+ return resp
137147
138148 def reset(self, force=False):
139149 """ Reboot the device """
@@ -531,11 +541,23 @@
532542 self.connect()
533543 self.findEndpoints()
534544
 545+
 546+ # Device properties
535547 self.packetsizelimit = {}
536548 self.packetsizelimit['cout'] = None
537549 self.packetsizelimit['cin'] = None
538550 self.packetsizelimit['dout'] = None
539551 self.packetsizelimit['din'] = None
 552+
 553+ self.version.revision = None
 554+ self.version.majorv = None
 555+ self.version.minorv = None
 556+ self.version.patchv = None
 557+ self.swtypeid = None
 558+ self.hwtypeid = None
 559+
 560+ self.usermem.lower = None
 561+ self.usermem.upper = None
540562
541563 def __del__(self):
542564 self.disconnect()