# keyboard ? [solved]

## max4ever

hmm, i really wanna get my keyboard to work the problem i have is that some "extra" keys seem dead, i've used all scancode and keycode progras i could think/come on this forum and they look like dead

and the only reply i got is "kernel 2.6 has bad keyboard support" WTF?   :Twisted Evil:   :Twisted Evil: 

i know about lineak, kdehotkeys, and other tools... but they are all worthless if those keys look dead(note they do WORK in windoze ofcourse...)

so any idea ? anything extra to compile in kernel or WHAT  :Crying or Very sad:  ?

so i'm using 2.6.7-gentoo-r14

kde 3.2

i have a BTC9110 keyboard

----------

## Zyne

same problem being discussed here: https://forums.gentoo.org/viewtopic.php?t=213694

weird thing is that showkey in console generates output for evey single key pressed, but showkey -s (scancodes) does NOT generate any output.

It appears to be a kernel limitation, where only 240 keys are "known" by the kernel.

edit: 

btw if you're really desperate to get all those keys working, you should switch back to a kernel 2.4.x

Appearantly they worked on that kernel

----------

## max4ever

i said i tryed all progs on this world  :Twisted Evil: , showkeys -s doesn't works either

isn't there a patch for this ? like to use kernel 2.4 keyboard support in kernel 2.6 ? any kernel guru guys, i REFUSE to switch switch to 2.4 for this, it took me for ever to get my 2.6.7 to work(2.6.8 doesn't works fine for me...cd burning, frame buffer...) and i don't wanna downgrade my kernel, wtf is the kernel team thinking  :Confused:  , each release more buggy than the previous  :Evil or Very Mad:  ...

kernel patch or any other ideas anyone ?   :Crying or Very sad: 

----------

## dtor

Ok, do you see messages like this:

```

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

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

```

What does happen if you follow the instructions and assign a keycode to the key? (you may want to use the latest kbd package - 1.12 I think has changes to properly support kernels 2.6).

----------

## jonnevers

I know you've said "you've tried every key program". but i've had great success with lineakd and my extra buttons on my keyboard. its in portage but find a howto set up guide. it lets you specify the keyboard you have, created a $HOME/.lineakd/lineakd.conf according to your keyboard. all you have to do it edit that conf and execute lineakd & at a terminal. or add it to your X session.

and using lineakd dosen't require any scancode, etc stuff. just emerge lineakd

hope that helps a little.

----------

## max4ever

dtor: no i don't see anything, like i use these progs to get the scancode/keycode or whatever when i press some key i see the "code" when i press my special keys i see nothing, no error, just nothing

umm kbd package? what's it ? what for if the key seem DEAD or as in NOT THERE, and again no errors ppl...   :Crying or Very sad: 

P.S. only 1 out of my four special button works... (with all progs, lineakd, scancode, ...)

----------

## dtor

If kernel gets a key press that it does not know keycode for (after all there are alot of different keyboards) it will emit the message I mentioned and you should see it in dmesg or /var/log/messages. Then setkeycode program can alther kernel's keycode table to make the key "known".

----------

## max4ever

anyway no such file/dir as /var/log/messages  :Confused: 

so the fist key code = enter

2nd key = one special key

then i press the others and nothing shows up

```
max@linuxoid max $ showkey -s

kb mode was XLATE

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

0x9c

0xe0 0x5f 0xe0 0xdf

max@linuxoid max $ ls -lha /var/log/

total 3.4M

drwxr-xr-x   8 root    root    4.0K Aug 24 19:02 .

drwxr-xr-x  21 root    root    4.0K Aug 24 02:03 ..

-rw-r--r--   1 root    root     36K Aug 24 20:51 Xorg.0.log

-rw-r--r--   1 root    root     37K Aug 24 03:36 Xorg.0.log.old

-rw-r--r--   1 root    root     528 Aug 25  2004 amedyn

drwxr-xr-x   2 root    root    4.0K Aug 24 02:14 apache2

drwxr-xr-x   2 root    root    4.0K Aug  7 14:08 cups

-rw-rw----   1 portage portage 626K Aug 24 20:36 emerge.log

-rw-r--r--   1 root    root    261K Aug 24 19:56 kdm.log

-rw-r--r--   1 root    root    286K Aug 24 17:29 lastlog

drwxr-xr-x   2 mysql   mysql   4.0K Aug 24 02:47 mysql

drwxr-xr-x   2 root    root    4.0K Jul 18 03:15 news

drwxr-xr-x   2 root    root    4.0K Aug 22 16:54 samba

drwxr-xr-x   2 root    root    4.0K Aug 22 22:42 samba3

-rw-r--r--   1 root    root    4.0K Aug 24 20:10 scrollkeeper.log

-rw-rw-r--   1 root    utmp    2.4M Aug 24 20:58 wtmp

-rw-r--r--   1 root    root    1.3K Aug 14 19:55 xdm.log
```

----------

## dtor

What about dmesg?

----------

## Zyne

the problem is that they produced keycodes are > 255.

appearantly the linux kernel (at least the 2.6 series) can't work with any keycode higher then 255

eg:

