| Index: embios/trunk/tools/libembios.py |
| — | — | @@ -421,7 +421,7 @@ |
| 422 | 422 |
|
| 423 | 423 | def downloadint(self, offset, silent = 0):
|
| 424 | 424 | self.__myprint("Downloading an integer from 0x%08x..." % (offset), silent)
|
| 425 | | - data = self.read(offset, 0, 0)
|
| | 425 | + data = self.read(offset, 4, 0, 0)
|
| 426 | 426 | self.__myprint(" done\nValue was: 0x%08x\n" % (data), silent)
|
| 427 | 427 |
|
| 428 | 428 | return data
|
| — | — | @@ -498,7 +498,7 @@ |
| 499 | 499 | response = self.__getbulk(self.handle, self.__cinep, blocklen + 0x10)
|
| 500 | 500 | self.__checkstatus(response)
|
| 501 | 501 |
|
| 502 | | - readbytes, buffersize, bytesleft = struct.unpack("<III", response[:12])
|
| | 502 | + readbytes, buffersize, bytesleft = struct.unpack("<III", response[4:])
|
| 503 | 503 | out_data += response[0x10:0x10+readbytes]
|
| 504 | 504 | size -= blocklen
|
| 505 | 505 |
|
| — | — | @@ -565,7 +565,7 @@ |
| 566 | 566 | response = self.__getbulk(self.handle, self.__cinep, 0x10)
|
| 567 | 567 | self.__checkstatus(response)
|
| 568 | 568 |
|
| 569 | | - sendbytes = struct.unpack("<I", response[4:8])[0]
|
| | 569 | + sendbytes = struct.unpack("<I", response[4:])[0]
|
| 570 | 570 | if sendbytes < blocklen: # not everything has been written, need to resent some stuff but wait a bit before doing so
|
| 571 | 571 | time.sleep(0.1)
|
| 572 | 572 | timeoutcounter += 1
|
| — | — | @@ -617,7 +617,7 @@ |
| 618 | 618 | response = self.__getbulk(self.handle, self.__cinep, blocklen + 0x10)
|
| 619 | 619 | self.__checkstatus(response)
|
| 620 | 620 |
|
| 621 | | - readbytes = struct.unpack("<III", response[4:8])[0]
|
| | 621 | + readbytes = struct.unpack("<III", response[4:])[0]
|
| 622 | 622 | out_data += response[0x10:0x10+readbytes]
|
| 623 | 623 | size -= blocklen
|
| 624 | 624 |
|
| — | — | @@ -749,10 +749,10 @@ |
| 750 | 750 | response = self.__getbulk(self.handle, self.__cinep, 0x10)
|
| 751 | 751 | self.__checkstatus(response)
|
| 752 | 752 |
|
| 753 | | - if (struct.unpack("<i", response[4:8]) < 0):
|
| 754 | | - self.__myprint(" failed, error code: 0x%x" % (struct.unpack("<i", response[4:8])), silent)
|
| | 753 | + if (struct.unpack("<i", response[4:8])[0] < 0):
|
| | 754 | + self.__myprint(" failed, error code: 0x%x" % (struct.unpack("<i", response[4:8])[0]), silent)
|
| 755 | 755 | else:
|
| 756 | | - self.__myprint(" done\n, thread ID: 0x%x" % (struct.unpack("<I", response[4:8])), silent)
|
| | 756 | + self.__myprint(" done\n, thread ID: 0x%x" % (struct.unpack("<I", response[4:8])[0]), silent)
|
| 757 | 757 |
|
| 758 | 758 |
|
| 759 | 759 | def getprocinfo(self, silent = 0):
|
| — | — | @@ -770,7 +770,7 @@ |
| 771 | 771 | while ptr < len(processinfo):
|
| 772 | 772 | retval.append({})
|
| 773 | 773 |
|
| 774 | | - retval[process_n]['regs'] = struct.unpack("<IIIIIIIIIIIIIIII", processinfo[ptr:])[0]
|
| | 774 | + retval[process_n]['regs'] = struct.unpack("<IIIIIIIIIIIIIIII", processinfo[ptr:])
|
| 775 | 775 | ptr += 16 * 0x4
|
| 776 | 776 | retval[process_n]['cpsr'] = struct.unpack("<I", processinfo[ptr:])[0]
|
| 777 | 777 | ptr += 1 * 0x4
|
| — | — | @@ -860,11 +860,11 @@ |
| 861 | 861 |
|
| 862 | 862 | # reading loop
|
| 863 | 863 | while (offset < size):
|
| 864 | | - self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 15, offset, size, 0))
|
| 865 | | - response = self.__getbulk(self.handle, self.__cinep, size + 0x10)
|
| | 864 | + self.handle.bulkWrite(self.__coutep, struct.pack("<IIII", 15, offset, blocklen, 0))
|
| | 865 | + response = self.__getbulk(self.handle, self.__cinep, blocklen + 0x10)
|
| 866 | 866 | self.__checkstatus(response)
|
| 867 | 867 |
|
| 868 | | - size = struct.unpack("<I", response[8:12])[0]
|
| | 868 | + size = struct.unpack("<I", response[8:])[0]
|
| 869 | 869 |
|
| 870 | 870 | if size <= offset + blocklen:
|
| 871 | 871 | procinfo += response[0x10:0x10 + size]
|
| — | — | @@ -901,9 +901,9 @@ |
| 902 | 902 | response = self.__getbulk(self.handle, self.__cinep, 0x10)
|
| 903 | 903 | self.__checkstatus(response)
|
| 904 | 904 |
|
| 905 | | - self.__myprint(" done\n execimage() return code: 0x%08x\n" % struct.unpack("<I", response[4:8]), silent)
|
| | 905 | + self.__myprint(" done\n execimage() return code: 0x%08x\n" % struct.unpack("<I", response[4:])[0], silent)
|
| 906 | 906 |
|
| 907 | | - return struct.unpack("<I", response[4:8])
|
| | 907 | + return struct.unpack("<I", response[4:])[0]
|
| 908 | 908 |
|
| 909 | 909 |
|
| 910 | 910 | #=====================================================================================
|