Tag/tag.png

Content Cleanup Required
This article should be cleaned-up to follow the content standards in the Wiki Guide. More info...

This content is quite old and may not be applicable to current versions of Ubuntu. If you use 9.04 like I do you will find all packages are in Synaptic package manager, no need to download the source and compile or just do a "sudo apt-get install g15stats" (please remove this note if the page is updated)

Introduction

This will walk you through the process of installing and configuring your Logitech G15 keyboard in Ubuntu. After doing this, you will be able to use the LCD display and all of the special keys will work just like normal keys that you can bind shortcuts to. To do this, you will need to do three things: download and install drivers so that Ubuntu recognizes the LCD and extra keys, add symbols to X so that the extra keys exist in X, and bind the extra keys on the G15 to the symbols you created.

Installing G15 drivers with G15tools

Note: In Intrepid Ibex compiling is no longer required. All you need to do is load the uinput module (see instructions below) and install the g15daemon package (sudo apt-get install g15daemon).

First, install the required libraries: libusb and libdaemon, and if not allready installed the build-essentials package.

sudo apt-get install libusb-dev libdaemon-dev build-essential

Download libg15, G15Composer, and libG15Render from http://g15tools.sourceforge.net/, and G15daemon http://sourceforge.net/projects/g15daemon/ . Extract the packages to their own directory, change to that directory, compile and install the files. You must install libg15 and libG15Render first. In each directory, run the following to compile and install the files. To do this, run the following in the directory that you put the files you downloaded:

tar -xjvf <file>
cd <directory that it extracted into>
./configure
make
sudo make install

If you see an error while running ./configure, make a note of what it said was missing before it failed. This is most likely the name of a program or library that you need to install. You can open up the Synaptic Package Manager in the System->Administration menu and search for that file. You will most likely want to install the one that ends in -dev.

Repeat this for every package that you want to install, making sure to go in the order specified above. Once you have done this, it is safe to delete the .tar.bz2 files as well as the directories you made; the programs have been installed and you do not need the source anymore.

Now load the uinput module and set it to load when you start the computer:

sudo modprobe uinput

Run gksudo gedit /etc/modules and add uinput to the list.

After you've done this, run sudo g15daemon. If you see a clock appear on the LCD screen, it is working properly. If not, refer to the Troubleshooting section below. To set g15daemon to run automatically at startup, edit the sudoers file by running the following:

sudo visudo

Add the following line to the bottom of the file -

ALL ALL= NOPASSWD: /usr/sbin/g15daemon

Warning: If visudo complains about syntax errors when you exit the program, do not ignore them! Go back and look at the file and see what went wrong. If you mess up the sudoers file you might not be able to run sudo at all, which you'll need a LiveCD to fix.

After you have done this, add g15daemon to your session by going to menus System -> Preferences -> Sessions, selecting New under the Startup Programs tab, and adding one with the name G15Daemon and the command sudo /usr/sbin/g15daemon.

Troubleshooting

Whilst trying to build the g15daemon you get an error that says:

In function ‘open’,
    inlined from ‘uf_conf_write’ at utility_funcs.c:359:
/usr/include/bits/fcntl2.h:51: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT in second argument needs 3 arguments

Open g15daemon/utility_funcs.cs and find the line (in this case 359)

config_fd = open(filename,O_CREAT|O_RDWR|O_TRUNC);

add the parameter S_IRUSR|S_IWUSR to the end so the line looks like this:

config_fd = open(filename,O_CREAT|O_RDWR|O_TRUNC,S_IRUSR|S_IWUSR);

If you get an error that says:

g15daemon: error while loading shared libraries: libg15.so.1: cannot open shared object file: No such file or directory

(same error can occur with libg15render.so.1 in place of libg15.so.1)

You need to run gksudo gedit /etc/ld.so.conf and add /usr/local/lib at the top of the file. Then run

sudo ldconfig

That should fix the problem, try running the daemon again.

Adding key symbols to X

It is possible to use your newly accessible G15 keys in Ubuntu by going to:

System>Preferences>Keyboard>Layouts

and selecting "Logitech G15 extra keys via G15daemon" under "keyboard model".

An alternative method follows: To add the symbols required to represent the special keys, run gksudo gedit /usr/share/X11/XKeysymDB and add the following lines after the comment at the beginning -

G1                      :15000001
G2                      :15000002
G3                      :15000003
G4                      :15000004
G5                      :15000005
G6                      :15000006
G7                      :15000007
G8                      :15000008
G9                      :15000009
G10                     :15000010
G11                     :15000011
G12                     :15000012
G13                     :15000013
G14                     :15000014
G15                     :15000015
G16                     :15000016
G17                     :15000017
G18                     :15000018
M1                      :15000019
M2                      :1500001A
M3                      :1500001B
LCD0                    :1500001D
LCD1                    :1500001E
LCD2                    :1500001F
LCD3                    :15000020
LCD4                    :15000021
MR                      :15000022

Request - Can someone who is more experienced with this file tell me if these hex codes are good? I don't know if there's a list of reserved codes somewhere.

Save this file, and move on to the next section. If you upgrade your X server, you may have to re-insert these codes.

Binding the keys to the symbols

To use your newly created symbols, you'll need to create an .Xmodmap file in your home directory (or edit the one you already have). If you do not have one, run xmodmap -pke > .Xmodmap in your home directory (using a terminal). Open this file (run gedit ~/.Xmodmap) and add or change the following lines (you can determine keycodes running the "xev" application at a terminal):

keycode  93 = M2
keycode 129 = G5
keycode 130 = G6
keycode 131 = M3
keycode 132 = LCD0
keycode 133 = G12
keycode 136 = G10
keycode 137 = G15
keycode 138 = G16
keycode 143 = G12
keycode 146 = G10
keycode 152 = G2
keycode 170 = LCD1
keycode 177 = G1
keycode 182 = G17
keycode 183 = G18
keycode 184 = M1
keycode 190 = G3
keycode 205 = LCD4
keycode 208 = G4
keycode 209 = G8
keycode 210 = G9
keycode 219 = LCD2
keycode 220 = G11
keycode 231 = G7
keycode 246 = G13
keycode 247 = MR
keycode 249 = LCD3
keycode 251 = G14

Now log out and back in, and your extra keys will work just like any other. You may get a message when you log in asking if you want to load .Xmodmap. Add .Xmodmap to the load list and check the box that says 'Do not warn again'. Congrats!

Broken on Ubuntu Lucid

On Ubuntu Lucid you may not have usable G and M keys. If so, check /var/log/Xorg.0.log. If you see the error message 'G15 Extra Keys: dropping event due to full queue!' the package is still not caught up with the g15daemon Subversion repository.

Follow http://www.g15tools.com/node/176#comment-813 to rebuild g15-daemon from source with the modified plugins/g15_plugin_uinput.c file (you can get it at https://g15daemon.svn.sourceforge.net/svnroot/g15daemon/trunk/g15daemon-wip/plugins/g15_plugin_uinput.c).


CategoryHardware

LogitechG15 (last edited 2010-04-17 13:34:42 by tzz)