PINE64
Pinebook Remapping Keyboard with Xmodmap - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook (https://forum.pine64.org/forumdisplay.php?fid=76)
+--- Forum: Linux on Pinebook (https://forum.pine64.org/forumdisplay.php?fid=79)
+--- Thread: Pinebook Remapping Keyboard with Xmodmap (/showthread.php?tid=5087)



Pinebook Remapping Keyboard with Xmodmap - MarkHaysHarris777 - 09-04-2017

Greetings, 

This is a follow-up to the "dead Alt keys issue" on my Pinebook;  the corner pin(12) of the 8051 is bent, which resulted in dead Alt keys (both of them); neither one send scancodes from my keyboard.

What I did to get full functionality (including AltGr key) is to connect a usb numeric keypad to the Pinebook, and then use xmodmap (part of the x11-xserver-utils package) to remap the keysym(s) kp_left and kp_right and  kp_begin  to Alt_L and Alt_R and  Control_R!

I did not have xmodmap installed on my xenial-i3 image, so I had to install it with :

       sudo apt install x11-xserver-utils

1) the first step is to build an xmodmap file of the current mapping :

       xmodmap -pke  >xmodmap_original

       The file is human readable...   study it.

2) second step is to copy the original file, and then edit the copy :

       cp  xmodmap_original  xmodmap_changes

original
Code:
keycode  83 = KP_Left KP_4 KP_Left KP_4
keycode  84 = KP_Begin KP_5 KP_Begin KP_5
keycode  85 = KP_Right KP_6 KP_Right KP_6


changed
Code:
keycode  83 = Alt_L Meta_L Alt_L Meta_L
keycode  84 = Control_R NoSymbol Control_R
keycode  85 = Alt_R Meta_R Alt_R Meta_R


3) save the changes file and then activate your new xmodmap with :

       xmodmap  ~/xmodmap_changes


Congratulations !   The keypad  left and right are now  Alt_L and Alt_R !

Notes:

   You can check the new keysym(s) with the tool  xev.  xev can be used to check your entire keyboard, and mouse;  it will report the scancode (keycode) and keysym for all keys including the numeric keypad.

   This only works in x11.  What we're doing here is to set a different keysym in x11 for a given scancode.  So, in x11, in the above example,  scancode(s) 64 and 108 now do nothing in x11;  and the scancode(s)  83 and 85  now take on new meaning(s)  ...  new keysyms !  

   The kp_begin  (keypad 5)  has been remapped as Control_R ;  interesting because the Pinebook doesn't even have a Control_R  !

   The changes are lost with reboot;  unless, the xmodmap is executed at startup in rc.local, or as a systemd service one-shot !


Shy


RE: Pinebook Remapping Keyboard with Xmodmap - MarkHaysHarris777 - 09-06-2017



I carried the xmodmap keyboard remapping to the next level by remapping some of the rest of the numeric keypad for useful  i3  work ;  then I added bindsym entries in  ~/.config/i3/config  to be able to map and unmap the keyboard with a single keystroke !

KP_Insert --> Super_L

KP_Delete --> Super_R

KP_Enter --> Return

KP_begin --> Control_R


bindsym entries in ~/.config/i3/config

bindsym  $mod+Shift+KP_Add  exec  xmodmap  ~/xmodmap_changes

bindsym  $mod+Shift+KP_Subtract  exec  xmodmap  ~/xmodmap_original


Shy