Running X on a Logitech G19 LCD

The Logitech G19 keyboard is a gaming keyboard that has extra keys and a built-in LCD color display. Its display is small and its resolution is rather low (320x240 pixels), but it's enough to do a lot of useful and cool things, considering it's connected with USB 2.0.

The following instructions describe the installation of the kernel driver and the setup of a secondary X server. While it should be possible to use your existing X server to handle the G19 LCD in addition to your screen(s), there are advantages on using a separate X server. For example, you can start/stop/restart the G19 X while your main X is running.

Kernel Preparation
The official linux kernel does not have support for the G19 yet. However, you can get a working driver from github:

But before installing it you must make sure your kernel has CONFIG_FB_DEFERRED_IO set. If it's already set for you, you may skip this part.

There isn't a way to directly set this from the kernel makemenu, but I did manage to enable it by enabling something that selects it:

Please note this driver isn't really needed, it's just a hackish way to select CONFIG_FB_DEFERRED_IO through makemenu. If you know of a better way, please add it here.

Now you will need to compile the new kernel image and install it. Making just the modules isn't enough as you have changed CONFIG_FB_DEFERRED_IO. Don't reboot yet.

Installing the lg4l driver
If you haven't set CONFIG_FB_DEFERRED_IO as described above, you will get an error while compiling. If everything is ok, move on.

Installing fbdev
You will also need fbdev to run X later:

You may now reboot.

After rebooting
As per the lg4l README, you may:

but the device will still be grabbed by the generic driver. You must run

located in the lg4l source tree to put the new module in control of the device (you may want to automate this).

Secondary X server
The following method is based on the DisplayLink wiki page. In it, it says you need x11-drivers/xf86-input-void to make it work but I haven't installed it and it all works fine. If it doesn't work for you, follow the instructions on the DisplayLink page.

If you need to switch keyboard/mouse focus to the LCD screen, you will need x2x. If you know what you are doing and plan to just open apps in the G19 LCD, then you won't need x2x.

xorg.conf.g19
Create this file in /etc/X11/ and name it xorg.conf.g19:

.xinitrc2
Next we create the ~/.initrc2 for our G19 display. Create and customize the file to your needs, here is an example:

Please note the commands there will only affect your G19 display, not your main X.

g19lcd.sh
This is the actual script that starts the second instance of xorg-server. Make it executeable and save it somewhere in your home folder, in this example we save it to ~/.g19lcd.sh