LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-30-2006, 02:04 AM   #1
Kaname
LQ Newbie
 
Registered: May 2006
Posts: 15

Rep: Reputation: 0
xev and setkeycode


Hello everyone!

I'm setting up my Internet Keys (or Multimedia Keys) of my keyboard (A4Tech KBS-26 in Japanese).

If I press a "Calendar key" under "xev" it said the key is not recognized, so looking at "dmesg -c" it display me:

Code:
atkbd.c: Unknown key pressed (translated set 2, code 0x95 on isa0060/serio0).
atkbd.c: Use 'setkeycodes e015 <keycode>' to make it known.
So, I entered: "setkeycodes e015 149"

I used 149, because looking on similar models and using the tool "getscancodes" (from keytouch), I seems to be the correct value. But the problem is that when I run that command and running again xev, and pressing "calendar" button, it display:

Code:
KeyRelease event, serial 30, synthetic NO, window 0x1400001,
    root 0x44, subw 0x0, time 5803500, (463,406), root:(467,433),
    state 0x10, keycode 151 (keysym 0x1008ff58, unknown), same_screen YES,
    XLookupString gives 0 bytes:
My question is: Why the keycode is not the same? if I specified "149" why it is "151" on xev?

The problem is that it seems there is no relation from the values I enter as keycode in "setkeycodes" and the values i recieve on "xev" for my "special keys".

What I did was looking for each value from 100 to 255 until I get the reading on xev as "149".

It worked, but I didn't add those values to my .Xmodmap, (or even a paper). After reboot, I loose those values and I have to do it again... I want to learn the correct way to do it... any suggestion?

Thank you!
 
Old 12-30-2006, 10:50 PM   #2
FnordPerfect
Member
 
Registered: Dec 2006
Location: Germany
Distribution: Kubuntu (Feisty Fawn), Debian (SID)
Posts: 127

Rep: Reputation: 15
I have a similar problem.

My guess is that the Linux kernel manages its own scancode-to-keycode translation table, and I remember to once have read that when the X server starts it takes over this table but henceforth both are managed seperatly.

So this utility that you use, setkeycodes, only manipulates the kernel's translation table, so xev in X does still not recognize it correctly.

Thus the assignment of scancodes to keycodes have to take place during boot, before X starts.
You could try to write a simple shell script (e.g. repairkeyboard.sh) which is executed at boot time.

Code:
#!/bin/sh
#           scancode  keycode
setkeycodes e015      149
setkeycodes e016      <keycode>
# and so on..
Make it executable with chmod +x repairkeyboard.sh and make sure it is started by init somewhen before X starts. This is distribution-dependend, so I cannot tell you how. On Debian-based ones it might go in /etc/init.d and called from /etc/rc2.d or /etc/rc.local

But then you still have to assign proper Xkeysyms to the keys. e.g. using xmodmap. The keysyms go in ~/.Xmodmap:
Code:
"keycode 149 = Calendar"
Rather than doing that, you might have a look at lineakd which might assist you doing that.

Hope that was somewhat helpful
Cheers
fabian

Last edited by FnordPerfect; 12-30-2006 at 10:52 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot find xev miro277 Linux - Software 9 03-26-2006 01:02 PM
fn keys and xev kmisfit Linux - Laptop and Netbook 3 02-08-2006 12:27 AM
xev gone from mandrake 10? McKnight Mandriva 2 06-27-2004 02:53 PM
Looking for xev.c nonconformative Programming 2 11-30-2003 01:06 PM
xev package fruibat_2000 Linux - Software 0 09-08-2003 05:52 AM


All times are GMT -5. The time now is 03:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration