View Single Post
Old 01-30-2023, 12:08 AM   #47
elinkser
Addict
elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.elinkser has survived committing the World's Second Greatest Blunder.
 
Posts: 242
Karma: 146236
Join Date: Oct 2022
Device: Kobo Clara HD
*** UPDATE - YOU CAN POSSIBLY AVOID EXTRA CONFIGURATION OF THIS COMMENT BY USING LIBINPUT DRIVER - SEE COMMENT AFTER THIS ONE ***



Linux keyboard configuration seems to be complicated and ever changing, and I found the xmodmap method no longer effective.


But Xkbcomp allowed me to get my USB keyboard keys working on my Kobo:


To get current keyboard config:

apk add xkbcomp
xkbcomp $DISPLAY old.xkb

Copy the old keyboard layout, just in case we mess up:

cp old.xkb new.xkb



Now, for each malfunctioning key(Column1 below), get the keycodes(Column2) and their misassigned function(Column3):

apk add xev
xev -event keyboard

(Get the codes by clicking each key):

Right : 114, NoSymbol
Up : 111, Print
Left : 113, Alt_R
Down : 116, Super_R

Print : 107, Delete
Alt_R : 108, KP_Enter
Menu : 135, No_Symbol

PgUp : 112, KP_Divide
PgDn : 117, Menu
Home : 110, Pause
End : 115, Super_L
Scroll: 78, Scroll_Lock
Pause : 127, NoSymbol
Insert: 118, NoSymbol
Delete: 119, Nosymbol


Now open the keyboard layout file and find in the "xkb_keycodes" section the aliases(Column1 below) assigned to refer to each keycode(Column3 below) that our keyboard gave us:

mc -bv new.xkb

BRK :Right : 114, NoSymbol
PRSC :Up : 111, Print
RALT :Left : 113, Alt_R
RWIN : Down : 116, Super_R

DELE :Print : 107, Delete
KPEN :Alt_R : 108, KP_Enter
I07 :Menu : 135, No_Symbol

KPDV :PgUp : 112, KP_Divide
MENU :PgDn : 117, Menu
PAUS :Home : 110, Pause
LWIN :End : 115, Super_L
SCLK :Scroll: 78, Scroll_Lock
SUPR :Pause : 127, NoSymbol
FK13 :Insert: 118, NoSymbol
FK14 : Delete: 119, Nosymbol


As you see, some of our malfunctioning keys have already assigned functions (Column4 above), but none are essential, so we will comment them out in the "xkb_symbols" section, where the functions are assigned (but DO NOT edit anything in the"xkb_keycodes" section):

nano new.xkb

Do a Ctrl-W search for each of the misassigned key code aliases above(Column1) to comment them out, IN THE "xkb_symbols" SECTION ONLY:

BRK : Nothing to comment out (Unassigned, NoSymbol)
PRSC: Comment out:
// Key <PRSC> {
// ...
// };
RALT : Comment out:
// Key <RALT> {[ Alt_R, Meta_R ]};
RWIN : Comment out:
// Key <RWIN> {[ Super_R ]};
DELE : Comment out:
// Key <DELE> {[ Delete ]};
KPEN : Comment out:
// Key <KPEN> {[ KP_Enter ]};
I07 : Nothing to comment out (Unassigned, NoSymbol)
KPDV : Comment out:
// Key <KPDV> {
// ...
// ;
MENU : Comment out:
// Key <MENU> {[ Menu ]};
PAUS : Comment out:
// Key <PAUS> {
// ...
// ;
LWIN : Comment out:
// Key <LWIN> {[ Super_L ]};
SCLK : Comment out:
// Key <SCLK> {[ Scroll_Lock ]};
SUPR: Nothing to comment out (Unassigned, NoSymbol)
FK13: Nothing to comment out (Unassigned, NoSymbol)
FK14 : Nothing to comment out (Unassigned, NoSymbol)


Phew! Do a Ctrl-O Save!


Now, we will just replace in the "xkb_keycodes" section the default alias names(Column1) with the aliases our keys gave us(Column3) :


HOME : 97 : PAUS
UP : 98 : PRSC
PGUP : 99 : KPDV
LEFT : 100 : RALT
RGHT : 102 : BRK
END : 103 : LWIN
DOWN : 104 : RWIN
PGDN : 105 : MENU
INS : 106 : FK13
DELE : 107 : FK14


Change "key <HOME> {[ Home ]};" to "key <PAUS> {[ Home ]};"
Change "key <I2C> {[ Up ]};" to "key <PRSC> {[ Up ]};"
Change "key <PGUP> {[ Prior]};" to "key <KPDV> {[ Prior]};"
Change "key <I10> {[ Left ]};" to "key <RALT> {[ Left, Left ]};"
Change "key <I19> {[ Right ]};" to "key <BRK> {[ Right ]};"
Change "key <END> {[ End ]};" to "key <LWIN> {[ End ]};"
Change "key <I2E> {[ Down ]};" to "key <RWIN> {[ Down ]};"
Change "key <PGDN> {[ Next ]};" to "key <MENU> {[ Next ]};"
Change "key <INS> {[ Insert]};" to "key <FK13> {[ Insert ]};"
Change "key <DELE> {[ Delete ]};" to "key <FK14> {[ Delete ]};"



Do a Ctrl-O Save , Ctrl-X exit, and load up the keymap:

xkbcomp new.xkb $DISPLAY

Last edited by elinkser; 02-02-2023 at 08:14 PM.
elinkser is offline   Reply With Quote