# Microsoft Natural Multimedia Keyboard KeyCodes

## etomsch

Hi,

I just did some researching and some work on getting all keys of my new Microsoft Natural Multimedia Keyboard to work. Figured out all but the special one on F10. *?*

I'm using an init-script to set the scancodes to keycodes to get every key working which isn't supported by the kernel yet:

```

atbroy12 root # cat /etc/init.d/setkeycodes 

#!/sbin/runscript

depend() {

        need local

}

start() {

        ebegin "Setting keycodes"

        for i in $SCANCODES

        do

          # echo "`eval "echo $i"`"

          setkeycodes `eval "echo $i"`

        done

        eend ${?}

}

```

So I could use a file in /etc/conf.d to get all my scancodes to set.

```

atbroy12 root # cat /etc/conf.d/setkeycodes 

# config file for /etc/init.d/setkeycodes

# configured for Microsoft Natural Multimedia Keyboard 1.0A

# scancodes to set

SCANCODES="\"\$e005\" \"\$e007\" \"\$e008\" \"\$e010\" \"\$e016\" \"\$e019\" \"\$e020\" \"\$e021\" \"\$e022\" \"\$e023\" \"\$e024\" \"\$e02e\" \"\$e030\" \"\$e032\" \"\$e03b\" \"\$e03c\" \"\$e03e\" \"\$e03f\" \"\$e040\" \"\$e041\" \"\$e042\" \"\$e043\" \"\$e057\" \"\$e058\" \"\$e05f\" \"\$e064\" \"\$e06c\" \"\$e06d\" \"\$e06f\""

e005="e005 200"  # Messenger

e007="e007 201"  # Redo - F3

e008="e008 202"  # Undo - F2

e010="e010 203"  # Rewind

e016="e016 204"  # Logout

e019="e019 205"  # Forward

e020="e020 206"  # Mute

e021="e021 207"  # Calculator

e022="e022 208"  # Play/Pause

e023="e023 209"  # Spellcheck - F10

e024="e024 210"  # Stop

e02e="e02e 211"  # Minus

e030="e030 212"  # Plus

e032="e032 213"  # Home

e03b="e03b 214"  # Help - F1

e03c="e03c 215"  # My Music

e03e="e03e 216"  # New - F4

e03f="e03f 217"  # Open - F5

e040="e040 218"  # Close - F6

e041="e041 219"  # Reply - F7

e042="e042 220"  # Forward - F8

e043="e043 221"  # Send - F9

e057="e057 222"  # Save - F11

e058="e058 223"  # Print - F12

e05f="e05f 224"  # Standby

e064="e064 225"  # My Pictures

e06c="e06c 226"  # E-Mail

e06d="e06d 227"  # Media-Player

e06f="e06f 228"  # My Documents

```

And just to work with all these keys in X, I used hotkeys:

```

1503\ schneidt@atbroy12 schneidt :-) cat .hotkeys/hotkeys.conf 

### Specify the default keyboard  (without the .def extension) so you

### don't need to specify -t every time

# Kbd=acerwl

Kbd=msnatmult

# CDROM=/dev/cdrom

# PrevTrack=xmms --rew

# Play=xmms --play-pause

# Stop=xmms --stop

# Pause=xmms --pause

# NextTrack=xmms --fwd

# Rewind=

# WebBrowser=mozilla

# Email=mozilla -mail

# Calculator=xcalc

# FileManager=gmc

# MyComputer=gmc

# MyDocuments=gmc

# Favorites=gnome-moz-remote --remote=openBookmarks

# Transfer=gtp

# Record=grecord

# Shell=xterm -rv

# ScreenSaver=xscreensaver-command -activate

# NewsReader=mozilla -news

# Communities=mozilla -remote 'openURL(http://slashdot.org)'

# Search=mozilla -remote 'openURL(http://google.com)'

# Idea=mozilla -remote 'openURL(http://sourceforge.net)'

# Shopping=mozilla -remote 'openURL(http://thinkgeek.com)'

# Go=mozilla -remote 'openURL(http://linux.com)'

# Print=lpr

# Rotate=

# osd_font=-arphic-ar pl kaitim big5-bold-i-normal--0-250-0-0-c-0-*-*

### For the color, you can either use the strings in /etc/X11/rgb.txt,

### or use the RGB syntax #RRGGBB, e.g. ##A086FF

# osd_color=LawnGreen

# osd_timeout=3

### osd_position is either 'top' or 'bottom'

# osd_position=bottom

# osd_offset=25

```

and the definition-file:

```

1504\ schneidt@atbroy12 schneidt :-) cat .hotkeys/msnatmult.def 

<?xml version="1.0"?>

<definition>

  

  <config model="Microsoft Natural Multimedia Keyboard">

    

    <!-- F1 -->

    <userdef    keycode="119" command="xterm -geometry 140x60+160+120 -fn 7x13 -sb">xterm</userdef>

    [...]

    <!-- Eigene Dateien -->

    <userdef keycode="239" command="/usr/bin/gentoo">Gentoo Filebrowser</userdef>

    <!-- Eigene Bilder -->

    <userdef keycode="212" command="">Nothing</userdef>

    <!-- E-Mail -->

    <userdef keycode="237" command="thunderbird">Thunderbird Mailer</userdef>

    <!-- Browser-Home -->

    <userdef keycode="118" command="firefox">Firefox Browser</userdef>

    <!-- Abmelden -->

    <userdef keycode="173" command="/usr/bin/xlock">Locking Screen...</userdef>

    

  </config>

  <contributor>

    <name>to be added</name>

    <email>to be added</email>

  </contributor>

</definition>

```