```

# showkey

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)...

keycode  28 release

keycode 256 press

keycode 256 release

keycode 257 press

keycode 257 release

keycode 258 press

keycode 258 release

keycode 259 press

keycode 259 release

```

problem is that there are no scancodes being produced only because the keycodes are >255.

just fucked up shit imho...

I have about 16 keys that appear to be dead on my keyboard, but theyµ 

really do work. The keycodes are just higher then 255 :/

about the /var/log/messages:

emerge syslog-ng should take care of this.  :Razz: 

----------

## dtor

Well, but the atkbd internal translation table is 512:

static unsigned char atkbd_set2_keycode[512] = {

.....

Can I please see your dmesg? I am really curios...

----------

## Zyne

here's my dmesg.

I have 16 keys that don't work, and I pressed them one by one just before posting this:

http://rb.t35.com/test/dmesg.txt

have fun!  :Very Happy: 

----------

## dtor

Oh, USB one... I was thinking about standard (PS/2) keyboard... I'll have to check something...

----------

## dtor

Ok, so right, by default X is working in raw PS/2 mode which can not transmit keykodes above 240. 

Have you tried using evdev interface. I have looked at the Gentoo's Xorg sources and it seems that it includes evdev keyboard and mouse driver by Z. Hull which is activated by setting

```

Option "Protocol" "evdev"

```

in inputdevice section for the keyboard.

Evdev interface shoudl handle your additional keys just fine.

----------

## Zyne

I already tried that a while ago... 

However Xorg casts the following error:

```

Config Error:

"evdev" is not a valid keyboard protocol name

(EE) Unable to determine the screen layout

(EE) Error parsing the config file

```

----------

## dtor

Do you have the latest emerged? I see it in patchset 1.2... but then I don't have it installed.. You may want to file a bug against xorg package if you are using the latest version and evdev does not work for you at all.

----------

## Zyne

evdev works for my mouse, so I was thinking it should be working for my keyboard too...

I'm in the process of recompiling the entire package now though... Maybe I needed to recompile xorg after adding evdev to the kernel...

either way, I found a great tut on setting the whole thing up here: http://www.linuxinfor.com/english/XFree-Local-Multi-User/tweak_input_devs-phys.html

let's hope it works out now...  :Smile: 

----------

## max4ever

umm sylog-ng was installed just not running...

so anyway yeap i press all the four extra keys and this is what shows up in /var/log/messages

```
Aug 25 02:27:44 linuxoid atkbd.c: Unknown key pressed (translated set 2, code 0xad on isa0060/se

rio0).

Aug 25 02:27:44 linuxoid atkbd.c: Use 'setkeycodes e02d <keycode>' to make it known.

Aug 25 02:27:44 linuxoid atkbd.c: Unknown key released (translated set 2, code 0xad on isa0060/s

erio0).

Aug 25 02:27:44 linuxoid atkbd.c: Use 'setkeycodes e02d <keycode>' to make it known.

Aug 25 02:27:44 linuxoid atkbd.c: Unknown key pressed (translated set 2, code 0xa7 on isa0060/se

rio0).

Aug 25 02:27:44 linuxoid atkbd.c: Use 'setkeycodes e027 <keycode>' to make it known.

Aug 25 02:27:44 linuxoid atkbd.c: Unknown key released (translated set 2, code 0xa7 on isa0060/s

erio0).

Aug 25 02:27:44 linuxoid atkbd.c: Use 'setkeycodes e027 <keycode>' to make it known.

Aug 25 02:27:45 linuxoid atkbd.c: Unknown key pressed (translated set 2, code 0xa3 on isa0060/se

rio0).

Aug 25 02:27:45 linuxoid atkbd.c: Use 'setkeycodes e023 <keycode>' to make it known.

Aug 25 02:27:45 linuxoid atkbd.c: Unknown key released (translated set 2, code 0xa3 on isa0060/s

erio0).

Aug 25 02:27:45 linuxoid atkbd.c: Use 'setkeycodes e023 <keycode>' to make it known.
```

ok what does that mean? and should i setkeycode...  :Smile:  ? i pressed just 4 keys in a order, it probably only shows 3 cose one of them works with showkey

p.s. what is evdev ? what is kbd package ? u ment kde hot keys or what ?

----------

## dtor

 *max4ever wrote:*   

> 
> 
> ok what does that mean? and should i setkeycode...  ?

 

Well, it depends on whether you still want your keys working or not  :Smile: 

Now the rest is easy  :Mr. Green:  You need to decide what functions you want to assign to your keys in X. I would think you'd want

XF86WWW, XF86AudioPlay, XF86AudioStop, etc. Look in your XKB symbol map and see what XKB symbols assigned to these functions (like <I05>, <I06>), etc. Then look in XKB keycode table and see what keycodes assigned to these symbols.

Now look in kernel source drivers/char/keyboard.c - x86_keycodes array and search for the keycode you want. Actually you shoudl be looking for keycode + 128. If you find it note the index at which it resides - that will be your argument to setkeycode.

Example:

I want to have my "Play" button to be mapped to XF86AudioPlay which is symbol <XFER> with keycode 129. Therefore we are looking for 129 + 128 = 257 which resides in x86_keycodes at position 171. Unmapped they key produces raw scancode 0x81 and kernel suggets to use "setkeycode e001 <keycode>" so I use "setkeycode e001 171" and - viola! - they key works just fine in X.

When looking at x86_keycodes 133 is in position 

 *max4ever wrote:*   

> 
> 
> p.s. what is evdev ? what is kbd package ? u ment kde hot keys or what ?

 

"evdev" is now preferred method for communifcating with Linux input system, via /dev/input/eventX devices as it allows to describe in much more detail what happened.

"kbd" is userspace package for tuning Linux input system. It operates on lower level compared to kde hot keys:

Kernel->Xserver->Window manager

kbd affects link between kernel and Xserver

whereas kde hot keys works on winfdow manager level I believe

Hope taht helps.  :Mr. Green: 

----------

## max4ever

umm, ok i really didn't understood anything from there... (well almost  :Wink:  )  :Shocked: 

can u try to explain in plain english/for a n00b way  :Embarassed: 

what i want is when i'd use for example xev

and i'd press those keys i'd get their keycodes so i can use them with lineakd or whatever i'd want kdehotkeys/lineakd/... to make them usefull, so what i basically need to understand is how to get the keys to work, not how to bind them to something...  :Rolling Eyes: 

p.s. i'm using Xorg and i have no XF86WWW or ...   :Laughing: 

----------

## dtor

 *max4ever wrote:*   

>  so what i basically need to understand is how to get the keys to work, not how to bind them to something... 
> 
> 

 

Using "setkeycodes e02d <keycode>" (and the same for e023 and e023) will make your keyboard emut the desired keycodes and you will see them in xev. What I was trying to explain is which keycode you need to assign (via setkeycodes) so it produces useful result in X.

 *max4ever wrote:*   

> 
> 
> p.s. i'm using Xorg and i have no XF86WWW or ...  

 

Well, did they change symbol names as well? I don't know. Look into /usr/X11R6/lib/X11/xkb/symbols/inet file - it describes bunch of "internet" keyboards with their mappings and symbol names. Foe example I am using inspiron variant (as in inet(inspiron)).

----------

## blaster999

Well, a little question: I want to make "Files" button work. I think it is I66, and this corresponds to keycode 230. So 230+128=358, but there is no 358 in x86_keycodes. What can I do to make that work?

----------

## max4ever

hi again   :Mr. Green: 

umm, i noticed that i have to use sekeycode each time i boot...  is there some way to do this "stable" other than adding it to the /etc/conf.d/local.start(if it'll work even...) ?   :Rolling Eyes: 

well i kind of understood that u wanted me to bind (...somehow with black magic  :Smile:  ... ) these keys to some "functions" offered by X, yeap they have still same name, but obviously since you're a GURU in all the keys stuff... you forgot to mention that

stuff like "XKB symbol map" and "XKB keycode" is something from /etc/X11/xkb (i found lates on another thread) right ? anyway i still don't understand those things...

but i have another question

in windoze, when i press the extra 4th key an extra LED(light) turned on and all my F1...F12 keys had another function, then i'd press it again all my keys would go back to normal, i wonder if i can do that with linux too :/    :Question:  i don't care about the LED(though it'd be nice since it tells you if F* keys have normal or "modified" functions)and if yes what software you'd recommend ? 

thanks   :Smile: 

----------

## dtor

Unfortunately while I can fnd my way around the kernel I am not an expert in XKB stuff... I actually spent like 2 hours the day before yesterday setting my internet keys up before witing that post...

Anyway, I think you will have to set up your 4th key as a "modifier" key to change bindings of yout other F-keys. You really need to read XKB documentation and HOWTO as what you are asking is beyond my knowledge to give you exact instructions. All I know is what you are asking should be doable.

As far as binding your "Files" key. If the keycode you are looking for is missing in x86_keycodes table try to find another symbol that is present in x86_keycodes but not mapped in your XKB keyboard model and change the XKB symbols. For example if you wanted I66 but it is not available but you see code for I23 in x86_config use setkeycodes to mak scancode to I23 and then change symbols mapping to have I23 produce X86<whatever_function>.

----------

## max4ever

hi again

well i still have one question unanswered... from the previous post...

 *Quote:*   

> i noticed that i have to use sekeycode each time i boot... is there some way to do this "stable" other than adding it to the /etc/conf.d/local.start(if it'll work even...) ? 

 

and i still didn't understood your last paragraph   :Laughing:   well maybe a little  :Razz: 

----------

## dtor

 *max4ever wrote:*   

> hi again
> 
> well i still have one question unanswered... from the previous post...
> 
>  *Quote:*   i noticed that i have to use sekeycode each time i boot... is there some way to do this "stable" other than adding it to the /etc/conf.d/local.start(if it'll work even...) ?  
> ...

 

You could try editing drivers/input/keyboard/atkbd.c::atkbd_set2_keycode

array and put your values there, but I think calling setkeycodes from some init script is the best. I am not sure how init system works in Gentoo, on my mutated RH installation I have it in rc.local

----------

