# problems with microsoft natural ergonomic keyboard 4000

## netjiro

Hi

My old ergo kbs were old and dying so I went out and bought a new spanking M$ ergo 4000.

The problem is:

function keys F3-F12, special function keys 2-5, and all special keys to the right of them

Those keys don't even fire keycodes

I used xev to check the keycodes of the keyboard since it was behaving strangely, and the mentioned keys don't register any events at all.

Is this some weird microsoft special, or broken KB?

Any suggestions?

Thanks

NJ

----------

## didymos

Have you tried changing the keymap settings in the xorg config file? I know that you can specify extra bindings for otherwise default keymaps.

Thomas S. Howard

----------

## netjiro

That would have been nice, but the problem is that some keys don't send keycodes at all when pressed, which means that I cannot assign them using a keymap since that maps keycodes to keysyms.

I have however tried the keyboard in a winxp install, and installed all the drivers, and it still behaves rather weird. The "dead" keys (without keycodes) come to life, but send mixed garbage of for example: F9 sends something like ctrl+F7 !

Nice.

And it doesn't work at all in either the windows boot menu or grub boot menu.

I'm returning the keyboard.

----------

## Spearhead

 *netjiro wrote:*   

> That would have been nice, but the problem is that some keys don't send keycodes at all when pressed, which means that I cannot assign them using a keymap since that maps keycodes to keysyms.
> 
> I have however tried the keyboard in a winxp install, and installed all the drivers, and it still behaves rather weird. The "dead" keys (without keycodes) come to life, but send mixed garbage of for example: F9 sends something like ctrl+F7 !
> 
> Nice.
> ...

 

You did check if the function-lock is enabled, i hope?  :Wink: 

And as for the boot menu, do you have the keyboard attached via USB or PS/2 with a converter?

If USB, did you enable USB Legacy Support in your BIOS?

----------

## netjiro

LOL, the first things that goes blind...

Well, unfortunately the function lock only helped with F3-5 which were out before, and with the right-most special keys. The F6-12 and the 1-5 special keys are still not working at all. I also tried it in on a windoze again, and the F6-12 are kaputt in windows as well regardless of function lock.

I have USB legacy support enabled in the bios, and the keyboard connected through USB. When plugging it through a PS2 converter it doesn't want to talk at all.

Too bad, unfortunately, because I really liked the layout and feel of this kb. I hope I get a replacement that works.

Thanks for the help anyhow

NJ

----------

## muhr

Hello

I've bougth one of these, too. I have no problems with the F-keys. I can use with Grub when booting with no problems as well.

The 1-5 special keys don't work (as don't the Favorites and Calculator keys and the zoom-wheel), however. I don't know how to activate them.

BTW: Did you see that there are 2 evdev interfaces that belong to this keyboard?

-- muhr

----------

## netjiro

Glad to hear it's working for you, that gives me a bit more hope on resolving this with a replacement board.

I don't really need the special keys or zoom thingie, just the rest of the F keys. 

Yes I noticed the two different devices from dmesg. I assume one is the general keyboard functions and one is the zoom thingie, and perhaps some of the otherwise not working special keys, as you said 1-5 and calculator. But I'm just guessing, and I haven't had time to look into it.

NJ

----------

## hobbes27

 *muhr wrote:*   

> 
> 
> I've bougth one of these, too. I have no problems with the F-keys. I can use with Grub when booting with no problems as well.
> 
> The 1-5 special keys don't work (as don't the Favorites and Calculator keys and the zoom-wheel), however. I don't know how to activate them.
> ...

 

I just ordered that keyboard. Is there a howto available to get that thing running with gentoo?

regards,

hobbes

----------

## netjiro

I got a replacement for my broken board. It works fine. Sorry that I forgot to post back to the forum.

The keys go a bit stiff, or loose the preassure sensitivity "equal distribution" depending on where on the key you press. Most other kbs don't but I've found that many M$ boards do, unfortunately. I.E. after a while some keys tend to get an odd feeling, being harder to press if you don't press dead center on them. My other el-cheapo boards never develop this malady, but all the M$ boards I've tried have done so after a few months+.

