# Keyboard problem with 2.6 kernel

## Vanquirius

Hello,

Some people may want to have me killed for that, but for the past months I've been using a MS Wireless Desktop (Keyboard + Mouse):

```
input0: USB HID v1.11 Keyboard [Microsoft Microsoft Wireless Optical Desktopï¿½ 1.00] on usb1:5.0

input1: USB HID v1.11 Mouse [Microsoft Microsoft Wireless Optical Desktopï¿½ 1.00] on usb1:5.1
```

Anyway, both the keyboard and the mouse work perfectly with gentoo-sources, although I do get keycode errors which I just ignore:

```
keyboard.c: can't emulate rawmode for keycode 272

keyboard.c: can't emulate rawmode for keycode 273
```

I was trying to keep away from the dev-kernel series because of 'exotic' hardware like this, but you know how tempting it is   :Rolling Eyes: 

So, I gave a shot to mm-sources-2.6.0-test10 last night. Everything worked fine, except for the keyboard. I don't get the keycode errors anymore, but instead it prints exclamation points (!) to infinity, as if I was holding shift+1. I'm pretty sure it's the keyboard, since unplugging it will stop the !.

Anyone have any ideas about what I could do to make this work?

edit2: removed config link, obsolete

----------

## Vanquirius

Maybe just blocking the erroneous keycodes...?

----------

## TenPin

The keyboard driver in 2.6 just seems to have been generally b0rked.

I always had 2.4 working fine with all the keys on my laptop but with 2,6 it claims the (i) button (next to power button) on my Dell laptop is a:

```

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

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

```

The volume keys still work though. Its annoying because I used the (i) to bring up a new terminal.

mm-sources applies some 2.4 compatibilty patch but this makes no difference for me.

----------

## dippen

@TenPin

i got the same messages. 

the problem is the atkbd-24-compatibility patch wich is part of the mm sources since linux-2.4.20-test9-mm3.

reverse this patch ( -R ) and the errors are away  :Wink: 

i've noticed no other difference so far

BtW i got a standard cherry keyboard on a desktop pc.. i dont know wich key produces this error. it occurs when i log in and x is coming up

----------

## TenPin

Removing that patch doesn't help in my case because test10 vanilla gives an error when I press a key that I want to use, hence xev doesn't detect the keypress, otherwise everthing is great with test10 and mm.

----------

## NeighborhoodGullwings

I too had problems with my keyboard with the 2.6 kernel. I've tried so far the mm-sources test9 and test10, as well as development-sources test9 and test10.

