RealSimGear G1000 Suite, two displays and an audio panel installed into a black metal frame that mimics a cockpit for use with X-Plane.

Resolved RealSimGear Linux Driver Fails To Compile

  • Adam Douglas

I was doing a routine Arch Linux system update for a client on a flight simulator system I set up quite some time ago using X-Plane. The system updates all went well as expected until I attempted to recompile the RealSimGear CH34x Linux driver. Unfortunately it failed to compile, and I was left with the thought, “how am I going to fix this?”.

The Problem

The driver I am using for the hardware RealSimGear G1000 Suite PFD/MFD/GMA is supplied by RealSimGear RSG_CH34x_Linux_Driver.tar.gz v1.3. Each time the kernel is updated the driver needs to be recompiled. I tried to compile the driver, but received the following output.

# make
make -C /lib/modules/5.15.86-1-lts/build  M=/home/flightsim/Downloads/RSG_CH34x_Linux_Driver
make[1]: Entering directory '/usr/lib/modules/5.15.86-1-lts/build'
  CC [M]  /home/flightsim/Downloads/RSG_CH34x_Linux_Driver/ch34x.o
/home/flightsim/Downloads/RSG_CH34x_Linux_Driver/ch34x.c: In function ‘ch34x_close’:
/home/flightsim/Downloads/RSG_CH34x_Linux_Driver/ch34x.c:642:28: warning: unused variable ‘wait’ [-Wunused-variable]
  642 |         wait_queue_entry_t wait;
      |                            ^~~~
/home/flightsim/Downloads/RSG_CH34x_Linux_Driver/ch34x.c:641:14: warning: unused variable ‘timeout’ [-Wunused-variable]
  641 |         long timeout;
      |              ^~~~~~~
/home/flightsim/Downloads/RSG_CH34x_Linux_Driver/ch34x.c:640:13: warning: unused variable ‘bps’ [-Wunused-variable]
  640 |         int bps;
      |             ^~~
/home/flightsim/Downloads/RSG_CH34x_Linux_Driver/ch34x.c: At top level:
/home/flightsim/Downloads/RSG_CH34x_Linux_Driver/ch34x.c:1348:27: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
 1348 |         .write_room     = ch34x_write_room,
      |                           ^~~~~~~~~~~~~~~~
/home/flightsim/Downloads/RSG_CH34x_Linux_Driver/ch34x.c:1348:27: note: (near initialization for ‘ch34x_device.write_room’)
/home/flightsim/Downloads/RSG_CH34x_Linux_Driver/ch34x.c:1349:28: error: initialization of ‘unsigned int (*)(struct tty_struct *)’ from incompatible pointer type ‘int (*)(struct tty_struct *)’ [-Werror=incompatible-pointer-types]
 1349 |         .chars_in_buffer = ch34x_chars_in_buffer,
      |                            ^~~~~~~~~~~~~~~~~~~~~
/home/flightsim/Downloads/RSG_CH34x_Linux_Driver/ch34x.c:1349:28: note: (near initialization for ‘ch34x_device.chars_in_buffer’)
cc1: some warnings being treated as errors
make[2]: *** [scripts/Makefile.build:289: /home/flightsim/Downloads/RSG_CH34x_Linux_Driver/ch34x.o] Error 1
make[1]: *** [Makefile:1902: /home/flightsim/Downloads/RSG_CH34x_Linux_Driver] Error 2
make[1]: Leaving directory '/usr/lib/modules/5.15.86-1-lts/build'
make: *** [Makefile:7: default] Error 2

I’ve never written a driver before and nothing really stood out for me from the error messages that I could easily repair myself. I was at a cross road, and I wasn’t sure what direction to go.

Contact Support

At the time the client tried to reach RealSimGear tech support by phone, but unfortunately they were not available and was directed to send an email message instead. A message was left by the client to have tech support call him back. Later that day I decided to send an email into tech support myself since I was the one having to do that work and had the technical know how.

I received an email reply shortly, and I was told that RealSimGear has dropped support for Linux some time ago due to lack of Linux users. This was a response I was not expecting. There was no notice of this change and the hardware was intentional purchased due to it supporting Linux. The hardware was purchased less than 2 years ago, this doesn’t even seam like a reasonable support period. This isn’t hardware that is just a few hundred dollars. We are talking over $2,000 USD at the time of purchase. I was frustrated due to this response, but figured what can I do, but try and talk more. After some email messages exchanging back and forth I was happy to receive some direction on how to get the hardware driver working again using the native Linux kernel Arduino driver and a Bash script their developer provided me.

Solution

The instructions given by the developer was good, just not exactly clear for my exact use case since I was using Arch Linux and I wouldn’t imagine the developer was using that operating system. It took quite some time of trying different direction and installing a bunch of packages until I finally had a perspective that I should have taken from the start. You see there are a bunch of drivers that the Linux kernel supports, but not all of them are loaded by default. I found out that the driver I required was on the system already I just had to install it. Thanks to the priceless Arch Wiki article Kernel module and [Arduino]](https://wiki.archlinux.org/title/Arduino) I was able to take what I found, plus the script RealSimGear developer provided to register the USB device IDs and was able to make it all work again. It is very exciting to solve a problem and see things working again while learning more about Linux.

I wrote an entire article on how to make this all work over on my Knowledge Base called RealSimGear G1000 Suite Linux Install for those that are interested.

Conclusion

Though the solution sounds exciting I still concerned about it all. In the short term I am concerned that the X-Plane RealSimGear plugin will no longer work. As I understand it the plugin is what communicates from the driver to within X-Plane, so it understands what action to do. Basically a translator of sorts. I’m grateful for RealSimGear developer that provided the script, without that I doubt I would have fixed it. As for now the hardware is working with X-Plane 11 and the client is happy.

References