XDXA

Blog / Microsoft Natural Ergonomic

Microsoft Natural Ergonomic

I decided I wanted to enable the zoom key on my "Microsoft Natural Ergonomic Keyboard 4000" under Linux. Ideally, this would be used for scrolling up and down a page instead of triggering Compiz's zoom feature.

Un­for­tu­nate­ly, the kernel fix is triaged on ubuntu's bugtracker. This of course meant re­com­pil­ing the kernel manually (or semi-manually since Ubuntu makes this task relatively easy). You'll notice, if you care to check, that there is a patch in the bugtracker to remap the zoom and spellcheck keys to something that xev (and therefore X11) can read.

If you don't know how to recompile your kernel, this fix probably isn't for you. However, should you choose to proceed anyways (or if you're just not familiar with re­com­pil­ing your kernel under Ubuntu), you can find in­struc­tions for re­com­pil­ing Ubuntu's kernel here.

Once you've downloaded and un­com­pressed the source, edit "/usr/src/linux- source-*/include/linux/input.h". Search for ZOOMIN, ZOOMOUT, and SPELLCHECK and change these constants to match the following:

#define KEY_ZOOMIN 246 /* AC Zoom In */
#define KEY_ZOOMOUT 247 /* AC Zoom Out */
...
#define KEY_SPELLCHECK 235 /* AL Spell Check */

Keep in mind that if some other input device already uses these key codes, then you'll have a conflict. Otherwise, once you've recompiled your kernel, you should be able to access these buttons in Gnome now.

Additional In­for­ma­tion

What does this do and why do we do it? From my un­der­stand­ing, the reason this is a problem is X11 can't read key codes above a 255. Although this is a bug with X11, we can modify the kernel to remap these keys to a value lower. This enables X11 to read them and thus Gnome to use them.

I dislike patch files for problems that are not going to be fixed, because they often break on the next kernel release. This is why I chose to manually edit the file instead of offer a patch file

If you recompile your kernel, you'll likely have to recompile any other third party drivers you have installed. For instance, I had to recompile my Nvidia driver after rebooting. I also had to purge the nvidia-common package.

Mapping to Page Up / Down

Next, I wanted to map 246 and 247 to page up and page down re­spec­tive­ly. To do this, I edited my ~/.Xmodmap file to include:

keycode 254 = Prior
keycode 255 = Next

You can activate this by running "xmodmap ~/.Xmodmap" or adding the command to startup ap­pli­ca­tions. However, the next time you log in, I think you'll get an option to enable this au­to­mat­i­cal­ly without having to add it to startup apps. (I haven't setup xmodmap in a while, because I already use it to swap caplocks and escape... yes, I'm a vim user.)

Edit: I should note that I have since reverted to a stock kernel. For some reason the recompiled kernel would kill my mouse pe­ri­od­i­cal­ly.

« Mac OS X Snow Leopard Port Wine GBA Development on a Mac »