From 5cef6d7aff4feea862f119823e6b33d72cb69a34 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Wed, 6 Nov 2013 18:46:23 +0100 Subject: [PATCH] Data bytes must not be converted to big endian I don't know why I did that before :-o --- latester/latester.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/latester/latester.c b/latester/latester.c index b0937ba..a2f4f18 100644 --- a/latester/latester.c +++ b/latester/latester.c @@ -251,8 +251,7 @@ unsigned calc_stuff_bits(struct can_frame *frame) { (!!(frame->can_id & CAN_RTR_FLAG)) << 6 | 0 << 4 | frame->can_dlc & 0xf; - bitmap[2] = htonl(((uint32_t*)frame->data)[0]); - bitmap[3] = htonl(((uint32_t*)frame->data)[1]); + memcpy(&bitmap[2], &frame->data, frame->can_dlc); start = 27; end = 64 + 8*frame->can_dlc; } else { @@ -265,8 +264,7 @@ unsigned calc_stuff_bits(struct can_frame *frame) { (!!(frame->can_id & CAN_RTR_FLAG)) << 6 | 0 << 4 | frame->can_dlc & 0xf; - bitmap[1] = htonl(((uint32_t*)frame->data)[0]); - bitmap[2] = htonl(((uint32_t*)frame->data)[1]); + memcpy(&bitmap[1], &frame->data, frame->can_dlc); start = 13; end = 32 + 8*frame->can_dlc; } -- 2.39.2