freemyipod r478 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r477‎ | r478 | r479 >
Date:03:25, 22 January 2011
Author:farthen
Status:new
Tags:
Comment:
emcore tools: fix missing newlines
Modified paths:
  • /emcore/trunk/tools/emcore.py (modified) (history)
  • /emcore/trunk/tools/libemcore.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/emcore.py
@@ -131,7 +131,7 @@
132132 try:
133133 self.emcore = libemcore.Emcore(loglevel = 2)
134134 except libemcore.DeviceNotFoundError:
135 - self.logger.error("No emCORE device found!")
 135+ self.logger.error("No emCORE device found!\n")
136136 exit(1)
137137 self.getinfo("version")
138138
@@ -149,17 +149,17 @@
150150 except ArgumentTypeError, e:
151151 usage(e, specific=func)
152152 except NotImplementedError:
153 - self.logger.error("This function is not implemented yet!")
 153+ self.logger.error("This function is not implemented yet!\n")
154154 except libemcore.DeviceError, e:
155 - self.logger.error(str(e))
 155+ self.logger.error(str(e) + "\n")
156156 except TypeError, e:
157157 # Only act on TypeErrors for the function we called, not on TypeErrors raised by another function.
158158 if str(e).split(" ", 1)[0] == func + "()":
159 - self.logger.error(usage("Argument Error in '" + func + "': Wrong argument count", specific=func))
 159+ self.logger.error(usage("Argument Error in '" + func + "': Wrong argument count", specific=func) + "\n")
160160 else:
161161 raise
162162 except libemcore.usb.core.USBError:
163 - self.logger.error("There is a problem with the USB connection.")
 163+ self.logger.error("There is a problem with the USB connection.\n")
164164 else:
165165 usage("No such command")
166166
@@ -231,7 +231,7 @@
232232 self.logger.info("Maximum packet sizes: \n command out: " + str(self.emcore.lib.dev.packetsizelimit.cout) + \
233233 "\n command in: " + str(self.emcore.lib.dev.packetsizelimit.cin) + \
234234 "\n data in: " + str(self.emcore.lib.dev.packetsizelimit.din) + \
235 - "\n data out: " + str(self.emcore.lib.dev.packetsizelimit.dout))
 235+ "\n data out: " + str(self.emcore.lib.dev.packetsizelimit.dout)+ "\n")
236236
237237 elif infotype == "usermemrange":
238238 resp = self.emcore.getusermemrange()
@@ -238,7 +238,7 @@
239239 self.logger.info("The user memory range is " + \
240240 self._hex(self.emcore.lib.dev.usermem.lower) + \
241241 " - " + \
242 - self._hex(self.emcore.lib.dev.usermem.upper - 1))
 242+ self._hex(self.emcore.lib.dev.usermem.upper - 1) + "\n")
243243
244244 else:
245245 raise ArgumentTypeError("one out of 'version', 'packetsize', 'usermemrange'", infotype)
@@ -564,7 +564,7 @@
565565 raise ArgumentError("File not readable. Does it exist?")
566566 with f:
567567 data = self.emcore.run(f.read())
568 - self.logger.info("Executed emCORE application as thread " + self._hex(data.thread))
 568+ self.logger.info("Executed emCORE application as thread " + self._hex(data.thread) + "\n")
569569
570570 @command
571571 def execimage(self, addr):
@@ -686,7 +686,7 @@
687687 self.logger.info("done\n")
688688 data = self.emcore.read(destination, sha1size)
689689 hash = ord(data)
690 - self.logger.info("The generated hash is "+self._hex(hash))
 690+ self.logger.info("The generated hash is "+self._hex(hash)+"\n")
691691
692692 @command
693693 def ipodnano2g_getnandinfo(self):
@@ -699,7 +699,7 @@
700700 self.logger.info("Number of banks: " + str(data["banks"])+"\n")
701701 self.logger.info("Number of blocks: " + str(data["blocks"])+"\n")
702702 self.logger.info("Number of user blocks: " + str(data["userblocks"])+"\n")
703 - self.logger.info("Pages per block: " + str(data["pagesperblock"]))
 703+ self.logger.info("Pages per block: " + str(data["pagesperblock"])+"\n")
704704
705705 @command
706706 def ipodnano2g_nandread(self, addr, start, count, doecc=True, checkempty=True):
@@ -848,7 +848,7 @@
849849 self.logger.info("Number of sectors: "+str(data["numsectors"])+"\n")
850850 self.logger.info("Vendor: "+data["vendor"]+"\n")
851851 self.logger.info("Product: "+data["product"]+"\n")
852 - self.logger.info("Revision: "+data["revision"])
 852+ self.logger.info("Revision: "+data["revision"]+"\n")
853853
854854 @command
855855 def readrawstorage(self, volume, sector, count, addr):
@@ -1094,7 +1094,7 @@
10951095 f = open(localname, 'rb')
10961096 except IOError:
10971097 raise ArgumentError("Could not open local file for reading.")
1098 - self.logger.info("Uploading file " + localname + " to " + remotename + "...")
 1098+ self.logger.info("Uploading file " + localname + " to " + remotename + "...\n")
10991099 fd = self.emcore.file_open(remotename, 0x15)
11001100 while True:
11011101 data = f.read(buffsize)
@@ -1194,9 +1194,9 @@
11951195 """ Changes the owner of the memory allocation <ptr> to the thread struct at addr <owner> """
11961196 ptr = self._hexint(ptr)
11971197 owner = self._hexint(owner)
1198 - self.logger.info("Changing owner of the memory region 0x%x to 0x%x" % (ptr, owner))
 1198+ self.logger.info("Changing owner of the memory region 0x%x to 0x%x\n" % (ptr, owner))
11991199 self.emcore.reownalloc(ptr, owner)
1200 - self.logger.info("Successfully changed owner of 0x%x to 0x%x" % (ptr, owner))
 1200+ self.logger.info("Successfully changed owner of 0x%x to 0x%x\n" % (ptr, owner))
12011201
12021202 @command
12031203 def free(self, ptr):
Index: emcore/trunk/tools/libemcore.py
@@ -876,7 +876,7 @@
877877 @command()
878878 def reownalloc(self, ptr, owner):
879879 """ Changes the owner of the memory allocation 'ptr' to the thread struct at addr 'owner' """
880 - self.logger.debug("Changing owner of the memory region 0x%x to 0x%x" % (ptr, owner))
 880+ self.logger.debug("Changing owner of the memory region 0x%x to 0x%x\n" % (ptr, owner))
881881 return self.lib.monitorcommand(struct.pack("IIII", 55, ptr, owner, 0), "III", (None, None, None))
882882
883883 @command()