# README
socketcan-io4edge
Tools to connect io4edge CAN devices with the Linux socketcan stack.
Tool socketcan-io4edge
Connects an io4edge CANL2 instance with a virtual socket CAN. All frames from io4edge CAN device will be published on virtual CAN and vice versa.
e.g.
$ socketcan-io4edge MIO04-1-can vcan0
Tool socketcan-io4edge-runner
Watches the network for io4edge CAN devices and automatically starts socketcan-io4edge
processes to connect them with a virtual socket CAN network with a matching name, if one exists. It also watches the virtual can link instances for state changes and reacts accordingly (starts and stops socketcan-io4edge
processes when link changes up/down).
This program is typically started as a systemd-service.
The virtual socket CAN network must be named according to the MDNS instance names of the io4edge CAN device.
E.g. if the io4edge CAN instance name is MIO04-1-can
, the virtual Socket CAN device must have been named vcanMIO4-1
(without -can
). Because network interface names can have only max. 15 characters, but io4edge instance names can be longer, socketcan-io4edge-runner
strips longer device names to 15 characters, while preserving the beginning and end of the instance name. Examples:
- Instance Name
S101-IOU04-USB-EXT-1-can
-> vcan namevcanS101xxEXT-1
- Instance Name
123456789012-can
-> vcan namevcan1234xx89012
Typical usage
Assuming you have an io4edge CAN device with instance name MYDEV-can
.
In a first shell:
$ sudo socketcan-io4edge-runner /usr/bin/socketcan-io4edge
In a second shell:
$ sudo ip link add dev vcanMYDEV type vcan
$ sudo ip link set up vcanMYDEV
$ cangen vcanMYDEV
# -> Frames are sent by io4edge device
# dump frames including errors from io4edge device
$./candump vcanMYDEV vcanMYDEV,1FFFFFFF:1FFFFFFF,#FFFFFFFF -e