FlySky FS-i6 as PC Joystick

Markus | Updated Friday, October 18th 2019, 17:44

-- Let's pretend FlightGear is a model airplane simulator

Figure 1. FlightGear controlled using the FlySky FS-i6

In this post, I will explain how to use the FlySky FS-i6 RC remote control as a game controller / joystick on Linux. This post covers how to connect the FS-iA6B receiver to a computer and how to compile the driver and support software.

Hardware

The build process is straightforward. No soldering required. To get started, you will need to buy the following hardware:

First, connect the ground wire (usually black) of the serial adapter to the leftmost pin of the servo iBus interface. Then, connect the +5V power wire (usually red) to the middle pin on the iBus interface. Finally, the USB-UART converter's RX wire (usually white) needs to be connected to the rightmost pin. The TX wire on the adapter cable can be left open. In the end, it should look like this:

Figure 2. FS-iA6B cabling
Regarding the hardware, that is all we need. You can find the full pinout and more technical information on Nathan's blog [1].

Software

Update: Now Upstream

As of Linux Kernel version 5.4 and linuxconsole (inputattach) version 1.7.0, this driver is included in their respective upstream repositories. Therefore, the compiled version should already ship with your Linux distribution and you can go ahead and skip to "Usage" down below. Just be sure to use modprobe fsia6b and the inputattach command from your package repositories. If that doesn't work, you can still follow the manual build steps in this chapter and use it that way.

Manual Build

The next step is to compile the driver and support software.

First, make sure you have the following packets installed. Names in brackets indicate the Arch Linux packet names:

  • Basic development tools (base-devel, git)
  • Linux kernel headers (linux-headers), expected in /lib/modules/$(shell uname -r)/build
  • Optional: Joystick debugging tools (jstest, jstest-gtk)
Then, clone the linux-fsia6b git repository: git clone --recursive https://github.com/m42uko/linux-fsia6b --branch legacy and follow the instructions in the README.MD file to compile the driver and inputattach software. If any errors occur, scroll down to the Troubleshooting section.

Usage

To use the joystick, Linux first needs to know to which UART port the receiver is connected to. The quickest way to find this out is to connect the receiver dongle as the last device to your PC. It will now be at `/dev/ttyUSBx` with x being the largest suggested number.

Then, to verify that it is connected properly, turn on the remote and issue the following command: linuxconsole/utils/inputattach --baud 115200 --dump /dev/ttyUSBx. You should see many lines starting with 20 (x) 40 (@). If you get an invalid baud rate error, make sure you properly applied the patch to inputattach in the previous step. If the lines start differently, doublecheck the tty device number. In some cases, it may also be a ttyACMx.

If that worked, we can load the actual driver. For this, load the serio and newly created fsia6b kernel modules. Then, launch inputattach with the --fsia6b parameter:

$ sudo modprobe serio $ sudo insmod fsia6b.ko $ sudo ./linuxconsole/utils/inputattach --fsia6b /dev/ttyUSBx

This will create a new joystick input device. To test that it is detected properly, launch a software like jstest-gtk. The new controller should show up as "FS-iA6B iBus RC receiver". When you move the control sticks, the bar graphs should change accordingly.

Figure 3. jstest-gtk showing the FS-iA6B

From here on, just fire up your game and configure the controller. The wonderful thing about this remote control is that you can also set up custom response curves, which allow you to, for example, make the null region less sensitive than the outer regions. If you are daring enough, I recommend installing the modified firmware for the FS-i6 transmitter [2], which will give you the additional channels required for the switches. Here's an example of the controller settings in FlightGear [3]:

Figure 4. FlightGear joystick configuration window

That's it! Have fun playing with your new controller!

Troubleshooting

  • The inputs don't move: Make sure the receiver is bound to the remote control and that it is turned on.
  • Throttle is inverted in FlightGear: Go to "Functions Setup -> Reverse" on the remote and change channel 3 to inverted.
  • make[1]: *** /lib/modules/.../build: No such file or directory. Stop.: Make sure you have the kernel headers installed. Also, for other distributions than Arch, you may have to change the KDIR variable in the Makefile.

If you have any other questions or comments, feel free to contact me via email or social media. Also, don't hesitate to open a ticket on GitHub [4] if something isn't working as expected.

Demo Video

Here's a quick demo of the driver in action:

Embedded content has been disabled to protect your privacy.




or click here to allow them permanently,

or click here to watch the video on YouTube:
https://www.youtube.com/watch?v=W0Q7xPy274c



Please note that, by enabling this video, data is transferred
to YouTube LLC, and is subject to their privacy policy.


Sources:
    [1]: https://nathan.vertile.com/blog/2016/07/09/flysky-i6-radio-setup-and-hacking-guide/#ia6b-rx
    [2]: https://github.com/qba667/FlySkyI6
    [3]: http://home.flightgear.org/
    [4]: https://github.com/m42uko/linux-fsia6b


Tags: linux rc software