My keyboard is a Compaq "Easy Access Keyboard" (although my comp isn't a compaq anymore). And the extra buttons along the top work great in gs-sources using the lineakd program, but only some of them work in 2.6. I think some of the keyboard mappings have changed.

I'd like to know if this is a universal issue or if there's something we need to do to correct it.

----------

## BarryJ

I'm having similar issues with my MS Office keyboard in 2.6 (Gentoo sources for test11).  Some of the multimedia keys work, some don't.  Dmesg adds this for the ones that don't:

keyboard.c: can't emulate rawmode for keycode 245

----------

## DJ_Grijander

Add another one to the list. This is what I get with kernel 2.6.0-pre11 vanilla sources and one of my internet keys:

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

atkbd.c: Unknown key released (translated set 2, code 0x154, data 0x9a, on isa0060/serio0).
```

I seems that the system actually reads a keycode (154), but it doesn't run the associated action. Definitely, it seems that something is wrong with the new kernel and the keyboard driver...

----------

## Vanquirius

Well, problem persists with 2.6.0-stable.

Even my "vanilla" ps/2 keyboard behaves very funky.

No idea whatsoever of what to do.

----------

## maw

Mine just comes up strange... X handles the key map fine, the basic letter keys all work, on the console, but after that...

# seems to have turned into 'switch to previous vt'

Shift-3 (which should give me £ as I'm on a UK keyboard and keymap) gives me ú

Other similar oddities happen with other keys. I have no idea what's going on here... this is with 2.6.0 final, my keyboard is a Logitech Cordless Comfort, UK layout, connected with USB.

----------

## Vanquirius

Considering that everything is working fine in X, I suppose I can let go having the keyboard work properly in console. However, it is still very annoying to see @^ sprawling around my screen as my computer boots. I wonder, is there any way to effectively block any keyboard input in console? (leaving me with just X support...) It might sound like a stupid idea, but the console is of no use for me if I can't even login because of the funky keyboard problem. Thanks for any help.

----------

## Andersson

I just installed 2.6 today, and I have this keyboard error as well (only some multimedia keys work and "Unknown key released" errors in dmesg). Just wanted to hear if anyone has found a solution? My keyboard is a microsoft natural keyboard.

----------

## Andersson

I've been googling around looking for a solution, and even if I haven't found one I thought I'd post a few links about scancodes, keycodes, keymaps and non-standard keyboards. Just in case anyone wants to keep looking. I'll manage without those four keys for a while...

Some background on how keyboards work in linux:

http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-2.html

http://www.win.tue.nl/~aeb/linux/kbd/scancodes.html

http://rick.vanrein.org/linux/funkey/

About the atkbd.c: Unknown key pressed error:

http://testing.lkml.org/slashdot.php?mid=337181

Here's a longer thread with a little more background on this problem:

http://seclists.org/lists/linux-kernel/2002/Oct/0182.html

There is a fix suggested for that problem in those threads, to edit /usr/src/linux/drivers/input/keyboard/atkbd.c and change the scancodes right there in the source. I tried it, but must have gotten it wrong because I still couldn't get anything from that key. Perhaps I simply didn't know what I was doing.  :Smile: 

----------

## foosh

 *dippen wrote:*   

> the problem is the atkbd-24-compatibility patch wich is part of the mm sources since linux-2.4.20-test9-mm3.
> 
> reverse this patch ( -R ) and the errors are away 

 

could you explain more clearly how to reverse the patch please?

----------

## bi3l

Just try to re-apply the patch and you'll be done...

----------

## snakattak3

Same issue here. Gentoo-Dev-sources-2.6.1. Getting these messages in dmesg

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

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

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

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

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

 with some of my extra function keys. Some seem to work, and some don't. They all used to work with the old kernel. Has anyone found a fix or a hack yet? I was just going to copy the old 2.4.24 keyboard.c to the new kernel and replace it, but they are very different files, and from looking at the new layout, I don't think that the old keyboard.c can replace atkbd.c in the new 2.6 series.

----------

## kritip

I have the Microsoft Wireless Natural Multimedia Keyboard and Wireless Intellimouse Explorer V2.

With the stock 2.6 kernels i can't log in to the system (i don't start with X running). I can typically type 'root' hit return and then i just get a constant string of $$$$$$$$$$$$$$$$$$$$$$4 appearing with will comtinue forever until i press the volume up/doen buttons a few times, then all key non letter buttons on that console no longer work.

This has also been the case up until the latest mm releases where the keyboard will mow seem to type and then delete anything i type until i t sudden;y starts to work after many login attempts!!!! VERY odd. 

The keyboard and mouse both use the one USB port via wireless and i don't have these problems running a Knoppix (2.4 kernel) Disc. I haven't tried a Gentoo 2.4 kernel yet, as i built this system on the 2.6 kernel and don't really wanns don grade.

Also with the mm sources, a patch was applied that got my # key working, but the lastest rc of 2.6.2 non-mm doesn't even appear to ahve this applied!!

Does anyone else experiece these same symptoms?? I can't beleive something likethis would exist in a stable kernel, everything else runs fine!!!

Any other suggestions, test, or anyone i can report my problems to??

Cheers,

Kristian

----------

## maw

Well I just switched to 2.6.1-gentoo and lost my #~ key... I can get the # back with xmodmap but it's not having the ~ at all, except in combination with modeswitch :S

What DID they do to the keyboard map in 2.6???

----------

## jingo

Found this patch ... is this what is already in the mm?

http://www.spinics.net/lists/kernel/msg236787.html

I would think it should apply to my gentoo-dev-sources 2.6.1 kernel source, but I am having troubles applying it.

Anyone know if this solves the problem?

----------

## kritip

 *maw wrote:*   

> Well I just switched to 2.6.1-gentoo and lost my #~ key... I can get the # back with xmodmap but it's not having the ~ at all, except in combination with modeswitch :S
> 
> What DID they do to the keyboard map in 2.6???

 

try the latest mm sources, they will get you back a normal ~# rather than having to resort to xmodmap (which only applies to X doesn't it?) The latest mm sources have the fix for that (which i read somewhere was caused by a kernel developer from SuSE not thinking that particular key was used, don't quote me on that though)

Seems like my other problem of the scrolling $$ is not that common, at least the #~ is fixed now, i await every new kernel release in hope it fixes it.

Kristian

----------

## maw

I found a patch which I was able to manually apply to 2.6.1-gentoo, which has sorted things out in X, but the console's still mucked up. I'll try mm sources another day I think.

----------

## jingo

 *maw wrote:*   

> I found a patch which I was able to manually apply to 2.6.1-gentoo, which has sorted things out in X, but the console's still mucked up. I'll try mm sources another day I think.

 

This patch:

http://www.spinics.net/lists/kernel/msg236787.html

??

How did you apply it?

----------

## maw

No, it was a much simpler patch than that. Unfortunately I've lost the URL... the patch was by the same person though, so I suspect what you've found is a newer variant, especially given the reference to -mm3.

The one I did was only one hunk, so it was easy to do by hand.

----------

## To

I've exactly the same problem with my Microsoft Wireless Natural Multimedia Keyboard and Wireless Intellimouse Explorer V2.

Tó

----------

## Uncle_Psychosis

 *ManuChao wrote:*   

> Hello,
> 
> Some people may want to have me killed for that, but for the past months I've been using a MS Wireless Desktop (Keyboard + Mouse):
> 
> 

 

In my experience microsoft hardware is pretty damn good (a lot better than their software anyway!) 

I'm not sure I can help with the keymap problems, but for the people with multimedia key problems, have you tried using lineak? 

http://lineak.sourceforge.net/

I've not had any problems getting this to work (mind you, I've not tried using the "volume" and "mute" buttons yet but thats a whole new thread  :Smile:  ) 

HTH

Sam

----------

## Andersson

 *Uncle_Psychosis wrote:*   

> In my experience microsoft hardware is pretty damn good (a lot better than their software anyway!)

 

They're perfectly ok, I use an MS keyboard and mouse too.  :Smile: 

 *Uncle_Psychosis wrote:*   

> I'm not sure I can help with the keymap problems, but for the people with multimedia key problems, have you tried using lineak?

 

Lineak still needs to know what buttons you press. The problem is in the kernel, it doesn't translate all scancodes from the keyboard to keycodes the programs can read.

----------

## jingo

 *Uncle_Psychosis wrote:*   

>  *ManuChao wrote:*   Hello,
> 
> Some people may want to have me killed for that, but for the past months I've been using a MS Wireless Desktop (Keyboard + Mouse):
> 
>  
> ...

 

lineak won't do any good! The keys are rejected at kernel level, they will never reach lineak!

----------

## Uncle_Psychosis

 *jingo wrote:*   

> 
> 
> lineak won't do any good! The keys are rejected at kernel level, they will never reach lineak!

 

Ahh, my bad. I misunderstood the problem. Nevermind!

Edit: on second thoughts, I have the same problem. Logitech Internet Navigator Keyboard, and kernel 2.6.1-gentoo. Only some of the multimedia keys work (thankfully the most important (i.e media) ones do!)

Cheers

Sam

----------

## jingo

Anyone found a solution???

My multimedia keys still doesn't work!   :Sad: 

----------

## amigadave

I have just bought myself a shiny new logitech cordless desktop mx set. Running 2.6.2, everything detected fine, a feat which windows could not match ( click here to install the driver........eh!? ). However - a few of my keyboard buttons report as mouse buttons.

```
I: Bus=0010 Vendor=001f Product=0001 Version=0100

N: Name="PC Speaker"

P: Phys=isa0061/input0

H: Handlers=kbd event0 

B: EV=40001 

B: SND=6 

I: Bus=0003 Vendor=046d Product=c50b Version=2100

N: Name="Logitech USB Receiver"

P: Phys=usb-0000:00:11.2-2/input0

H: Handlers=kbd event1 

B: EV=12000b 

B: KEY=10000 7 ff800000 7ff febeffdf ffefffff ffffffff fffffffe 

B: ABS=100 0 

B: LED=fc1f 

I: Bus=0003 Vendor=046d Product=c50b Version=2100

N: Name="Logitech USB Receiver"

P: Phys=usb-0000:00:11.2-2/input1

H: Handlers=kbd mouse0 event2 

B: EV=12000f 

B: KEY=ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff 0

 0 1878 d800d100 1e0000 0 0 0 

B: REL=103 

B: ABS=100 0 

B: LED=fc00 

```

The above is from /proc/bus/input/devices. It seems to say that I have a mouse and a keyboard, and a keyboard. Not too sure about that one! Any ideas would be greatly appreciated, thanks

----------

## kayosiii

I hope to have this one solved soonish 

what I have discovered so far....

You need to emerge the most recent console-tools and kbd packages the keycodes will at least show up when I do this (following the suggestions given by  dmesg . I have just done a etc_update and will see what is working when I reboot the  computer.[/b]

----------

## kayosiii

you need to run setkeycodes to enable the unconfigured keys with the kernel. best to put it in a script and run it at boot time....

I am showing a script that works for my Sven 2500 compatible keyboard 

if you are trying to set this up for a different keyboard look at /etc/X11/xkb/symbols/inet and /etc/X11/xkb/keycodes/xfree86 the e0 numbers correspond to an internet key ie e012 == <I12>

I got the numbers by using dmesg and trial and error. if anybody finds the keycode for <I62> let me know

```

#!/bin/sh

setkeycodes e012 152 e023 160 e029 201 e01e 139 e01a 197 e026 154  e017 149 e025 205 e018 168 e031 167 e032 150 e028 200 

```

[/code]

----------

## sundiver2k

ManuChao

I've got the same problem with my Wireless MS Natural Keyboard and mouse.  I get infinite exclamation marks printed when booting to the console and the using it as USB.  Since I always boot to the console first, my only option was to push the magic button and turn the thing off.

I hooked it back up to the PS/2 port (both the mouse and the keyboard), and everything was fine.  I've searched and searched for this on the web, and this is the first mention of the same problem that I have been able to find.

It's extremely weird.  I'm not even going to worry about the other log messages about unknown key pressed until I get this one figured out.  Maybe someone should post this in the LKML to see what the developers can make of it.  I wouldn't begin to know what fixes this.

I'm running the stock kernel, 2.6.x

----------

## sundiver2k

bump

----------

## jingo

 *kayosiii wrote:*   

> you need to run setkeycodes to enable the unconfigured keys with the kernel. best to put it in a script and run it at boot time....
> 
> I am showing a script that works for my Sven 2500 compatible keyboard 
> 
> if you are trying to set this up for a different keyboard look at /etc/X11/xkb/symbols/inet and /etc/X11/xkb/keycodes/xfree86 the e0 numbers correspond to an internet key ie e012 == <I12>
> ...

 

This helped me alot.

Even I don't get why we can't just look in input.h to see the keycodes. Trial and error is not a great option. But I found all my keys in your post!

Thanks.

----------

## davecs

As I also have a Microsoft Natural Pro keyboard, and I have done something that works for me, I have posted it here:

https://forums.gentoo.org/viewtopic.php?p=1104717#1104717

Hope it is useful.

----------

## tightcode

I am having similar problems to what is reported here. I had thought it may have been the result of my KVM switch but I still am not sure. Some keys just act on their own or appear to remain stuck when they actually physically aren't. This typically seems to happen with the alt, ctrl and shift keys but not exclussively to them.

Anyways the reason I am writing is to offer a more automated way of getting a setkeycodes line like kayosiii provided, one that is automatically taylored to your needs. It only generates the setkeycodes line, it doesn't actually modify your system or run any system changing commands.

I will preface this by saying it may not be optimized but it runs quite well for me. You may have to change some of the paths in it to make it work and it uses php, not sh. Sorry I just can write more quickly in php.

```
#!/usr/bin/php -q

<?

$vlmresults = `cat /var/log/messages | grep setkeycodes | sed -r "s/([^\']+)([^ ]+) ([a-z0-9]{4}) ([^\\n]+)/\\3/g"`;

$vlmarray = explode("\n",trim($vlmresults));

unset($vlmresults);

if (!is_array($vlmarray)) { exit("Sorry no results were found.\n"); }

sort($vlmarray);

$vlmarray = array_unique($vlmarray);

$vlmcount = count($vlmarray);

$i = 0;

echo "Found {$vlmcount} unique keycodes needing to be set.\n";

$keycodelist = file_get_contents("/etc/X11/xkb/keycodes/xfree86");

foreach($vlmarray as $keycode) {

        $skeycode = "I".substr($keycode,-2);

        preg_match("/({$skeycode}>)([^0-9]+)([0-9]+)\;/i",$keycodelist,$matches);

        if ($matches[3]) { $dump .= (!$dump?"setkeycodes":"")." {$keycode} {$matches[3]}"; $i++; }

        else { $missing .= ($missing?", ":"").$keycode; }

}

echo "Matched {$i} out of {$vlmcount} keycodes. A total of ".($vlmcount-$i)." remain unkown ($missing).\n";

unset($vlmarray,$keycodelist);

echo "The following command should take care of it:\n";

echo "{$dump}\n";

?>

```

And example output from that shell script for those interested (timed):

```
# time ./checkkeycodes

Found 40 unique keycodes needing to be set.

Matched 37 out of 40 keycodes. A total of 3 remain unkown (e001, e003, e005).

The following command should take care of it:

setkeycodes e002 130 e004 132 e006 134 e007 135 e008 136 e00b 139 e00c 140 e00d 141 e00e 142 e00f 143 e011 145 e012 146 e013 147 e014 148 e015 149 e016 150 e017 151 e018 152 e01e 158 e01f 159 e023 163 e025 165 e026 166 e027 167 e028 168 e02b 171 e02c 172 e02f 175 e031 177 e033 179 e034 180 e039 185 e03c 188 e056 214 e060 224 e061 225 e07b 251

real    0m0.379s

user    0m0.189s

sys     0m0.205s

```

As you can see it still is quite fast. If you want a commented version or one which doesn't require cat, grep & sed let me know.

Particularities of my system which may be cause of differences if you have any:

- xorg 6.8.2

- PHP cli 4.3.10

Cheers,

TightCode

Post Scriptum: I put that together quickly. I don't know if the setkeycodes solves my problem yet.

----------

## dhaemon

Wow tighcode!

I have a Microsoft natural multimedia keyboard. Most of my keys(F1, F2 etc...) weren't detected... I tried almost eveything.

Your little prog sure solved a big pain for me! Having an unfunctional multimedia keyboard... pfffff...

But one thing: now that my Fx(x <- [1..12]) keys are recognized... How do I assign them to their correct values?

Thanks

----------

## tightcode

dhaemon, I have never changed the values of my F[1-12] keys. I am pretty sure you can use xmodmap though to do so. Here is the mapping currently in use on this machine:

```
$ xmodmap -pk

There are 4 KeySyms per KeyCode; KeyCodes range from 8 to 255.

    KeyCode     Keysym (Keysym) ...

    Value       Value   (Name)  ...

      8

      9         0xff1b (Escape)

     10         0x0031 (1)      0x002b (plus)   0x007c (bar)    0x00a1 (exclamdown)

     11         0x0032 (2)      0x0022 (quotedbl)       0x0040 (at)     0x0ac3 (oneeighth)

     12         0x0033 (3)      0x002a (asterisk)       0x0023 (numbersign)     0x00a3 (sterling)

     [...]

     67         0xffbe (F1)     0x1008fe01 (XF86_Switch_VT_1)

     68         0xffbf (F2)     0x1008fe02 (XF86_Switch_VT_2)

     69         0xffc0 (F3)     0x1008fe03 (XF86_Switch_VT_3)

     70         0xffc1 (F4)     0x1008fe04 (XF86_Switch_VT_4)

     71         0xffc2 (F5)     0x1008fe05 (XF86_Switch_VT_5)

     72         0xffc3 (F6)     0x1008fe06 (XF86_Switch_VT_6)

     73         0xffc4 (F7)     0x1008fe07 (XF86_Switch_VT_7)

     74         0xffc5 (F8)     0x1008fe08 (XF86_Switch_VT_8)

     75         0xffc6 (F9)     0x1008fe09 (XF86_Switch_VT_9)

     76         0xffc7 (F10)    0x1008fe0a (XF86_Switch_VT_10)

     [...]

     95         0xffc8 (F11)    0x1008fe0b (XF86_Switch_VT_11)

     96         0xffc9 (F12)    0x1008fe0c (XF86_Switch_VT_12)

     [...]

```

This format may be a little more usefull for you though for setting purpouses:

```
$ xmodmap -pke

keycode   8 =

keycode   9 = Escape

keycode  10 = 1 plus bar exclamdown

keycode  11 = 2 quotedbl at oneeighth

keycode  12 = 3 asterisk numbersign sterling

[...]

keycode  67 = F1 XF86_Switch_VT_1

keycode  68 = F2 XF86_Switch_VT_2

keycode  69 = F3 XF86_Switch_VT_3

keycode  70 = F4 XF86_Switch_VT_4

keycode  71 = F5 XF86_Switch_VT_5

keycode  72 = F6 XF86_Switch_VT_6

keycode  73 = F7 XF86_Switch_VT_7

keycode  74 = F8 XF86_Switch_VT_8

keycode  75 = F9 XF86_Switch_VT_9

keycode  76 = F10 XF86_Switch_VT_10

[...]

keycode  95 = F11 XF86_Switch_VT_11

keycode  96 = F12 XF86_Switch_VT_12

```

I included things other than the F keys so you'd have something to compare them too. Read up on xmodmap and setting your own mapping. My laptop has a non-international keyboard so it has less keys than I need so I did remap a few of the keys that were missing for may language layout, it is quite painless once it is done.

Cheers & Good Luck,

TightCode

----------

## davecs

The problems of setting up keyboards are not specific to Gentoo or any other distro.

You may wish to look up a "Tips and Tricks" I sent to Texstar's site:

http://www.pclinuxonline.com/modules.php?mop=modload&name=Splatt_Forums&file=viewtopic&topic=5224&forum=18&PHPSESSID=67c8bea21f7bff7ddc6574a30fe7b925

----------

## mje

I have the following hardware:

```

input: USB HID v1.11 Keyboard [Microsoft Microsoft Wireless Optical Desktop® 1.00] on usb-0000:00:02.1-3

input: USB HID v1.11 Mouse [Microsoft Microsoft Wireless Optical Desktop® 1.00] on usb-0000:00:02.1-3

```

and I am using the following kernel:

```

linux-2.6.11-gentoo-r7

```

Some of the multimedia keys on the top of the keyboard (e.g. "My Documents", "My Pictures", ...) do not work.  When I press them, they do not show up in the dmesg output, and even when I try to see the scancode they produce with 

```
 showkeys -s 
```

 they generate no output/scancode.  There are two things that make this even more strange.  First of all, if I instead look at keycodes with 

```
 showkeys -k 
```

 those keys do produce keycodes!  Second, the keyboard/mouse combo share the same plug, it has one USB output, and one PS/2 keyboard output.  Right now I'm using strictly the USB output.  If I use the PS/2 keyboard output though, I get all kinds of other problems (such as keys being pressed that I didn't even press!)

Anyways, my main question is to find out why those keys can generate keycodes but not scancodes.  Any ideas?

----------

