mirror of
https://github.com/linux-can/can-utils.git
synced 2026-09-22 08:06:34 +02:00
log asc converter: support len8_dlc for Classical CAN frames
The CANFD format in asc logfiles can be used to describe Classical CAN frame content too. As this CANFD format has two different elements to transport the payload length and the 'raw data length code' the new len8_dlc option now allows to support the full qualified conversion. Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
This commit is contained in:
@@ -327,6 +327,15 @@ void eval_canfd(char* buf, struct timeval *date_tvp, char timestamps, int dplace
|
||||
/* dlen is always 0 for classic CAN RTR frames
|
||||
but the DLC value is valid in RTR cases */
|
||||
cf.len = dlc;
|
||||
/* sanitize payload length value */
|
||||
if (dlc > CAN_MAX_DLEN)
|
||||
cf.len = CAN_MAX_DLEN;
|
||||
}
|
||||
/* check for extra DLC when having a Classic CAN with 8 bytes payload */
|
||||
if ((cf.len == CAN_MAX_DLEN) && (dlc > CAN_MAX_DLEN) && (dlc <= CAN_MAX_RAW_DLC)) {
|
||||
struct can_frame *ccf = (struct can_frame *)&cf;
|
||||
|
||||
ccf->len8_dlc = dlc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user