Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
HOWTO: Multimedia keys on a Microsoft Natural Keyboard Pro
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
Cloney
n00b
n00b


Joined: 10 Oct 2003
Posts: 65

PostPosted: Fri Feb 06, 2004 11:43 am    Post subject: HOWTO: Multimedia keys on a Microsoft Natural Keyboard Pro Reply with quote

I've just discovered something rather interesting, and fixed it, so I thought I'd share.

While playing with KHotkeys, I noticed that some of the multimedia buttons on my MS Natural Keyboard Pro didn't work. A bit of websearching revealed the strange truth - the MS NK Pro has different keymaps if connected by USB or PS2. Strange but true.

Anyway, the Xkb keymap is based on the PS2 keymap, so some of the keys aren't mapped correctly (a few are common, such as Mail, back, forward, etc). Here's how to fix the rest:

As root, open /etc/X11/xkb/symbols/inet in your editor of choice - I'll use nano for this example for compatability's sake, but I'd recommend something GUI based good for cut and pasting:

Code:
nano -w  /etc/X11/xkb/symbols/inet


Search for Microsoft Natural Keyboard Pro until you find its entry. Now paste the following into the file after the original MS NK Pro entry:

Code:
partial alphanumeric_keys
xkb_symbols "microsoftprousb" {
    name[Group1]= "Microsoft Natural Keyboard Pro USB";

//   Multimedia Section -- Right Side
    key <I1F>   {   [ XF86AudioPlay, XF86AudioPause ] };
    key <I24>   {   [ XF86AudioPrev      ]   };
    key <I17>   {   [ XF86AudioStop      ]   };
    key <I22>   {   [ XF86AudioNext      ]   };
    key <I01>   {   [ XF86AudioMedia   ]   };
    key <I25>   {   [ XF86AudioLowerVolume   ]   };
    key <I1E>   {   [ XF86AudioRaiseVolume   ]   };
    key <I26>   {   [ XF86AudioMute      ]   };
//   Internet Section -- Left Side
    key <I02>   {   [ XF86HomePage      ]   };
    key <I6C>   {   [ XF86Mail      ]   };
    key <I66>   {   [ XF86Favorites      ]   };
    key <I65>   {   [ XF86Search      ]   };
    key <I68>   {   [ XF86Stop      ]   };
    key <I6A>   {   [ XF86Back      ]   };
    key <I69>   {   [ XF86Forward      ]   };
    key <FK16>   {   [ XF86Reload      ]   };
//   My Computer Section -- Far Right
//  My computer maps to printscreen, so leaving commented out for now 
//  key <PRSC>   {   [ XF86MyComputer   ]   };
    key <I21>   {   [ XF86Calculator   ]   };
    key <I63>   {   [ XF86Standby      ]   };
};


Note that the My Computer key shares a keymap with Printscreen, so there's not really any point in remapping it, so it's commented out here.

Next, you need to add your new keymap to X's various list files.

Code:
nano -w /etc/X11/xkb/rules/xfree86


Find the section that's headed "! model", where the other Microsoft boards should be listed. Add the following:

Code:
  microsoftprousb =    microsoft(natural)


Now find the "! $inetkbds" section, and add the following line to the list:

Code:
         microsoftprousb \


Next, the keyboard list:

Code:
nano -w /etc/X11/xkb/rules/xfree86.lst


Find the "! model" section and add the following to the list:

Code:
  microsoftprousb Microsoft Natural Keybard Pro USB


Lastly, the XML file that will ultimately replace the old list:

Code:
nano -w /etc/X11/xkb/rules/xfree86.xml


Do a search for "Natural Pro" to find the original layout, then add this after </model>:

Code:
    <model>
      <configItem>
        <name>microsoftprousb</name>
        <description>Microsoft Natural Keyboard Pro USB</description>
      </configItem>
    </model>


Lastly, update your XF86Config to use your new keyboard.

Code:
nano -w /etc/X11/XF86Config


Find the Keyboard section, then look for the line:

Code:
Option "XkbModel" <somemodel>


Change this to:

Code:
Option "XkbModel" "microsoftprousb"


Restart X, and everything should be great. Note for KDE users - Keyboard Layout in Kontrol Centre overrides any XF86Config Xkb settings, but uses the same config files, so be sure to select your new board from the Layout menu (which should now include our new options).

Enjoy! I'm off to file a XF86 bugreport.

Cloney
Back to top
View user's profile Send private message
shiftless
Tux's lil' helper
Tux's lil' helper


Joined: 08 Oct 2003
Posts: 128

PostPosted: Fri Feb 06, 2004 2:12 pm    Post subject: Reply with quote

The simple solution would be to just use the already defined "microsoftprose" keyboard deffinition.
Back to top
View user's profile Send private message
Cloney
n00b
n00b


Joined: 10 Oct 2003
Posts: 65

PostPosted: Fri Feb 06, 2004 2:35 pm    Post subject: Reply with quote

shiftless wrote:
The simple solution would be to just use the already defined "microsoftprose" keyboard deffinition.


Isn't that defined for Swedish Microsoft Natural Keyboard Pro's, though? My board has a UK keymap. That said, looking at the files shows that the microsoftprose keymap does have the right inet key mappings.

Weird.

Cloney
Back to top
View user's profile Send private message
shiftless
Tux's lil' helper
Tux's lil' helper


Joined: 08 Oct 2003
Posts: 128

PostPosted: Fri Feb 06, 2004 5:01 pm    Post subject: Reply with quote

Well this only deals with the inet keys, so it wouldnt affect any other mappings you used with it for the regular keyboard keys.

As far as the Swedish bit goes... I dont know... My guess is it was sent in by someone from Sweden who used it as USB and everyone else used it as PS/2 so they thought there were 2 revisions of the same keyboard...
Back to top
View user's profile Send private message
Cloney
n00b
n00b


Joined: 10 Oct 2003
Posts: 65

PostPosted: Fri Feb 06, 2004 6:52 pm    Post subject: Reply with quote

shiftless wrote:
As far as the Swedish bit goes... I dont know... My guess is it was sent in by someone from Sweden who used it as USB and everyone else used it as PS/2 so they thought there were 2 revisions of the same keyboard...


That's about as close as I could guess. Anyway, I've filed an XF86 bug report on it, so hopefully it'll be fixed for the next release in some way shape or form.

Out of curiousity, how did you know about the Swedish thing?

Cloney
Back to top
View user's profile Send private message
shiftless
Tux's lil' helper
Tux's lil' helper


Joined: 08 Oct 2003
Posts: 128

PostPosted: Sun Feb 08, 2004 1:00 pm    Post subject: Reply with quote

I was too lazy to actually try and figure out how to add a new deffinition so i just went through the entries hoping i would find one that was close enough to use the few keys i actually used :)
Back to top
View user's profile Send private message
Cloney
n00b
n00b


Joined: 10 Oct 2003
Posts: 65

PostPosted: Fri Feb 13, 2004 12:23 pm    Post subject: Reply with quote

Well, the XF86 bug report's been dealt with. They're going to rename the swedish map to say that it's actually a USB map, and also probably unbind the printscreen key (as mapping over it limits functionality).

Ah well, I got it working, learnt a lot and fixed a bug. I still can't help feeling I wasted a morning, though :wink:

Cloney
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum