--- a/LPCconnector/LPCAppProto.py Wed Mar 27 00:28:59 2013 +0100
+++ b/LPCconnector/LPCAppProto.py Wed Mar 27 00:58:02 2013 +0100
@@ -46,17 +46,14 @@
return None
def SendData(self, Data):
- length = len(Data)
- # transform length into a byte string
- # we presuppose endianess of LPC same as PC
- lengthstr = ctypes.string_at(ctypes.pointer(ctypes.c_int(length)),4)
- buffer = lengthstr + Data
- return self.pseudofile.write(buffer)
+ return self.pseudofile.write(Data)
def GetData(self):
lengthstr = self.pseudofile.read(4)
# transform a byte string into length
- length = ctypes.cast(ctypes.c_char_p(lengthstr), ctypes.POINTER(ctypes.c_int)).contents.value
+ length = ctypes.cast(
+ ctypes.c_char_p(lengthstr),
+ ctypes.POINTER(ctypes.c_uint32)).contents.value
return self.pseudofile.read(length)
def ExchangeData(self):
@@ -82,7 +79,12 @@
class SET_TRACE_VARIABLETransaction(LPCAppTransaction):
def __init__(self, data):
LPCAppTransaction.__init__(self, 0x04)
- self.Data = data
+ length = len(data)
+ # transform length into a byte string
+ # we presuppose endianess of LPC same as PC
+ lengthstr = ctypes.string_at(ctypes.pointer(ctypes.c_uint32(length)),4)
+ self.Data = lengthstr + data
+
def ExchangeData(self):
self.SendData(self.Data)