|Friday, November 2nd 2018, 11:56||
-- Let's pretend FlightGear is a model airplane simulator
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.
The build process is straightforward. No soldering required. To get started, you will need to buy the following hardware:
- FlySky FS-i6 remote control (~45 $)
- FlySky FS-iA6B receiver (~10 $). Note: The cheaper FS-iA6 (no B) will not work.
- A USB-UART adapter cable (~2 $)
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: Regarding the hardware, that is all we need. You can find the full pinout and more technical information on Nathan's blog .
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)
git clone --recursive https://github.com/m42uko/linux-fsia6band 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.
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:
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.
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 , which will give you the additional channels required for the switches. Here's an example of the controller settings in FlightGear :
That's it! Have fun playing with your new controller!
- 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: *** /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  if something isn't working as expected.