Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
Due to network maintenance being performed by our provider, LQ will be down starting at 05:01 AM UTC. The exact duration of the downtime isn't currently known. We apologize for the inconvenience.
|
 |
04-07-2011, 01:06 PM
|
#1
|
|
LQ Newbie
Registered: Apr 2011
Posts: 3
Rep:
|
Problem re-mapping non-standard keys to modifier keys
I'm running Debian (Squeeze) and I have a toshiba portege m700. It has five buttons on the front just under the screen, which are the only ones accessible when you flip the screen over into tablet mode. One of them is for rotating the screen, and another is for switching to external display. I want to remap the remaining three to control, alt and super so that I can use shortcuts with the stylus.
The problem is, when I used showkey to find out the key codes, I found out that each button generates more than one key code:
Button 1:
key 126 press >> super_r, although this is distinct from the actual super key (125)
key 7 press >> 6
key 7 release
key 126 release
Button 2: (you can guess what this button was supposed to be for)
key 29 press >> control_L
key 56 press >> alt_L
key 111 press >> delete
key 111 release
key 56 release
key 29 release
Button 3:
key 125 press >> super_r, the same as keyboard super
key 45 press >> x
key 45 release
key 125 release
As far as I can tell both the key codes and scan codes for most of these are identical to the keys whose outputs they match. I don't know a way to remap all of these to a single keypress, and needless to say I don't want to lose keys like 6 or x. I've tried simply making the key combination a shortcut for what I want, but as I want modifier keys, the extra keypresses making up the shortcut interfere. Possibly it would help to write some sort of script to ignore the rest of the key events - after which I could just remap the first one to what I want, but I lack the expertise to do something like that myself.
Any help would be greatly appreciated. I've spent a fruitless day trawling the world wide interwebs to no avail, and it would be really good to get it working.
|
|
|
|
04-08-2011, 09:50 AM
|
#2
|
|
Guru
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,002
|
Is the coding for the keys any clearer if you use xev to grab the codes?
I could not get showkey to work, and this is from man showkey
Code:
2.6 KERNELS
In 2.6 kernels key codes lie in the range 1-255, instead of 1-127. Key codes larger than 127 are returned as three bytes
of which the low order 7 bits are: zero, bits 13-7, and bits 6-0 of the key code. The high order bits are: 0/1 for
make/break, 1, 1.
In 2.6 kernels raw mode, or scancode mode, is not very raw at all. Scan codes are first translated to key codes, and
when scancodes are desired, the key codes are translated back. Various transformations are involved, and there is no
guarantee at all that the final result corresponds to what the keyboard hardware did send. So, if you want to know the
scan codes sent by various keys it is better to boot a 2.4 kernel. Since 2.6.9 there also is the boot option atkbd.soft‐
raw=0 that tells the 2.6 kernel to return the actual scan codes.
|
|
|
|
04-09-2011, 12:41 AM
|
#3
|
|
LQ Newbie
Registered: Apr 2011
Posts: 3
Original Poster
Rep:
|
I tried it with xev, with results along a similar line. Here's what I got:
Code:
Button 1
KeyPress event, serial 32, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1044571, (703,-16), root:(709,466),
state 0x0, keycode 134 (keysym 0xffec, Super_R), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1044572, (703,-16), root:(709,466),
state 0x40, keycode 15 (keysym 0x36, 6), same_screen YES,
XLookupString gives 1 bytes: (36) "6"
XmbLookupString gives 1 bytes: (36) "6"
XFilterEvent returns: False
KeyRelease event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1044730, (703,-16), root:(709,466),
state 0x40, keycode 15 (keysym 0x36, 6), same_screen YES,
XLookupString gives 1 bytes: (36) "6"
XFilterEvent returns: False
KeyRelease event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1044733, (703,-16), root:(709,466),
state 0x40, keycode 134 (keysym 0xffec, Super_R), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
Button 2
KeyPress event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1060093, (703,-16), root:(709,466),
state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1060095, (703,-16), root:(709,466),
state 0x4, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1060099, (703,-16), root:(709,466),
state 0xc, keycode 119 (keysym 0xffff, Delete), same_screen YES,
XLookupString gives 1 bytes: (7f) ""
XmbLookupString gives 1 bytes: (7f) ""
XFilterEvent returns: False
KeyRelease event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1060255, (703,-16), root:(709,466),
state 0xc, keycode 119 (keysym 0xffff, Delete), same_screen YES,
XLookupString gives 1 bytes: (7f) ""
XFilterEvent returns: False
KeyRelease event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1060257, (703,-16), root:(709,466),
state 0xc, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1060261, (703,-16), root:(709,466),
state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
Button 3
KeyPress event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1069481, (703,-16), root:(709,466),
state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyPress event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1069482, (703,-16), root:(709,466),
state 0x40, keycode 53 (keysym 0x78, x), same_screen YES,
XLookupString gives 1 bytes: (78) "x"
XmbLookupString gives 1 bytes: (78) "x"
XFilterEvent returns: False
KeyRelease event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1069486, (703,-16), root:(709,466),
state 0x40, keycode 53 (keysym 0x78, x), same_screen YES,
XLookupString gives 1 bytes: (78) "x"
XFilterEvent returns: False
KeyRelease event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1069493, (703,-16), root:(709,466),
state 0x40, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
And for reference:
super key
KeyPress event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1074698, (703,-16), root:(709,466),
state 0x0, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1074760, (703,-16), root:(709,466),
state 0x40, keycode 133 (keysym 0xffeb, Super_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
6 key
KeyPress event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1053566, (703,-16), root:(709,466),
state 0x0, keycode 15 (keysym 0x36, 6), same_screen YES,
XLookupString gives 1 bytes: (36) "6"
XmbLookupString gives 1 bytes: (36) "6"
XFilterEvent returns: False
KeyRelease event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1053647, (703,-16), root:(709,466),
state 0x0, keycode 15 (keysym 0x36, 6), same_screen YES,
XLookupString gives 1 bytes: (36) "6"
XFilterEvent returns: False
alt key
KeyPress event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1064655, (703,-16), root:(709,466),
state 0x0, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1064715, (703,-16), root:(709,466),
state 0x8, keycode 64 (keysym 0xffe9, Alt_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
delete key
KeyPress event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1065572, (703,-16), root:(709,466),
state 0x0, keycode 119 (keysym 0xffff, Delete), same_screen YES,
XLookupString gives 1 bytes: (7f) ""
XmbLookupString gives 1 bytes: (7f) ""
XFilterEvent returns: False
KeyRelease event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1065673, (703,-16), root:(709,466),
state 0x0, keycode 119 (keysym 0xffff, Delete), same_screen YES,
XLookupString gives 1 bytes: (7f) ""
XFilterEvent returns: False
control key
KeyPress event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1064072, (703,-16), root:(709,466),
state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XmbLookupString gives 0 bytes:
XFilterEvent returns: False
KeyRelease event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1064153, (703,-16), root:(709,466),
state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
x key
KeyPress event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1072429, (703,-16), root:(709,466),
state 0x0, keycode 53 (keysym 0x78, x), same_screen YES,
XLookupString gives 1 bytes: (78) "x"
XmbLookupString gives 1 bytes: (78) "x"
XFilterEvent returns: False
KeyRelease event, serial 35, synthetic NO, window 0x6a00001,
root 0x112, subw 0x0, time 1072511, (703,-16), root:(709,466),
state 0x0, keycode 53 (keysym 0x78, x), same_screen YES,
XLookupString gives 1 bytes: (78) "x"
XFilterEvent returns: False
I just noticed that button 1 is right super, not left super, but it's still the only one with a unique ID. And my main problem is still that they are generating more than one key press.
|
|
|
|
04-09-2011, 01:49 AM
|
#4
|
|
Guru
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,002
|
xev is reporting the same behaviour. Those are strange keys.
Does this change if you add the option atkbd.soft‐raw=0 to your kernel boot line?
|
|
|
|
04-09-2011, 05:03 AM
|
#5
|
|
LQ Newbie
Registered: Apr 2011
Posts: 3
Original Poster
Rep:
|
No, it's the same. I'm pretty sure it's just lazy design of the laptop, rather than weird settings.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 06:03 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|