Skip to content

Commit 7976823

Browse files
Fixes for IXXAT
recv() timeout is given in seconds Fix sending of remote messages
1 parent 70d8478 commit 7976823

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

can/interfaces/ixxat/canlib.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ def recv(self, timeout=None):
368368
# TODO: handling CAN error messages?
369369
if timeout is None:
370370
timeout = constants.INFINITE
371+
else:
372+
timeout = int(timeout * 1000)
371373

372374
tm = None
373375
if timeout == 0:
@@ -449,8 +451,8 @@ def send(self, msg, timeout=None):
449451
message.dwMsgId = msg.arbitration_id
450452
if msg.dlc:
451453
message.uMsgInfo.Bits.dlc = msg.dlc
452-
adapter = (ctypes.c_uint8 * msg.dlc).from_buffer(msg.data)
453-
ctypes.memmove(message.abData, adapter, msg.dlc)
454+
adapter = (ctypes.c_uint8 * len(msg.data)).from_buffer(msg.data)
455+
ctypes.memmove(message.abData, adapter, len(msg.data))
454456

455457
if timeout:
456458
_canlib.canChannelSendMessage(

0 commit comments

Comments
 (0)