In my previous post I commented about the Cando device that I bought from Aliexpress.

Although it is described as a Cando, it is not related to the commercial CAN Analyzer CANdo, maybe the Chinese vendor did it to confuse the user. In fact it is a clone of the CANable device.

The CANable team created a nice interface to use the device, it is called “cangaroo”:
https://canable.io/getting-started.html#cangaroo

They have an executable program for Windows, but don’t have a pre-compiled version for Linux.

Here I’ll describe the steps to do it:

$ git clone https://github.com/normaldotcom/cangaroo
$ sudo apt-get install build-essential git qt5-qmake qtbase5-dev libnl-3-dev libnl-route-3-dev
$ sudo apt install libqt5charts5-dev
$ cd cangaroo
$ qmake -qt=qt5
$ make

Probably it will fail if you care using a recent Linux kernel:

g++ -c -pipe -O2 -std=gnu++11 -Wall -W -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_CHARTS_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_XML_LIB -DQT_CORE_LIB -I. -isystem /usr/include/libnl3 -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCharts -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtXml -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I../build/moc -I../build/ui -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++ -o ../build/o/unix/SocketCanInterface.o driver/SocketCanDriver/SocketCanInterface.cpp
driver/SocketCanDriver/SocketCanInterface.cpp: In member function ‘virtual bool SocketCanInterface::readMessage(CanMessage&, unsigned int)’:
driver/SocketCanDriver/SocketCanInterface.cpp:428:28: error: ‘SIOCGSTAMPNS’ was not declared in this scope; did you mean ‘SIOCGSTAMP_OLD’?
428 | if (ioctl(_fd, SIOCGSTAMPNS, &ts_rcv) == 0) {
| ^~~~
| SIOCGSTAMP_OLD
driver/SocketCanDriver/SocketCanInterface.cpp:436:24: error: ‘SIOCGSTAMP’ was not declared in this scope; did you mean ‘SIOCSARP’?
436 | ioctl(_fd, SIOCGSTAMP, &tv_rcv);
| ^~~~ | SIOCSARP driver/SocketCanDriver/SocketCanInterface.cpp: In member function ‘virtual void SocketCanInterface::sendMessage(const CanMessage&)’: driver/SocketCanDriver/SocketCanInterface.cpp:396:9: warning: ignoring return value of ‘ssize_t write(int, const void*, size_t)’, declared with attribute warn_unused_result [-Wunused-result] 396 | ::write(_fd, &frame, sizeof(struct can_frame)); | ~^~~~~~~~~~~
make[1]: *** [Makefile:1298: ../build/o/unix/SocketCanInterface.o] Error 1

It is easy to fix, open the file SocketCanInterface.cpp :

$ vi src/driver/SocketCanDriver/SocketCanInterface.cpp

And add this header line:

#include <linux/sockios.h>

Then execute make again:

$ make

And you run the application this way:

$ ./bin/cangaroo

You can also copy it to /usr/local/bin to be able to call it from anyware:

$ sudo cp ./bin/cangaroo /usr/local/bin/