Otherwise it is a nice board with excellent hand rests and a good layout, although it requires somewhat larger hands than most other broken ergo boards I have.

Harebrafolk

Jimmy

----------

## lohner

I have the same problem, others too (here for example), but there's a kernel patch already!

here's the description of the problem

that's the solution, a kernel driver

to get it to work, you also need to patch your usb-input kernel driver and others with this

called HID simple driver interface

now, if only somebody could tell me why I can't patch the suspend2-sources verison 2.6.15-suspend2-r8 with

```
patch -p1 < [one of the two patches above] 
```

 ?

(yes, I am in /usr/src/linux and I saved the patches from the right beginning to the end to two separate files in that dir)

an error message is, for example:

```
patching file drivers/usb/input/Kconfig

patch: **** malformed patch at line 9: To compile this driver as a module, choose M here: the

```

and if I try to fix that one, the next error comes along - it seems like this is a wrong file format for patch

So I don't know what to do with these patch files (if they are patch files at all).

Is it just me or do I have to use methods other than patch?Last edited by lohner on Fri Jun 02, 2006 1:06 pm; edited 1 time in total

----------

## licked

I tried the above patch too and had similar results, _except_ the paren keys over the numpad began to work, after I manually patched everything.

I was hoping 2.6.17 would make the keys work, but I'm runnig -rc2 with no joy and I'm assuming no new stuff from here in.

I really want the zoom key for controlling my mythtv volume!

----------

## chrisashton84

