Liftoff

Liftoff

View Stats:
Ryan Apr 15, 2018 @ 11:12am
How To Use Trainer Port in Linux Through Microphone Jack
I'm putting up these instructions on how to set up a Linux Mint or Ubuntu based computer to use your transmitters 3.5mm stereo trainer port by reading directly through the microphone port. In my searching, all I was able to find were instructions for emulating a joystick with an Arduino or Teensy, or using the Windows only software SmartPropoPlus.

Hopefully I'm not redoing someone else's work, and that these instructions work for you.

I'm assuming some familiarity with the Linux terminal, but I've tried not to skip any steps.

Overall, the process isn't too bad, but you are building your own kernel module and software from scratch, and running commands with root level access. Do something silly, and you can brick your system. You've been warned.

These instructions worked for me on a MSI laptop running Linux Mint 18.03 with a Turnigy 9XR transmitter. They should work without any changes for Ubuntu 16.04 and any other transmitter with a 3.5mm trainer port.

Installing the Driver

First, you need to install some dependencies to get the kernel module and the gui software associated with the module to install. Open a terminal and type copy in the following:

sudo apt-get install build-essential libgtk2.0-dev portaudio19-dev git

Next, clone the txppm GitHub repo. I forked my copy from nexx512's txppm[github.com] GitHub repo and made some changes to build the gui by default, and fix a problem with the kernel module on Ubuntu and Mint Linux distributions.


This module takes the signal coming on the microphone port and converts it to joystick output that can be picked up by Liftoff (or any other program that uses a joystick).

Compiling the Kernel Module

In your terminal, change into the module directory, build the kernel module and install it:

cd txppm/module make sudo make install

Compile the Software

This kernel module doesn't work on its own, you need to run the included software in parallel with Liftoff. I'm not sure if this is a bug in the driver, a bug in Liftoff, or intended behaviour.

The GUI software is easier to use, so we'll use that version.

From the terminal window (assuming your still in the module directory):

cd ../software make sudo make install

I get one warning with the build of the gui. This is safe to ignore.

Test the module

The module has been built, but the module isn't being loaded by default yet. If you try to run the software, it won't work. Before making the changes persistent, let's load the module manually and see if we run into any problems.

Start by loading the module:

sudo modprobe tx

You should see no output to the screen. To check if the module loaded correctly, you can run:

dmesg | tail

The last two lines should look like to following (ignoring the times):

[ 3442.005651] input: PPM Transmitter as /devices/virtual/input/input15 [ 3442.005742] tx: device /dev/tx created (major: 222 minor: 0)

This indicates the module loaded properly.

Now, plugin your transmitters training port to your sound card microphone plug using a male-male 3.5mm cable. On my Turnigy 9XR, the transmitter turns on right away.

Aside: You can remove the transmitter portion from the controller to save on battery. You won't need it for the simulator.

Try to run the ppm2tx-gui:

ppm2tx-gui

You'll have the option to select a sound device and a mixer. For my setup, default with no mixing worked fine. Keep the display checked for troubleshooting. Press start. You should see a window come up with bars showing the positions of several of your switches and all of you control sticks.

Keeping this window open, you should be able to start Liftoff and have it recognize the controller as a PPM controller. While this GUI program is running, you should be able to use the controller in any other software that supports joysticks as well. You may have to calibrate the controls in Liftoff manually the first time you use this driver. Mine were really mixed up.

Making the Module load persistent.

This step is optional, and I wouldn't recommend it if you want to use your microphone jack for actual recording in future.

You will need to add the name of the tx module to the /etc/modules file. To do this you need to add tx on it's own line to the file using a text editor in super user mode. This example will use nano as it's installed by default.

sudo nano /etc/modules

add the module name tx to a line of its own. Press CTRL-x to save, y to confirm save and finally enter to use the same filename.

Restart your computer.

How to Use (Do this before starting Liftoff)

Before starting to use your transmitter, you need to start the ppm2tx-gui software before it will be recognized by the computer and usable by liftoff.

To do this, open a terminal and type the following commands:

sudo modprobe tx ppm2tx-gui

The first command isn't necessary if you set up the module to automatically load on boot. You should see the GUI start up. Set it up as before (using the default sound device and appropriate mixer for your transmitter). Keep this program and the shell window behind it open while running Liftoff or any other software that uses a joystick to keep it sending data.



Last edited by Ryan; Apr 15, 2018 @ 11:17am