Getting the Logitech K350 multimedia keys to work properly in Linux

I am using a Logitech K350 wireless keyboard on my computer which worked well right after plugging it in. Even most of the multimedia keys worked out of the box:
  • Audio control (Play, Stop, Previous, Next, Volume Up, Volume Down, Mute)
  • Camera button
  • Music and media center button (they generate the same key event though)
  • Internet, E-Mail, Search
  • Eject
  • Calculator
  • Power
There was just one minor issue that bugged me: some of the multimedia keys of the K350 did not seem to generate X11 input events. After doing some research I found out that those keys generate keycodes higher than 255 which cannot be handled by X11 at the momenent. To fix this, you need:
  • A recent Linux kernel with evdev and HID support
  • A software called evrouter (Gentoo users: get it from my overlay)
  • xmodmap
Note: There are 5 keys which do not seem to generate any events (Flip key, Gadget key, Function A, Function B, Function C). Right now there is no way of getting these keys to work!

Step #1

The event devices (/dev/input/event*) need to be readable by normal users. You need to create a udev rule to accomplish this task:
KERNEL=="event*", NAME="input/%k", GROUP="input"
Make sure you have a group "input" on your system and that you are actually a member of that group!

Reboot your system and check if the group "input" is now allowed to read the /dev/input/event* device files!

Step #2

Configure evrouter:
#Zoom In
"^Logitech Unifying Device" "^/dev/input/event" none key/418 "XKey/XF86ZoomIn"
#Zoom Out
"^Logitech Unifying Device" "^/dev/input/event" none key/419 "XKey/XF86ZoomOut"
"^Logitech Unifying Device" "^/dev/input/event" none key/430 "XKey/XF86Messenger"
"^Logitech Unifying Device" "^/dev/input/event" none key/421 "XKey/XF86Word"
"^Logitech Unifying Device" "^/dev/input/event" none key/423 "XKey/XF86Excel"
"^Logitech Unifying Device" "^/dev/input/event" none key/397 "XKey/XF86Calendar"
Note: On older Linux kernels you might need to use "Logitech USB Receiver" as device identifier.
Evrouter comes with a pretty good manpage. If you need to do more advanced stuff just check the documentation.

Step #3

Add the keys from your evrouterrc to your xmodmap. This is how my xmodmap looks like:
keycode 150 = XF86PowerOff
keycode 234 = XF86Pictures
keycode 179 = XF86Music
keycode 250 = XF86ZoomIn
keycode 251 = XF86ZoomOut
keycode 252 = XF86Messenger
keycode 253 = XF86Word
keycode 254 = XF86Excel
keycode 255 = XF86Calendar
You can now load your xmodmap and start evrouter:
$> xmodmap ~/.xmodmap
$> evrouter /dev/input/event*

Step #4

You should now be able to use the multimedia keys of you Logitech keyboard (except the ones mentioned above) with your favorite key binding tool (xbindkeys, KDE/GNOME-specific, ...). To verify that your keys are working you can use a command-line tool called "xev".

Finally, you should add the commands from step #3 to an autostart script. If you are using KDE, it should look as follows:
xmodmap ~/.xmodmap
evrouter /dev/input/event*
# I use xbindkeys
The autostart file should be executable:
chmod a+x $HOME/.kde4/Autostart/autostart


Generally the K350 is an excellent choice for Linux users. The battery level of the keyboard is reported automatically by recent desktop environments and even additional devices can be paired with the Unifying receiver using a software called Solaar.

The only minor issue which remains is the fact that there are still 5 multimedia keys which do not work (Flip key, Gadget key, Function A, Function B, Function C).

Valid CSS! Valid XHTML 1.1