First notes (2010-08-14).
I have implemented a daemon for the g13 that runs in userspace (so can't crash the entire kernel and system). It mostly works (I played a few games with it), though the LCD support is very basic.
I will provide more documentation in the next few days, for now the sources. Uncompress, run make (make sure you have libusb1 installed), run ./g13. Make sure you have the module uinput loaded and have write access as the user that runs g13. If you run udev, copy the file 91-g13.rules to /etc/udev/rules.d/ to make sure you have write access as the user that runs g13.
The daemon will create a pipe /tmp/g13-0 that you can send commands to (e.g. echo "rgb 100 0 0" > /tmp/g13-0).
rgb red green bluemod intbind key valueThese will change, and I'll add something for the LCD.
This is deprecated, use the userspace driver above
Uploaded slightly modified version, seems to work fine except that it crashes evdev_drv (and thus xorg). Probably some problem with the event interface, still working on it. (2009-06-22).
This is a working first version of a kernel driver for the Logitech G13. It handles all keys and the stick, it can set the LCD, the backlight and the four M-key lights. I tested it on 2.6.29, but other kernel versions might work too.
make.
wget http://eutyche.swe.uni-linz.ac.at/g13/g13.tar.bz2 tar xvjf g13.tar.bz2 cd g13 makeThis should successfully build the kernel driver. If you get any errors, please report them to me, I'll try to fix them. In order to use the G13 driver, we need to tell module
usbhid to ignore the G13. Add the following to /etc/modprobe.conf or to /etc/modprobe.d/g13:
options usbhid quirks=0x046d:0xc21c:0x4
This tells the usbhid driver to ignore any device with the given usb vendor and device ids (which match exactly the G13).
Load the kernel module (this must be done as user root:
insmod g13.ko
Plug in the G13, and cross your fingers :)
If the driver correctly recognizes the G13, you should see the following image on the LCD display:
You can interface with the driver through the files in /sys/kernel/g13.
/sys/kernel/g13/rgb
# set the backlight to medium red
echo "100 0 0" > /sys/kernel/g13/rgb
/sys/kernel/g13/m_keys| Key | Value |
|---|---|
| M1 | 1 |
| M2 | 2 |
| M3 | 4 |
| MR | 8 |
# set the M2 and MR lights, unset M1 and M3
echo 10 > /sys/kernel/g13/m_keys
/sys/kernel/g13/lcdpbm2lpbm.c (compile with g++ pbm2lpbm.c, then run ./a.out < input.pbm > output.lpbm. It converts raw pbm images of size 160x43 to the correct format (conveniently named lcd-pbm or lpbm).
# set the LCD to show hello.lpbm
cat hello.lpbm > /sys/kernel/g13/lcd
/sys/kernel/g13/keymap/usr/src/linux/include/linux/input.h) that the respective key or button sends. The values are in order:
| Key | Explanation |
|---|---|
| G1 - G22 | The Gxx keys |
| Button-Left | The button to the left of the stick |
| Button-Down | The button below the stick |
| Button-Stick | The button that is activated when pushing the stick hard |
| M1 - MR | The Mx keys |
| Next | The round key to the left of the LCD |
| Left | The leftmost key right below the LCD |
| Left-Center | The second-to-left key right below the LCD |
| Right-Center | The second-to-right key right below the LCD |
| Right | The rightmost key right below the LCD |
| Light | The key that toggles the LCD backlight, with a small sun on it |
# set my custom dvorak keymap
echo "003b 003c 002d 0033 0020 003d 003e 003f 0040 001e 0027 0023 0041 0042 0043 0035 0030 0017 0044 000e 001c 0039 0110 0111 0112 0002 0003 0004 0005 0006 0007 0008 0009 000a 000b " > /sys/kernel/g13/keymap
/dev/event/inputn (n depends on your system, and probably changes between reboots, or even when you unplug and then re-plug the G13). Use evtest to see what the current keys are. Normally your X server should automatically use the device for input, the stick should work as an absolute pointing device (note that this depends on your setup, if your X server uses input hotplugging, you probably need some additional configuration).