stardust
stardust

Reputation: 339

No active virtual can messages when using candump (SocketCAN)

I am playing with can-utils package, trying to run a virtual can device. Everything seems to work fine except there is no active messages. Candump and cansniffer works, because I send a message manually and it shows up.

Am I doing something wrong?

Here are the commands I run:

sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0
candump vcan0

I am using Ubuntu 16, Kernel 4.11.0

Upvotes: 3

Views: 2632

Answers (2)

abhishek patil
abhishek patil

Reputation: 11

This above answer is correct, here is an alternative solution. "cangen" continuously generates the random can data and this can seen using "candump" or "cansniffer".

But for test purpose or to send a particular CAN frame alternative to the above answer you can directly send the can message using command "cansend".

example: cansend vcan0 696#1111111111111111

CAN frame with identifier 696 and 8 bytes of data.

To see the output, you can use any of the commands(Make sure you have already run this below command and then the cansend command to see the output):

cansniffer vcan0

or

candump vcan0

Upvotes: 1

stardust
stardust

Reputation: 339

I have found out that I need to create traffic by myself using "cangen" command. So, here is complete guide to generate random virtual can traffic:

sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0
cangen vcan0

Last one is to create traffic. Now, if you try "candump" or "cansniffer", you will be able to see random generated traffic.

Upvotes: 3

Related Questions