# HG changeset patch # User Laurent Bessard # Date 1364342282 -3600 # Node ID 13c9ff7f3b54b3724d556e5e0cdb03bfc09f77cc # Parent 73360d0bacbc961a8dd9f739e4dfc66ea81d0eb3# Parent 6e36ecf3f622b30fcab08b32636df00da3aebbc3 Merged diff -r 6e36ecf3f622 -r 13c9ff7f3b54 LPCconnector/LPCAppProto.py --- 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)