Skip to content

Companion Linux Build Instructions

Kjell Kernen edited this page Jan 22, 2014 · 3 revisions

Install Build Toolchain

You need to retrieve the following products ...

###Retrive packages on Ubuntu 11.04, 11.10, 12.04 All packages are retrieved by this command

sudo apt-get install subversion gcc-avr avr-libc avrdude build-essential ruby libqtcore4  libqt4-dev qt4-qmake g++ cmake libxerces-c-dev xsdcxx libsdl1.2-dev libusb-1.0-0 libphonon-dev phonon libqtwebkit-dev

###Retrieve packages on Fedora - qtwebkit perhaps needs to be added! On Fedora the following command retrieves all the needed packages

sudo yum install qt qt-devel cmake patch xsd svn gcc-c++ sdl-devel phonon phonon-devel

##Set up the source code tree structure The source code is hosted on GitHub. Fetch a copy of the latest stable version in a zip file.
You can naturally set up git and fetch branches that are under development, but that is outside of the scope of this tutorial.

Unzip the code package at a location of your liking.
Enter the opentx/companion folder and create a build folder here:

cd opentx/companion
mkdir lbuild

This folder is where you should build Companion. Building here avoids mixing temporary build files with the source code. ##Build Companion In order to be able to build Companion a Makefile has to be created. You have to select if you are going to build a debug or release version.
For a release version you enter:

cd lbuild
cmake ../src

Alternatively, for a debug version you enter:

cd lbuild
cmake  -D CMAKE_BUILD_TYPE=Debug ../src

In either case we are now ready to compile Companion

make clean
make

When the build process completes (with no show-stopping errors!) you will have a binary file named "companion".

You start Companion like this:

./companion

##Enable non-root use of USBASP programmer If you intend to use an USBASP device to communicate to Atmel equiped radios (the 9x and 9XR), you have to enable AVRDUDE to run without root priviliges.
If you do not do this you will always have to run Companion with root priviliges, which is not a good practice.
Plug in the programmer and run

lsusb | grep libusb

You should get a line like this:

Bus 003 Device 002: ID 16c0:05dc VOTI shared ID for use with libusb

Notice the two numbers after ID XXXX:YYYY
In next command replace XXXX and YYYY with the numbers.

sudo echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="XXXX", ATTR{idProduct}=="YYYY", GROUP="adm", MODE="0666"' > /etc/udev/rules.d/10-usbasp.rules

then execute

sudo restart udev

##Joystick support Companion does support joystick for firmware simulator control.
The latest version of SDL by default uses a device that cannot be calibrated properly by the OS.
To avoid problems use the following command before launching Companion:

export SDL_JOYSTICK_DEVICE=/dev/input/js0

Where js0 is your joystick / RC Sim adapter.
or write

SDL_JOYSTICK_DEVICE=/dev/input/js0

in /etc/environment

In Companion you will have two joysticks. Choose the first one.
If you experience calibration problems, have a look to the jscal utility.

calibrating:

jscal -c /dev/input/js0

directory for storing:

mkdir /var/lib/joystick

store the calibration:

jscal-store /dev/input/js0