freemyipod r500 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r499‎ | r500 | r501 >
Date:00:26, 1 February 2011
Author:farthen
Status:new
Tags:
Comment:
libemcore: remove the test when called directly. This one was broken anyways and not really useful, too.
Modified paths:
  • /emcore/trunk/tools/libemcore.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/libemcore.py
@@ -1105,37 +1105,8 @@
11061106 if __name__ == "__main__":
11071107 from misc import Logger
11081108 logger = Logger()
1109 - if sys.argv[1] == "test":
1110 - # Some tests
1111 - import sys
1112 - emcore = Emcore()
1113 - resp = emcore.getversioninfo()
1114 - logger.log("Emcore device version information: " + libemcoredata.swtypes[resp.swtypeid] + " v" + str(resp.majorv) + "." + str(resp.minorv) +
1115 - "." + str(resp.patchv) + " r" + str(resp.revision) + " running on " + libemcoredata.hwtypes[resp.hwtypeid] + "\n")
1116 - resp = emcore.getusermemrange()
1117 - logger.log("Usermemrange: "+hex(resp.lower)+" - "+hex(resp.upper)+"\n")
1118 - memaddr = resp.lower
1119 - maxlen = resp.upper - resp.lower
1120 - f = open("./emcore.py", "rb")
1121 - logger.log("Loading test file (emcore.py) to send over USB...\n")
1122 - datastr = f.read()[:maxlen]
1123 - logger.log("Sending data...\n")
1124 - emcore.write(memaddr, datastr)
1125 - logger.log("Encrypting data with the hardware key...\n")
1126 - emcore.aesencrypt(memaddr, len(datastr), 0)
1127 - logger.log("Reading data back and saving it to 'libemcore-test-encrypted.bin'...\n")
1128 - f = open("./libemcore-test-encrypted.bin", "wb")
1129 - f.write(emcore.read(memaddr, len(datastr)))
1130 - logger.log("Decrypting the data again...\n")
1131 - emcore.aesdecrypt(memaddr, len(datastr), 0)
1132 - logger.log("Reading data back from device...\n")
1133 - readdata = emcore.read(memaddr, len(datastr))
1134 - if readdata == datastr:
1135 - logger.log("Data matches!")
1136 - else:
1137 - logger.log("Data does NOT match. Something went wrong")
11381109
1139 - elif sys.argv[1] == "gendoc":
 1110+ if sys.argv[1] == "gendoc":
11401111 # Generates Documentation
11411112 from misc import gendoc
11421113 logger.log("Generating documentation\n")