This project contains a QNX io-sock module implementation of Linux's SocketCAN.
SocketCAN is a Linux CAN implementation which lives in the networking layer. It was done this way so client queues and other mechanisms could be reused. In order to add this, a new address family AF_CAN was added. The main CAN protocol is CAN_RAW which allows you to communicate to can devices by using frames with read and write calls directly. There is also CAN_BCM but is not supported in this implementation.
The software included in this (delivery/repository/archive/release) is classified under the QNX Software Maturity Standard as Experimental Software. As defined in the QNX Development License Agreement (http://www.qnx.com/download/feature.html?programid=68651), Experimental Software represents early-stage deliverables intended for evaluation or proof-of-concept purposes. Experimental software is provided without one or more of the following:
- Formal requirements
- Formal design or architecture
- Formal testing
- Formal support
- Formal documentation
- Certifications of any type
- End-of-Life or End-of-Support policy
Additionally, this software is not monitored or scanned under our Cybersecurity Management Standard.
No warranties, guarantees, or claims are offered. Please refer to the QDL for more details about our support and maintenance policy for Experimental Software.
Each component contains a README.md explaining a bit about the component as well as how to use it.
SocketCAN must be cross compiled on your host. Self hosted builds are not currently supported
To build SocketCAN for QNX simply run the following command from the root directory
make
The module cannot currently be built due to requiring some internal hooks. We are working to remove this dependency on internal io-sock code and in the meantime have supplied a build module for aarch64 and x86_64. Once the dependency has been removed the remaining source will be released.
The remaining (not internal) source code is released for reference but can't be built.
QNX's SocketCAN implementation has been designed to be a drop in replacement for Linux's SocketCAN where possible but does have some differences. The main differences between Linux and our implementation is the way you set up and configure your devices.
As development continues we hope to have full support of SocketCAN, but are currently missing some features. This section details what is missing.
CAN_BCM is currently not supported nor planned for the future.
If you want to test out SocketCAN without affecting your existing network stack you can start a new io-sock instance with the following command. In this case /can is used for our alternative stack.
io-sock -m /data/home/qnxuser/mods-can.so -d /data/home/qnxuser/devs-can-vcan.so -o prefix=/canNow your SocketCAN stack should be created and you can run commands prefixed with SOCK=<stack_path>.
For example:
SOCK=/can ifconfigLoading a driver does not create any interfaces, so you need to create one before there is anything to read from or write to. This mirrors Linux, where you would run
ip link add dev vcan0 type vcan. For the vcan driver:
SOCK=/can ifconfig vcan0 createLeave the unit number off to have the next free one picked for you; the allocated name is printed:
SOCK=/can ifconfig vcan create
vcan1The device is removed again with destroy:
SOCK=/can ifconfig vcan0 destroyWith a device created you can run the samples against it:
SOCK=/can ./can-write
SOCK=/can ./can-readTo mount a driver to an existing stack use the following:
mount -T io-sock /data/home/qnxuser/devs-can-vcan.so