Hope that's help for someone...  :Wink: 

Greetings,

Thomas

----------

## blu3bird

Good Post...

I made my key's working by putting "setkeycodes ... ..." into my local.start...but this has the same effect.

For people who try to get their keys working a have a tip how to find out the scancodes:

start xev to control if your keys are working(if they do you don't need to set their keycode again  :Wink: )

If a key does not work run dmesg to get the scancode.

dmesg should say something like this: 

```
atkbd.c: Unknown key pressed (translated set 2, code 0x93 on isa0060/serio0).

atkbd.c: Use 'setkeycodes e013 <keycode>' to make it known.

atkbd.c: Unknown key released (translated set 2, code 0x93 on isa0060/serio0).

atkbd.c: Use 'setkeycodes e013 <keycode>' to make it known.

```

In this example e013 is the scancode of the key.

Now use google or a windows pc to find out the keycode the key should have.

For example i have a Microsoft Office Keyboard and google'd for "Microsoft Office Keyboard keycodes" and the first hit works

bluebird

----------

## rcxAsh

I have a Microsoft MultiMedia keyboard, and am wondering how this method compares with lineak? (http://lineak.sourceforge.net/)

Are there any advantages/disadvantages to the two?

----------

## xeonburn

so how can I do something similar for my dell laptop keyboard... its got extra keys for play, stop, back, forward, increase and decrease volume, and mute... I am able to map them fine in gnome with whatever utility it has builtin but I am unable to find such a utility in KDE.

----------

## rcxAsh

What laptop do you have?  I'd suggest checking if it's listed on LinEAK's page.  If it is, you can maybe try their stuff and see how that works out.  LinEAK is in portage.   

http://lineak.sourceforge.net/index.php?nav=keyboards

----------

## xeonburn

Dell Inspiron 8500

----------

## rcxAsh

 *xeonburn wrote:*   

> Dell Inspiron 8500

 

AFAIK, I think LinEAK supports your keyboard.  :Very Happy: 

Their list of supported keyboards shows:

 *Quote:*   

> Laptop/notebook Dell Inspiron 8xxx 

 

The full list is here: http://lineak.sourceforge.net/index.php?nav=keyboards

IIRC, LinEAK is in portage.  Emerge it, and then you can read how to configure it at their page.  It's been a while since I had to configure my keyboard, but I don't remember it being too difficult.

----------

## dhaemon

THHHHHHHHAAAAAAAANKKKKSSS!!!!

Now everything works as it should. 

I felt stupid for buying this costy keyboard and not being able to use all it's keys...

Really stupid. I could never get all the keys to work at once.

THHHHHHHHHHHHHHHHHHHAAAAAAAAAANNKKK YOUU!

Ohh by the way, you forgot to mention something, in /etc/X11/xorg.conf your keyboard section should have this:

```
Option          "XkbModel"      "microsoft"
```

I tried without it and everything was messed up, so you're warned...

Also, make sure the keyboard layout set in Gnome is the same as in xorg.conf.

Just for kicks, I'll post my msnatmult.def for lazy people...

```

<?xml version="1.0"?>

<definition>

 

  <config model="Microsoft Natural Multimedia Keyboard">

   <MyDocuments keycode="239"/>

   <userdef     keycode="212"

      command="browsepix">MyPictures</userdef>

   <userdef     keycode="120"

      command="browsemusic">MyMusic</userdef>

   

   <Mute       keycode="175"/>

   <Play       keycode="180"/>

   <Stop       keycode="185"/>

   <VolUp      keycode="187" adj="2"/>

   <VolDown    keycode="186" adj="2"/>

   <PrevTrack  keycode="172"/>

   <NextTrack  keycode="165"/>

   

   <userdef     keycode="214"

      command="mythtc">Media</userdef>

   <Email      keycode="237"/>

   <WebBrowser keycode="118"/>

   <userdef     keycode="168"

      command="gaim">Messenger</userdef>

   <Calculator keycode="179"/>

   <userdef     keycode="173"

      command="nautilus ~/pix">Disconnect</userdef>

   <Sleep      keycode="101"/>

    

  </config>

  <contributor>

    <name>to be added</name>

    <email>to be added</email>

  </contributor>

</definition>

```

Best regards to you etomsch!

----------

## dhaemon

About lineak... I tried it. 

Etomsch's method is way superior... It's simpler, fast and is more configurable...

+ It's KDE material. And I like to keep my desktop coherent. USE="-qt -kde" that is....

----------

## mdf1

Hi I'm totally new to this, never progammed in my life and never used linux until 2 days ago. I have installed Ubuntu Feisty Fawn onto a Mac power pc. I have a Microsoft natural multimedia keyboard 1.0A (wired version)and I can't get it to work with Ubuntu.

I first went to: system prefs>keyboard>layouts,  I couldnt find the exact keyboard in the list but it has the wireless version, or it does have Microsoft natural keyboard, Anyway chose both at diff times but it wont type with any. 

I then went to system admin> synaptic package manager, from there I got "keytouch" & "keytouch editor" as I saw them mentioned on here. But when I click on either of them in the admin menu it tells me to chose an event, but I dont know what im supposed to chose, I dont have any of the listed items. 

This is so frustrating I just want to use my good keyboard instead of this crappy mac one  :Sad:  If anybody knows the code I'm supposed to type in I'd appreciate it.

P.s. I copied and pasted the codes mentioned above but neither worked so am guessing I need to type in some other stuff first.

Cheers

----------