One thing I didn't see mentioned (or missed) was the numpad itself - I can't get the numlock button to actually do anything (in linux).  The LED turns on / off, but the keys never act as numbers, always arrows, home, etc.  I assume this is working fine for you guys?  (I haven't patched the kernel yet).

----------

## licked

In all my research I've seen mention of this before as a defect.  Seems to be somewhat common. Exchange it.

----------

## chrisashton84

You had me worried (it's an online purchase... dont' know if newegg could help since it's been a month or so since i got it) but the numpad works perfectly in windows, even w/o the driver installed.  In linux it does send the numlock keycode so I'm not sure what's up.  BTW I'm using microsoftprousb as XkbModel, in xgl, and don't know what all this might affect.  As another oddity (besides the other non-working keys other people have mentioned) in the last couple of boots it's started treating Ctrl as Ctrl+Win, unless another modifier is pressed, in which case it acts normally.

BTW, how difficult is it to patch the gentoo sources with that patch?

----------

## lohner

No problems here except for the already mentioned non-working keys.

I compiled the USB stuff in the kernel - no modules:

```

<*> Support for Host-side USB 

--- USB Input Devices

<*> USB Human Interface Device (full HID) support

[*]   HID input layer support

[ ]   /dev/hiddev raw HID device support

```

As for Xgl and the XkbModel I don't really know if that's a problem. I use X.org 7 and the config looks like this:

```

Section "InputDevice"

        Identifier  "Keyboard0"

        Driver      "keyboard"

        Option      "XkbRules" "xorg"

        Option      "XkbLayout" "de"

        Option      "XkbModel" "microsoftprooem"

EndSection

```

I did not patch anything because there seems to be something wrong with the file format of the patch files

and after an hour of playing around with the kernel source code exchanging the

necassary parts I gave up due to lack of success.

And as licked wrote, if you do it by hand, it does not make everything work.

I'm still waiting for a change in the USB subsystem of the vanilla kernel...

----------

## sir_tez

Ouch!  I just ordered this keyboard as well....  :Sad: 

----------

## sir_tez

I replaced my old beige Microsoft Natural (v 2.0, I think with the diamond shaped arrow key configuration).  After restarting the computer, everything worked fine... I can use F6 and F7 just fine.... don't know any proper programs to use all the rest of the keys on but I may post again to let you know.  So far, so good.

----------

## sir_tez

I'm using the standard x.org 7.0 drivers not evdev

Section "InputDevice"

    Identifier  "Keyboard1"

    Driver      "kbd"

    Option "XkbModel"   "microsoft"

    Option "XkbLayout"  "us"

    Option "XkbVariant" ""

EndSection

----------

## PowerOfAzure

I just looked at dmesg, and it says that keycode.c cannot emulate rawmode for keycode 240

I took a look at keyboard.c (a copy of, i've done enough programming and library editing to know you never EVER change the orig) and found where this error/warning occurs

```
if ((raw_mode = (kbd->kbdmode == VC_RAW)) && !hw_raw)

      if (emulate_raw(vc, keycode, !down << 7))

         if (keycode < BTN_MISC)

            printk(KERN_WARNING "keyboard.c: can't emulate rawmode for keycode %d\n", keycode);
```

Now, i don't know a lot of C (C++ and Java are my languages of choice), but I do know that probably, w/ enough time, I could figure out what everything means and what it does, since the languages are somewhat similar, and the logic is the same.  Is there anyone who is very good at C who could look at that and possibly tell how to edit it to make the rawmode emulation for these keys work?  I'm going to work at it, but it would probably take a while.  Also, do you think that that would break the Gentoo install???

----------

## powerman

 *lohner wrote:*   

> So I don't know what to do with these patch files (if they are patch files at all). Is it just me or do I have to use methods other than patch?

 

In LKML there was posted two different patches for this keyboard. Patch you choose is too big, complex and strange - second patch looks much cleaner.

I've updated second patch for: 2.6.14-hardened-r8 kernel; make custom 1-5 keys above "MyFavorites" working; replace F-Lock + F1-F12 keys scancodes by usual F1-F12 scancodes, so now F-Lock state doesn't change anything. My patch is here: http://powerman.asdfgroup.com/patches.html.

----------

## PowerOfAzure

umm, how do I use these patches?  I've never patched the kernel, and I would really like to get my kb working

----------

## powerman

Patching kernel isn't Gentoo-specific task, so you can found a lot of information about it anythere in internet. In short:

```

cd /usr/src/linux

patch -p1 </path/where/you/saved/nek4k.patch

```

If you using different kernel than me, then you better run patch with "--dry-run" param first in addition to "-p1" - this make patch program doesn't change files on hard drive and just print information about which files and how will be changed. If there will be no lines like "Hunk #1 FAILED at 58", you can apply patch without

 --dry-run.

After patching kernel you should compile and install it as usually: make && make install or using genkernel.

----------

## PowerOfAzure

Is there a way to edit the patch to make it work w/ the gentoo-sources kernel (2.6.16-gentoo-r9)?

Also, is there a way to remove the patch?  I accentally didn't use dry-run on one of my attempts, and I was getting errors.  (HUNK 3 failed at 446)

----------

## powerman

 *PowerOfAzure wrote:*   

> Is there a way to edit the patch to make it work w/ the gentoo-sources kernel (2.6.16-gentoo-r9)?

 

Yeah... you can open patch in editor in one window, open corresponding kernel source file(s) in editor in second window and do manual search&replace for each chunk of code. This require understanding of patch/diff file format, but it's ease. Then, if you make backup of edited files before start changing them, you can run:

```
diff -uNr linux-orig/ linux/ > nek4k-2.6.16.patch
```

and post it somethere as your contribution to open source world.  :Smile: 

 *PowerOfAzure wrote:*   

> Also, is there a way to remove the patch?  I accentally didn't use dry-run on one of my attempts, and I was getting errors.  (HUNK 3 failed at 446)

 

To remove add -R option:

```
patch -p1 -R </path/where/you/saved/nek4k.patch
```

and delete all *.rej files created by patch. Also you can re-emerge kernel sources.

----------

## powerman

2.6.16-hardened-r10 become stable, so I've updated my patch for this kernel. You can download it from http://powerman.asdfgroup.com/patches.html

----------

## trantorvega

For the possessors of the Microsoft Natural Ergonomic Keyboard 4000: 

 I wrote this howto with informations to get ALL the keys recognised by X, along with custom XKB files. 

http://gentoo-wiki.com/index.php?title=HOWTO_Microsoft_Natural_Ergonomic_Keyboard_4000

Comments are welcome.

----------

## powerman

 *trantorvega wrote:*   

> Comments are welcome.

 

It sounds much more complex than using my patch. But maybe your way will be more compatible with Nek4K driver included in kernel in the future, don't sure.

Anyway, I suggest you create patch with all proposed changes in Xorg files and post it instead of these complex instructions.

----------

## trantorvega

Thanks for your suggestions.

If you have others you may use the discussion feature of the wiki.

Finding this thread was pretty difficult, and is not so visible (the search functionality of this forum is what i like the least).

I agree about the creation of a comprehensive patch, in fact I intended to include it in the near future, but only as an addtion to the detailed explanation: the latter gives more insight on thw workings of the xkb files, and leaves room for future and autonomous modifications by the users.

Moreover, a detailed description is something you find far less often than a patch.

About your patch, I agree that it is far simpler. (If I've found it sooner I might have choosed it ).

liyu's work is interesting in providing a sort of interface to esìasily implement several devices, and I like the idea of having a separate module to manage the extended features of the nek4k.

I have only a suggestion: I believe you should put the F-Lock portion of your patch into a separate patch,  considering that the F-lock keys removal is not by far, something that everyone might desire (I don't, for instance) along with the recognition of the additional keys.

I'll add a link to your patch in  the immediate future.

----------

## JohnerH

Hey,

I've been trying to go through the patches on the WIKI but they don't seem to work with the latest 2.6.20 versions of the kernel, is anyone still looking at getting this keyboard working?

Thanks in advance,

J

----------

## powerman

 *JohnerH wrote:*   

> I've been trying to go through the patches on the WIKI but they don't seem to work with the latest 2.6.20 versions of the kernel, is anyone still looking at getting this keyboard working?
> 
> 

 

I'll update my patch as soon as Gentoo devs will release/make stable hardened-sources 2.6.19+ (right now I still use 2.6.16 because some of my 'too modern' hardware work correctly only with 2.6.16 and then 2.6.19 (both 2.6.17 and 2.6.18 has buggy driver for my JMicron IDE controller while 2.6.16 is working mostly ok with "all-generic-ide irqpoll" kernel params).

BTW, is this keyboard still doesn't supported by Linux 2.6.20 without any patches?!

----------

## JohnerH

 *powerman wrote:*   

>  *JohnerH wrote:*   I've been trying to go through the patches on the WIKI but they don't seem to work with the latest 2.6.20 versions of the kernel, is anyone still looking at getting this keyboard working?
> 
>  
> 
> I'll update my patch as soon as Gentoo devs will release/make stable hardened-sources 2.6.19+ (right now I still use 2.6.16 because some of my 'too modern' hardware work correctly only with 2.6.16 and then 2.6.19 (both 2.6.17 and 2.6.18 has buggy driver for my JMicron IDE controller while 2.6.16 is working mostly ok with "all-generic-ide irqpoll" kernel params).
> ...

 

Afraid not...

You fancy summiting it to the kernel devs?

Couldn't hurt...

J

P.S.: I'd do it but I'm scared of getting barked at  :Very Happy: 

----------

## Richy

Hey,

I have found a Patch for 2.6.21-r2

http://lwn.net/Articles/224659/

(for future reference  :Wink:  )

Edit:

I got it working for 2.6.19 except for one (important) key. It is the "< | >" Key...

Any Idea on that?

Richy

----------

## Richy

Hey,

I found a Solution for myself:

```

File: ~.Xmodmap                                    

add Mod4 = Super_L

keycode 94 = less greater brokenbar

keycode 108 = ISO_Level3_Shift

keycode 135 = Mode_switch

```

I get the brokenbar by pressing the "menu" key and the usual..

Richy

----------

## JohnerH

 *Richy wrote:*   

> Hey,
> 
> I found a Solution for myself:
> 
> ```
> ...

 

So what does this do exactly?

 *Quote:*   

> 
> 
> Hey,
> 
> I have found a Patch for 2.6.21-r2
> ...

 

For some reason it's not letting me patch.....I'm on linux-2.6.21-gentoo-sources...

Any ideas?

----------

## Richy

hey JohnerH,

The Xmodmap file gets automatically loaded   when starting X.

Using the "xev" command, i was able to find out, which  keycodes are sent by the keys.

The key with "<>|" on it send keycode 94

Therefore:

"keycode 94 = less greater bar " 

man Xmodmap

```
 keycode NUMBER = KEYSYMNAME ...[...]

 The first keysym is used when

               no modifier key is pressed in conjunction with  this  key,  the

               second  with  Shift, the third when the Mode_switch key is used

               with this key and the fourth  when  both  the  Mode_switch  and

               Shift keys are used

```

For some reason though,    the "Alt GR"-key did send some ISO-3Shift signal. Because of that, the bar was not working. If I just assigned Mode_switch to it, the bar would work fine, but other special signs such as "@~" would not show up anymore. As a workaround, I assigned "keycode 135 = Mode_switch", which is the menu-key right next to the "Alt GR"key.(I have never used the menu key before, so i figured...)

That's   not really "the" way to go, but it works for me...

Referring to your patching problem:

No, I'm sorry. I haven't tried 2.6.21 myself, yet.. (and I'm not even close to being familiar with kernel-hacking)..

However, do you get any output? Usually Linux tells me what's wrong, and sometimes even how to fix it  :Wink: 

Richy

----------

## powerman

2.6.20-hardened-r2 become stable, so I've updated my patch for this kernel. You can download it from http://powerman.asdfgroup.com/RTFM/kernel.html

----------

## powerman

 *trantorvega wrote:*   

> I have only a suggestion: I believe you should put the F-Lock portion of your patch into a separate patch,  considering that the F-lock keys removal is not by far, something that everyone might desire (I don't, for instance) along with the recognition of the additional keys.
> 
> I'll add a link to your patch in  the immediate future.

 

Good idea, but I forget about it. Anyway, removing F-Lock portion of code from patch should be straightforward - just remove block of code under comment "Convert FLock's F-keys to normal F-keys".

I'd like to remove this code at all instead of just splitting one patch to two patches - is anybody know how to ignore F-Lock state without patching kernel? Solution described here don't work for me: http://www.linuxquestions.org/linux/answers/Hardware/Microsoft_Keyboard_Function_Key_Fix

----------

## Richy

Good Morning,

Xorg 7.2 became stable and I updated to it yesterday. As of today, many keys aren't functioning right anymore! For some reason, keycodes have changed. (For example, the enter key on the numbertab is signalizing key 104 (the Down Key)..

I guess I have to adjust Xmodmap a lot, but still: What is the reason for that?

Richy

Edit: 

```

File: .Xmodmap                                    

add Mod4 = Super_L

keycode 94 = less greater bar

keycode 105 = Control_R

keycode 104 = KP_Enter

keycode 106 = KP_Divide

keycode 108 = ISO_Level3_Shift

keycode 110 = Home

keycode 111 = Up

keycode 112 = Prior

keycode 113 = Left

keycode 114 = Right

keycode 115 = End

keycode 116 = Down

keycode 117 = Next

keycode 118 = Insert

keycode 119 = Delete

keycode 133 = Super_L

keycode 135 = Mode_switch

```

----------

## powerman

I'm using 7.2 too. No problems, no xmodmap. Here is how both Enter's work:

KeyPress event, serial 29, synthetic NO, window 0x4000001,

    root 0x63, subw 0x0, time 144635788, (103,258), root:(318,498),

    state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,

"   XLookupString gives 1 bytes: (0d) "

"   XmbLookupString gives 1 bytes: (0d) "

    XFilterEvent returns: False

KeyRelease event, serial 29, synthetic NO, window 0x4000001,

    root 0x63, subw 0x0, time 144636036, (103,258), root:(318,498),

    state 0x0, keycode 36 (keysym 0xff0d, Return), same_screen YES,

"   XLookupString gives 1 bytes: (0d) "

    XFilterEvent returns: False

KeyPress event, serial 29, synthetic NO, window 0x4000001,

    root 0x63, subw 0x0, time 144640212, (103,258), root:(318,498),

    state 0x0, keycode 108 (keysym 0xff8d, KP_Enter), same_screen YES,

"   XLookupString gives 1 bytes: (0d) "

"   XmbLookupString gives 1 bytes: (0d) "

    XFilterEvent returns: False

KeyRelease event, serial 29, synthetic NO, window 0x4000001,

    root 0x63, subw 0x0, time 144640532, (103,258), root:(318,498),

    state 0x0, keycode 108 (keysym 0xff8d, KP_Enter), same_screen YES,

"   XLookupString gives 1 bytes: (0d) "

    XFilterEvent returns: False

----------

## Richy

Hey Powerman, 

I get a different Keycode for the KP_Enter, it's 104 instead of 108. Maybe I messed something up, a long long time ago following the wiki and changing some Keyboard-layouts. 

Using Xmodmap solves the problem for me. (Unfortunately I'm not skilled enough to find "the" Solution)

Richy

----------

## derbrain

Hello powerman,

I bought this keyboard last week, too. I first tried to follow the HOWTO, but there were some issues with udev (the udev-rule didn't work). Then I saw that you just updated your driver, and I decided to use that one. But I have some problems with it (maybe because I altered all the config files mentioned in the HOWTO). The numlock-led now is on when numlock is off, and the caps-lock led doesn't work at all. I will change the config files back to the original, probably it will work again after that. The special keys don't work for me. What do I have to do in addition to patch the kernel with your driver?

I found out that there is a new all-in-one hid friver from LiYu now, version 0.5 (dunno if there is a even newer one now, since I didn't find a central place to download the actual version from). What about that one? Do you have any idea which of the drivers will make it to be included in a future kernel?

----------

## Richy

Hi, 

here is an update for 2.6.21 

http://lkml.org/lkml/2007/4/30/33

It's working just fine under suspend2-sources-2.6.21-r4

Richy

----------

## Sedrik

Any news on this for the latest gentoo-sources, just recieved my keyboard today and would love to get it working =)

----------

## Richy

http://lkml.org/lkml/2007/7/16/122

----------

## Ant P.

I know it's a two year old thread, but I got one of these today and I'm having problems getting the zoom slider wheel to work. I can see a /dev/input/ file for it which seems to respond, but I can't use it in X. Besides that, a few of the F-Lock keys don't function (they seem to be reporting keycodes above 255 which IIRC X doesn't yet support...)

In Xorg.0.log it apparently does see the scroll wheel, but gives an error message:

```
(**) Microsoft Natural® Ergonomic Keyboard 4000: always reports core events

(**) Microsoft Natural® Ergonomic Keyboard 4000: Device: "/dev/input/event5"

(II) Microsoft Natural® Ergonomic Keyboard 4000: Found 1 mouse buttons

(II) Microsoft Natural® Ergonomic Keyboard 4000: Found scroll wheel(s)

(II) Microsoft Natural® Ergonomic Keyboard 4000: Found keys

(II) Microsoft Natural® Ergonomic Keyboard 4000: Configuring as keyboard

(II) Microsoft Natural® Ergonomic Keyboard 4000: Adding scrollwheel support

(**) Microsoft Natural® Ergonomic Keyboard 4000: YAxisMapping: buttons 4 and 5

(**) Microsoft Natural® Ergonomic Keyboard 4000: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200

(II) XINPUT: Adding extended input device "Microsoft Natural® Ergonomic Keyboard 4000" (type: KEYBOARD)

(**) Option "xkb_rules" "evdev"

(**) Option "xkb_model" "evdev"

(**) Option "xkb_layout" "gb"

(EE) Microsoft Natural® Ergonomic Keyboard 4000: failed to initialize for relative axes.

(II) config/hal: Adding input device Microsoft Natural® Ergonomic Keyboard 4000

(**) Microsoft Natural® Ergonomic Keyboard 4000: always reports core events

(**) Microsoft Natural® Ergonomic Keyboard 4000: Device: "/dev/input/event4"

(II) Microsoft Natural® Ergonomic Keyboard 4000: Found keys

(II) Microsoft Natural® Ergonomic Keyboard 4000: Configuring as keyboard
```

Anyone got this working?

----------

## ilm

From memory, you need to apply a patch to the kernel sources to get the zoom slider working (I've never bothered).  It used to be on gentoo-wiki.com; if it's not there post-crash, try either gentoo-wiki.info or google's cache.

----------

## Ant P.

Hmm... looks like the kernel side of things already works fine. The zoom slider is reporting keycodes 418/419 according to showkey, X doesn't like them...

```
(WW) Microsoft Natural® Ergonomic Keyboard 4000: unable to handle keycode 432

(WW) Microsoft Natural® Ergonomic Keyboard 4000: unable to handle keycode 419

(WW) Microsoft Natural® Ergonomic Keyboard 4000: unable to handle keycode 418
```

Looks like something that can be fixed easily enough with setkeycodes  :Smile: 

----------

## ppurka

 *Ant_P wrote:*   

> Hmm... looks like the kernel side of things already works fine. The zoom slider is reporting keycodes 418/419 according to showkey, X doesn't like them...
> 
> ```
> (WW) Microsoft Natural® Ergonomic Keyboard 4000: unable to handle keycode 432
> 
> ...

 Did you look here:

http://www.gentoo-wiki.info/HOWTO_Microsoft_Natural_Ergonomic_Keyboard_4000 ?

You need to scroll down to the "modern way of doing things" to come across the kernel patch which brings the keycodes down to less than 255.

----------

## MageSlayer

Hi

I'm trying to make my M$ Ergo 4000 keyboard disregard F-lock mode.

Preferably both under X and "true" console.

As far as understand, in theory everything is easy. I need to map keycodes/scancodes from disabled F-lock F-keys presses to ones keyboard generate when F-lock enabled.

So far so good. In practice, nothing is easy  :Smile: 

To practice I tried to map unlocked F12 using xmodmap like following:

```

denis@den-desktop ~ $ cat /home/denis/.Xmodmap 

keycode 218 = F12

denis@den-desktop ~ $ xmodmap ~/.Xmodmap 

```

Ok, now it seems like unlocked F12 behaves as locked F12. But...

Some apps see unlocked F12 normally, some don't. 

e.g. Opera see F12 ok, tilda - does not.

Ok, I thought it's time to something more low-level. Like setkeycodes.

First I tried to find out scancode for unlocked F12. It's 0x39, AFAIU.

```
den-desktop denis # LANG=C showkey -s

kb mode was RAW

[ if you are trying this under X, it might not work

since the X server is also reading /dev/console ]

press any key (program terminates 10s after last keypress)...

0x9c 

^[[24~^[[24~0xe0 0x39 

0xe0 0xb9 

^[[24~0xe0 0xb9 

^[[24~0xe0 0x39 

0xe0 0xb9 

^[[24~0xe0 0x39 

0xe0 0xb9 

0x3a 

^Ccaught signal 2, cleaning up...

```

Now I do :

```
den-desktop denis # LANG=C setkeycodes e039 88

```

Nothing changed at all. Tilda still does not see unlocked F12. 

Then I read in man setkeycodes:

 *Quote:*   

> BUGS
> 
>        The keycodes of X have nothing to do with those of Linux.  Unusual keys can be made visible  under  Linux, but not under X.

 

Does it mean nothing can be done? Not quite a clear comment  :Sad: 

Guys. Help!

----------

## ppurka

 *MageSlayer wrote:*   

> To practice I tried to map unlocked F12 using xmodmap like following:
> 
> ```
> 
> denis@den-desktop ~ $ cat /home/denis/.Xmodmap 
> ...

 Only way to be sure is to launch xev and see what is the output of the keypress F12. If tilda doesn't work when (unlocked) F12 is pressed but xev shows that F12 is being sent, then it is a problem with tilda. 

I thought setkeycodes was for setting keycodes for the console (Ctrl + Alt + F1, etc ). If my understanding is true, then it has nothing to do with X.

----------

## Jim6

Seeing as people are still reading this topic - 

I have updated the gentoo-wiki guide - it is now available here:

http://en.gentoo-wiki.com/wiki/Microsoft_Natural_Ergonomic_Keyboard_4000

----------

