[opensuse] Mapping and re-mapping Keyboard Keys
Hi, I asked this question before but I still have been unable to work out how to resolve it. This is on an ubuntu 17.04 box. I have asked twice on ubuntu forums but have had no replies at all in 2 years! Also I seem to get more sense out of those on the opensuse list. :) I have a very old keyboard, Tiny branded (yes Tiny! remember them?) PS/2 keyboard (model: KB-9805). It has many hotkeys on the top, currently they either do not work (xev doesn't show up the press) or they are mapped wrong (xev shows that a diffferent button has been pressed). It is a great keyboard as it is built to last. Currently I have used it for 19 years and it has still not even had the letters wear off! Unlike my other PC with which I have lost count how many modern keyboards I have worn out. Current mappings are as follows (Key > Mapping): Internet > Mute Close > Not detected HK1 > Home Page HK2 > Not detected HK3 > Vol + HK4 > Calculator Prev Track > Vol down Stop > Stop Play > Play Next Track > Next Track Vol + > Not detected Vol - > Not detected Mute > Not detected Sleep > Not detected So I need change the mappings of: Internet / HK1 / HK3 / HK4 / Prev Track so that they are recognized by the system as the correct key. Then I need to add mappings to: Close / HK2 / Vol + / Vol - / Mute / Sleep so they are recognized at all! As far as I understand it, when you press a button the kernel sends a scancode to the system which then maps it to a keycode. They keycode is then used to map to a function. Is this correct? So far I have found that if I press a key that does not work (in this case the close hotkey, then run dmesg | tail -2 I get this output: [23566.462308] atkbd serio0: Unknown key released (translated set 2, code 0xa3 on isa0060/serio0). [23566.462311] atkbd serio0: Use 'setkeycodes e023 <keycode>' to make it known. This gives me, on the first line 0xa3 and on the second line e023 What are these two codes? Are they the scancode or keycode? As for the keys that do work I have found that if I go to a terminal (ctrl + alt + f2) and press one of the keys that are already mapped to something (in this case the internet hotkey) then run showkey -k I get this output: 0xe0 0x20 0xe0 0xa0 I am assuming I can ignore the 0xe0? So this leaves me with 0x20 and 0xa0 which I assume are key press and key release. Is this correct? Are they the scancode or keycode? I have written these codes down for all my hotkeys. How can I now change their mappings? Any help would be greatly appreciated. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Am 26.06.2017 um 22:44 schrieb Paul Groves:
[23566.462308] atkbd serio0: Unknown key released (translated set 2, code 0xa3 on isa0060/serio0). [23566.462311] atkbd serio0: Use 'setkeycodes e023 <keycode>' to make it known.
This gives me, on the first line 0xa3 and on the second line e023 What are these two codes? Are they the scancode or keycode?
Well, read the message: "Use setkeycodes e023 <keycode>". The command man setkeycodes (run it in a terminal or google it) explains in detail how setkeycodes works. "dumpkeys" will tell you which keycodes the kernel understands. Note: I tried to run those commands on the Desktop and they fail there with "Couldn't get a file descriptor referring to the console". They probably only work on a text-mode console. Try Ctrl+Alt-F1 to switch to one. Ctrl+Alt+F6 or F7 to go back to the Desktop. If you don't know about this, write the key combinations down before you try them or be ready to reboot your system the hard way.
As for the keys that do work I have found that if I go to a terminal (ctrl + alt + f2) and press one of the keys that are already mapped to something (in this case the internet hotkey) then run showkey -k I get this output:
0xe0 0x20 0xe0 0xa0
I am assuming I can ignore the 0xe0?So this leaves me with 0x20 and 0xa0 which I assume are key press and key release. Is this correct? Are they the scancode or keycode?
If you ignore 0xe0, then the code means "Space" and "Non-breaking space". Let's hope you don't have to ignore them (or you won't be able to map the key without losing your space bar as well). Those codes look very similar the the first agument for setkeycodes, so my guess is they are scancodes.
I have written these codes down for all my hotkeys. How can I now change their mappings?
Find out the key codes and run a script at boot time which contains a series of calls to setkeycodes. /etc/init.d/rc.local is a good place for this. Preferable after the key table has been loaded - that will overwrite any changes you make. Good to know when you make a mistake. I also suggest you have a second computer in the same network so you can ssh into the box when you messed up the keyboard so badly that you can't do anything anymore. Note: Running the command from an autostart script for your Desktop or .bashrc/.profile won't work. Regards, -- Aaron "Optimizer" Digulla a.k.a. Philmann Dark "It's not the universe that's limited, it's our imagination. Follow me and I'll show you something beyond the limits." http://blog.pdark.de/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Op maandag 26 juni 2017 23:52:31 CEST schreef Aaron Digulla:
Am 26.06.2017 um 22:44 schrieb Paul Groves:
[23566.462308] atkbd serio0: Unknown key released (translated set 2, code 0xa3 on isa0060/serio0). [23566.462311] atkbd serio0: Use 'setkeycodes e023 <keycode>' to make it known.
This gives me, on the first line 0xa3 and on the second line e023 What are these two codes? Are they the scancode or keycode?
Well, read the message: "Use setkeycodes e023 <keycode>". The command
man setkeycodes
(run it in a terminal or google it) explains in detail how setkeycodes works. "dumpkeys" will tell you which keycodes the kernel understands.
Note: I tried to run those commands on the Desktop and they fail there with "Couldn't get a file descriptor referring to the console". They probably only work on a text-mode console. Try Ctrl+Alt-F1 to switch to one. Ctrl+Alt+F6 or F7 to go back to the Desktop. If you don't know about this, write the key combinations down before you try them or be ready to reboot your system the hard way.
As for the keys that do work I have found that if I go to a terminal (ctrl + alt + f2) and press one of the keys that are already mapped to something (in this case the internet hotkey) then run showkey -k I get this output:
0xe0 0x20 0xe0 0xa0
I am assuming I can ignore the 0xe0?So this leaves me with 0x20 and 0xa0 which I assume are key press and key release. Is this correct? Are they the scancode or keycode?
If you ignore 0xe0, then the code means "Space" and "Non-breaking space". Let's hope you don't have to ignore them (or you won't be able to map the key without losing your space bar as well).
Those codes look very similar the the first agument for setkeycodes, so my guess is they are scancodes.
I have written these codes down for all my hotkeys. How can I now change their mappings?
Find out the key codes and run a script at boot time which contains a series of calls to setkeycodes. /etc/init.d/rc.local is a good place for this.
Better place: /etc/init.d/after.local
Preferable after the key table has been loaded - that will overwrite any changes you make. Good to know when you make a mistake. I also suggest you have a second computer in the same network so you can ssh into the box when you messed up the keyboard so badly that you can't do anything anymore.
Note: Running the command from an autostart script for your Desktop or .bashrc/.profile won't work.
Regards,
-- Gertjan Lettink, a.k.a. Knurpht openSUSE Board Member openSUSE Forums Team -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 26/06/17 22:52, Aaron Digulla wrote:
Am 26.06.2017 um 22:44 schrieb Paul Groves:
[23566.462308] atkbd serio0: Unknown key released (translated set 2, code 0xa3 on isa0060/serio0). [23566.462311] atkbd serio0: Use 'setkeycodes e023 <keycode>' to make it known.
This gives me, on the first line 0xa3 and on the second line e023 What are these two codes? Are they the scancode or keycode? Well, read the message: "Use setkeycodes e023 <keycode>". The command
what about the 0xa3? What is that for?
man setkeycodes
(run it in a terminal or google it) explains in detail how setkeycodes works. "dumpkeys" will tell you which keycodes the kernel understands.
Note: I tried to run those commands on the Desktop and they fail there with "Couldn't get a file descriptor referring to the console". They probably only work on a text-mode console. Try Ctrl+Alt-F1 to switch to one. Ctrl+Alt+F6 or F7 to go back to the Desktop. If you don't know about this, write the key combinations down before you try them or be ready to reboot your system the hard way.
Yes it only works in a tty not in a desktop terminal
As for the keys that do work I have found that if I go to a terminal (ctrl + alt + f2) and press one of the keys that are already mapped to something (in this case the internet hotkey) then run showkey -k I get this output:
0xe0 0x20 0xe0 0xa0
I am assuming I can ignore the 0xe0?So this leaves me with 0x20 and 0xa0 which I assume are key press and key release. Is this correct? Are they the scancode or keycode? If you ignore 0xe0, then the code means "Space" and "Non-breaking space". Let's hope you don't have to ignore them (or you won't be able to map the key without losing your space bar as well).
I have written these codes down for all my hotkeys. How can I now change their mappings? Find out the key codes and run a script at boot time which contains a series of calls to setkeycodes. /etc/init.d/rc.local is a good place for
Those codes look very similar the the first agument for setkeycodes, so my guess is they are scancodes. So does this therefore make the scancode e020 for key press and e0a0 for key release? this. How do I find out the keycodes from my system?
Also can I define my own keycodes for Hotkeys 1 through 4? This would be ideal because then I can then go into the Keyboard Shortcuts in system settings and choose there functions in the GUI (which is what these keys are intended for).
Preferable after the key table has been loaded - that will overwrite any changes you make. Good to know when you make a mistake. I also suggest you have a second computer in the same network so you can ssh into the box when you messed up the keyboard so badly that you can't do anything anymore.
Note: Running the command from an autostart script for your Desktop or .bashrc/.profile won't work.
Regards,
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hi, isn't xmodmap (man xmodmap) doing this job? Karl Am 26.06.2017 um 22:44 schrieb Paul Groves:
Hi, I asked this question before but I still have been unable to work out how to resolve it.
This is on an ubuntu 17.04 box. I have asked twice on ubuntu forums but have had no replies at all in 2 years! Also I seem to get more sense out of those on the opensuse list. :)
I have a very old keyboard, Tiny branded (yes Tiny! remember them?) PS/2 keyboard (model: KB-9805). It has many hotkeys on the top, currently they either do not work (xev doesn't show up the press) or they are mapped wrong (xev shows that a diffferent button has been pressed).
It is a great keyboard as it is built to last. Currently I have used it for 19 years and it has still not even had the letters wear off! Unlike my other PC with which I have lost count how many modern keyboards I have worn out.
Current mappings are as follows (Key > Mapping):
Internet > Mute
Close > Not detected
HK1 > Home Page
HK2 > Not detected
HK3 > Vol +
HK4 > Calculator
Prev Track > Vol down
Stop > Stop
Play > Play
Next Track > Next Track
Vol + > Not detected
Vol - > Not detected
Mute > Not detected
Sleep > Not detected
So I need change the mappings of: Internet / HK1 / HK3 / HK4 / Prev Track so that they are recognized by the system as the correct key.
Then I need to add mappings to: Close / HK2 / Vol + / Vol - / Mute / Sleep so they are recognized at all!
As far as I understand it, when you press a button the kernel sends a scancode to the system which then maps it to a keycode. They keycode is then used to map to a function. Is this correct?
So far I have found that if I press a key that does not work (in this case the close hotkey, then run dmesg | tail -2 I get this output:
[23566.462308] atkbd serio0: Unknown key released (translated set 2, code 0xa3 on isa0060/serio0). [23566.462311] atkbd serio0: Use 'setkeycodes e023 <keycode>' to make it known.
This gives me, on the first line 0xa3 and on the second line e023 What are these two codes? Are they the scancode or keycode?
As for the keys that do work I have found that if I go to a terminal (ctrl + alt + f2) and press one of the keys that are already mapped to something (in this case the internet hotkey) then run showkey -k I get this output:
0xe0 0x20 0xe0 0xa0
I am assuming I can ignore the 0xe0? So this leaves me with 0x20 and 0xa0 which I assume are key press and key release. Is this correct? Are they the scancode or keycode?
I have written these codes down for all my hotkeys. How can I now change their mappings?
Any help would be greatly appreciated.
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Just short information, extended information in the manpage of xmodmap. basically there's a file .xmodmap in which all the "keycodes" are assigned to an "action" (I'm using the "" because I'm not sure about the proper naming) Just read the manpage or look for information in the web about xmodmap and you should be able to solve this. Karl Am 27.06.2017 um 13:25 schrieb Paul Groves:
On 27/06/17 09:22, Karl Sinn wrote:
Hi,
isn't xmodmap (man xmodmap) doing this job?
Karl
I would have no idea, which is why I am asking.
-- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (4)
-
Aaron Digulla
-
Karl Sinn
-
Knurpht - Gertjan Lettink
-
Paul Groves