freemyipod r86 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r85‎ | r86 | r87 >
Date:23:39, 10 August 2010
Author:benedikt93
Status:new
Tags:
Comment:
fix embios.py
Modified paths:
  • /embios/trunk/tools/embios.py (modified) (history)

Diff [purge]

Index: embios/trunk/tools/embios.py
@@ -158,7 +158,7 @@
159159 print " killthread <threadid>"
160160 print " Kills the thread with thread ID <threadid>"
161161 print ""
162 - print " createthread <namepointer> <entrypoint> <stackpointer> <stacksize>, <type> <priority> <state>"
 162+ print " createthread <namepointer> <entrypoint> <stackpointer> <stacksize> <type> <priority> <state>"
163163 print " Creates a new thread and returns its thread ID"
164164 print " <namepointer> a pointer to the thread's name"
165165 print " <entrypoint> a pointer to the entrypoint of the thread"
@@ -185,51 +185,51 @@
186186
187187 elif argv[1] == "reset":
188188 if len(argv) != 3: usage()
189 - dev.reset(int(argv[2]))
 189+ dev.reset(int(argv[2]), 16)
190190
191191 elif argv[1] == "poweroff":
192192 if len(argv) != 3: usage()
193 - dev.poweroff(int(argv[2]))
 193+ dev.poweroff(int(argv[2]), 16)
194194
195195
196196 elif argv[1] == "uploadfile":
197197 if len(argv) < 4 or len(argv) > 6: usage()
198198 if len(argv) > 4:
199 - usedma = argv[4]
 199+ usedma = int(argv[4], 16)
200200 if len(argv) > 5:
201 - freezesched = argv[5]
 201+ freezesched = int(argv[5], 16)
202202 else:
203203 freezesched = 0
204204 else:
205205 freezesched = 0
206206 usedma = 1
207 - dev.uploadfile(int(argv[2]), argv[3], usedma, freezesched)
 207+ dev.uploadfile(int(argv[2], 16), argv[3], usedma, freezesched)
208208
209209 elif argv[1] == "downloadfile":
210210 if len(argv) < 5 or len(argv) > 7: usage()
211211 if len(argv) > 5:
212 - usedma = argv[5]
 212+ usedma = int(argv[5], 16)
213213 if len(argv) > 6:
214 - freezesched = argv[6]
 214+ freezesched = int(argv[6], 16)
215215 else:
216216 freezesched = 0
217217 else:
218218 freezesched = 0
219219 usedma = 1
220 - dev.downloadfile(int(argv[2]), int(argv[3]), argv[4], usedma, freezesched)
 220+ dev.downloadfile(int(argv[2], 16), int(argv[3], 16), argv[4], usedma, freezesched)
221221
222222 elif argv[1] == "uploadint":
223223 if len(argv) != 4: usage()
224 - dev.uploadint(int(argv[2]), int(argv[3]))
 224+ dev.uploadint(int(argv[2], 16), int(argv[3], 16))
225225
226226 elif argv[1] == "downloadint":
227227 if len(argv) != 3: usage()
228 - dev.downloadint(int(argv[2]))
 228+ dev.downloadint(int(argv[2], 16))
229229
230230
231231 elif argv[1] == "i2cread":
232232 if len(argv) != 6: usage()
233 - dev.i2crecv(int(argv[2]), int(argv[3]), int(argv[4]), int(argv[5]))
 233+ dev.i2crecv(int(argv[2], 16), int(argv[3], 16), int(argv[4], 16), int(argv[5], 16))
234234
235235 elif argv[1] == "i2csend":
236236 if len(argv) < 6: usage()
@@ -236,15 +236,15 @@
237237 data = ""
238238 ptr = 5
239239 while ptr < len(argv):
240 - data += struct.pack("<B", int(argv[ptr]))
 240+ data += struct.pack("<B", int(argv[ptr], 16))
241241 ptr += 1
242 - dev.i2csend(int(argv[2]), int(argv[3]), int(argv[4]), data)
 242+ dev.i2csend(int(argv[2], 16), int(argv[3], 16), int(argv[4], 16), data)
243243
244244
245245 elif argv[1] == "readusbconsole":
246246 if len(argv) not in [4, 5]: usage()
247247 if len(argv) == 4: argv[4] = ""
248 - dev.readusbcon(int(argv[2]), argv[3], argv[4])
 248+ dev.readusbcon(int(argv[2], 16), argv[3], argv[4])
