socketcan Candump – How Can I extend CAN ID?

Issue

I would like to receive the vehicle’s CAN data to the socket CAN and send it to the server. (raw data)

Accordingly, CAN ID is very important in post-processing raw data sent to the server.
The CAN data ID received by Candump and wireshark is only 3 digits, so it is difficult to distinguish which data it is.
For example, although the CAN ID I need to receive is 0x1f532d10, only d10 is received and displayed from socketcan.

Is there any way to get the ID length as a whole?

candump

Solution

If you’re using SocketCAN to send frames you need to set the "Extended Frame Format" bit in the can_id field of the can_frame struct, e.g.:

frame.can_id |= CAN_EFF_FLAG;

Answered By – Andreas Magnusson

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published