linuxsocketcan

socketcan Candump - How Can I extend CAN ID?


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;