249249
250250 elif argv[1] == "writeusbconsole":
251251 if len(argv) < 4: usage()
@@ -254,11 +254,11 @@
255255 data = f.read()
256256
257257 if len(argv) > 4:
258 - offset = int(argv[4])
 258+ offset = int(argv[4], 16)
259259 else:
260260 offset = 0
261261 if len(argv) > 5:
262 - size = int(argv[5])
 262+ size = int(argv[5], 16)
263263 else:
264264 size = len(data)
265265 if len(argv) > 6: usage()
@@ -269,7 +269,7 @@
270270 data = ""
271271 ptr = 3
272272 while ptr < len(argv):
273 - data += struct.pack("<I", int(argv[ptr]))
 273+ data += struct.pack("<I", int(argv[ptr], 16))
274274 ptr += 1
275275 dev.writeusbcon(data)
276276
@@ -276,7 +276,7 @@
277277 elif argv[1] == "readdevconsole":
278278 if len(argv) not in [5, 6]: usage()
279279 if len(argv) == 5: argv[5] = ""
280 - dev.readusbcon(int(argv[2]), int(argv[3]), argv[4], argv[5])
 280+ dev.readusbcon(int(argv[2], 16), int(argv[3], 16), argv[4], argv[5])
281281
282282 elif argv[1] == "writedevconsole":
283283 if len(argv) < 5: usage()
@@ -286,33 +286,33 @@
287287 data = f.read()
288288
289289 if len(argv) > 5:
290 - offset = int(argv[5])
 290+ offset = int(argv[5], 16)
291291 else:
292292 offset = 0
293293 if len(argv) > 6:
294 - size = int(argv[6])
 294+ size = int(argv[6], 16)
295295 else:
296296 size = len(data)
297297 if len(argv) > 7: usage()
298298
299 - dev.writeusbcon(int(argv[3]), data, 0, offset, size)
 299+ dev.writeusbcon(int(argv[3], 16), data, 0, offset, size)
300300
301301 if argv[2] == "direct":
302302 data = ""
303303 ptr = 4
304304 while ptr < len(argv):
305 - data += struct.pack("<I", int(argv[ptr]))
 305+ data += struct.pack("<I", int(argv[ptr], 16))
306306 ptr += 1
307 - dev.writeusbcon(int(argv[3]), data)
 307+ dev.writeusbcon(int(argv[3], 16), data)
308308
309309 elif argv[1] == "flushconsolebuffers":
310310 if len(argv) != 3: usage()
311 - dev.flushconsolebuffers(int(argv[2]))
 311+ dev.flushconsolebuffers(int(argv[2], 16))
312312
313313
314314 elif argv[1] == "getprocessinformation" or argv[1] == "getprocinfo":
315315 if len(argv) != 4: usage()
316 - dev.getprocinfo(int(argv[2]), int(argv[3]))
 316+ dev.getprocinfo(int(argv[2], 16), int(argv[3], 16))
317317
318318 elif argv[1] == "lockscheduler":
319319 if len(argv) != 2: usage()
@@ -324,19 +324,19 @@
325325
326326 elif argv[1] == "suspendthread":
327327 if len(argv) != 3: usage()
328 - dev.suspendthread(1, int(argv[2]))
 328+ dev.suspendthread(1, int(argv[2], 16))
329329
330330 elif argv[1] == "resumethread":
331331 if len(argv) != 3: usage()
332 - dev.suspendthread(0, int(argv[2]))
 332+ dev.suspendthread(0, int(argv[2], 16))
333333
334334 elif argv[1] == "killthread":
335335 if len(argv) != 3: usage()
336 - dev.killthread(int(argv[2]))
 336+ dev.killthread(int(argv[2], 16))
337337
338338 elif argv[1] == "createthread":
339339 if len(argv) != 9: usage()
340 - dev.createthread(int(argv[2]), int(argv[3]), int(argv[4]), int(argv[5]), int(argv[6]), int(argv[7]), int(argv[8]))
 340+ dev.createthread(int(argv[2], 16), int(argv[3], 16), int(argv[4], 16), int(argv[5], 16), int(argv[6], 16), int(argv[7], 16), int(argv[8], 16))
341341
342342
343343 elif argv[1] == "flushcaches":