<body><script type="text/javascript"> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } } </script> <div id="navbar-iframe-container"></div> <script type="text/javascript" src="https://apis.google.com/js/platform.js"></script> <script type="text/javascript"> gapi.load("gapi.iframes:gapi.iframes.style.bubble", function() { if (gapi.iframes && gapi.iframes.getContext) { gapi.iframes.getContext().openChild({ url: 'https://www.blogger.com/navbar.g?targetBlogID\x3d23884446\x26blogName\x3dJust+Another+Tech+Blog\x26publishMode\x3dPUBLISH_MODE_BLOGSPOT\x26navbarType\x3dSILVER\x26layoutType\x3dCLASSIC\x26searchRoot\x3dhttps://justanothertechblog.blogspot.com/search\x26blogLocale\x3den_US\x26v\x3d2\x26homepageUrl\x3dhttp://justanothertechblog.blogspot.com/\x26vt\x3d-484221019928432923', where: document.getElementById("navbar-iframe-container"), id: "navbar-iframe" }); } }); </script>

Just Another Tech Blog

Anything and everything having to do with technology, computers, science, and most of all... Linux! The documentation of my Linux endeavor.



Enabling Media Keys on the Saitek Eclipse II Keyboard (Ubuntu 8.04 and most other Linux distros)

Monday, June 23, 2008

IMAGE BY TECHGAGE!One of the few problems I experienced in my recent fresh install of Ubuntu 8.04 (Hardy Heron) was the non-functionality of the media keys on my Saitek Eclipse II keyboard. This problem came as quite the odd surprise, seeing as the keys worked great in 7.04 and 7.10. It has always been puzzling to me that a new release can actually take a step backwards in terms of device compatibility... but what do I know? I don't code it, so it must be harder than it looks.
Either way, I soon set out to find a solution for this irksome issue I had on my hands. Who would have guessed that salvation came in the form of a Gentoo wiki page? Nice eh? Well, if you have explored that link a bit, you may note that it is quite lengthy and perhaps just a tad confusing for the Linux newbie. So... I bring you my simplified version! I have taken only the essential steps that were required to get the media keys on my Saitek Eclipse II keyboard working. I am sure that the guide works for other keyboards as well.

The first step of this process is find the raw scancodes that the kernel spits out and X interprets when a key is pressed. To do this in a nice, simple fasion, issue the following command and press the keys you would like to configure in an order that you can remember:

xev | sed -n s/"^.*keycode *\([0-9]\+\).*$"/"keycode \1 = "/p | uniq
Close the window when you are done. There should be an out put left that looks somewhat like so:

keycode 36 =
keycode 144 =
keycode 162 =
keycode 164 =

The first line isn't actually a media key, so just ignore/ delete it.

Now, we must set up xmodmap to recognize the keys and assign them their proper keysyms. In your home directory, create a file named .Xmodmap. In this file, you will enter the appropriate keysysm to match the media key. My file ended up looking like this:

keycode 162 = XF86AudioPlay
keycode 164 = XF86AudioStop
keycode 144 = XF86AudioPrev
keycode 153 = XF86AudioNext

You can find all possible keysyms listed in the following file on Ubuntu: /usr/share/X11/XKeysymDB.
This should now all be automatically loaded at startup. If it doesn't... try:

/usr/bin/xmodmap $HOME/.Xmodmap

Now that we have the keys properly identified and configured, we can assign them to the actions of our choice. I like to have my keys set up in Amarok, so I set the to their respective functions under Settings > Configure Global Shortcuts. You can also set the keys through gnome by going to System > Preferences > Keyboard Shortcuts. However, in the past, I have noted that this can cause conflict with Amarok, so I usually just leave the keys disabled in the Keyboard Shortcuts dialog (Amarok will handle them just fine that way).

If all went well, that should get you full support for you mutlimedia keys in Ubuntu and Amarok. If it doesn't work, then take a look around the wiki page... maybe you will find something that fixs the issue or (even better) inspires you to come up with your own hacks and workarounds :D

Have fun!

Note from the Nerd: Many thanks to the people who contributed to the Gentoo wiki page I have so extensively referenced in this post!
posted by linnerd40, Monday, June 23, 2008


1 Comments:

The Spanish blog is systematically organized into a menu and comes across as a user-friendly and easy to browse site. No surprises that the blog has more than 950 readers and encourages readers to actively participate in the enrichment of the blog by participating in the forums and submitting any latest stories up their sleeves.IE AntiVirus

commented by Blogger Unknown, 6:34 AM  

Add a comment