Skip to content

Commit 9ec05c6

Browse files
committed
IsoTp: return 0 and size=0 if nothing received within timeout
This is not an error. Sometimes we need just to poll IsoTp transport for non-periodic messages.
1 parent e9e8f28 commit 9ec05c6

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

firmware/controllers/can/isotp/isotp.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -364,10 +364,14 @@ int IsoTpRx::readTimeout(uint8_t *rxbuf, size_t *size, sysinterval_t timeout)
364364
if (!rxFifoBuf.get(rxmsg, timeout)) {
365365
// TODO: error codes
366366
if (isFirstFrame) {
367-
efiPrintf("IsoTp: rx timeout, nothing received");
368-
} else {
369-
efiPrintf("IsoTP: rx timeout, %d left to receive", waitingForNumBytes);
367+
// this is not an error
368+
//efiPrintf("IsoTp: rx timeout, nothing received");
369+
*size = 0;
370+
return 0;
370371
}
372+
373+
efiPrintf("IsoTP: rx timeout, %d left to receive", waitingForNumBytes);
374+
*size = buf - rxbuf;
371375
return -1;
372376
}
373377

0 commit comments

Comments
 (0)