Finding special key codes and bindings

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
EfficientPup
Posts: 29
Joined: Thu Jun 03, 2021 8:19 pm
Has thanked: 7 times

Finding special key codes and bindings

Post by EfficientPup »

I have a keyboard on this laptop that isn't in the inet file and I played around with terminal finding the modifiers, etc. I did everything in this old topic from 14 years ago on finding special keys and finally used the script showkey when not running X. There is this "Fn" special key for extending the F1-F12 keys and a few others but nothing else would detect that keypress to identify the keysym code. The showkey file output lists it as 0x9d so I searched inet and nothing found. I can't do anything with it (in /root/.jwm/jwmrc-personal to edit it myself) if I don't have the "XF86....." code so what's next?

HerrBert
Posts: 357
Joined: Mon Jul 13, 2020 6:14 pm
Location: Germany, NRW
Has thanked: 18 times
Been thanked: 126 times

Re: Finding special key codes and bindings

Post by HerrBert »

Hello.

I'm not an expert on this...

Different manufacturers use different functions for Fn-keys. Some kernels provide support for these Fn-keys, mostly acpi-functions if i'm not totally wrong.
To get keycodes/keynames for specific keys, try to use xev from a terminal. Not all Fn-keys may be recognized...

EfficientPup
Posts: 29
Joined: Thu Jun 03, 2021 8:19 pm
Has thanked: 7 times

Re: Finding special key codes and bindings

Post by EfficientPup »

HerrBert wrote: Sun Aug 15, 2021 6:40 pm

Hello.

I'm not an expert on this...

Different manufacturers use different functions for Fn-keys. Some kernels provide support for these Fn-keys, mostly acpi-functions if i'm not totally wrong.
To get keycodes/keynames for specific keys, try to use xev from a terminal. Not all Fn-keys may be recognized...

I forget if I tried xev but I've come across it for sure, very unlikely to help since I still need to get BionicPup to recognize the key in the first place and then remap it. Ubuntu 20 does fully recognize it and all the special acpi-functions work. I need to see what that config file is like then see if Bionic can somehow do the same. This subject area is a bit muddled because there are various layers from key press to then what the PC does with that through the kernel, and then xkb, etc. I was just starting to read up on this because its a interest of mine and the "0x9d" format is known as a scan code.

User avatar
bigpup
Moderator
Posts: 6983
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 903 times
Been thanked: 1522 times

Re: Finding special key codes and bindings

Post by bigpup »

EfficientPup,

What specific Puppy version are you using?
Yes it makes a difference in how Puppy works!
We always need this info.

Really better if you provide this info:
viewtopic.php?f=2&t=218

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

User avatar
bigpup
Moderator
Posts: 6983
Joined: Tue Jul 14, 2020 11:19 pm
Location: Earth, South Eastern U.S.
Has thanked: 903 times
Been thanked: 1522 times

Re: Finding special key codes and bindings

Post by bigpup »

Look in the mouse/keyboard wizard->Keyboard->Advanced Configuration->Keyboard model

There are some specific keyboards listed for specific laptops.
See if yours is one of them.

The things you do not tell us, are usually the clue to fixing the problem.
When I was a kid, I wanted to be older.
This is not what I expected :o

EfficientPup
Posts: 29
Joined: Thu Jun 03, 2021 8:19 pm
Has thanked: 7 times

Re: Finding special key codes and bindings

Post by EfficientPup »

I tried this xev cmd in Ubuntu:

Code: Select all

xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'

and it didn't really work at all surprisingly like it did on BionicPup64 8.5 . That little action window would still pop up on the left (what is it for?) and I could type but no codes and nothing for mod keys like ctrl, alt, etc. Nothing for Fn key. I could close one of the windows generated by this cmd the 2nd time and on Ubuntu its known as "unknown" when hovered over :D .

To reiterate my goal is to find the scan code of the "Fn" key on my laptop which appears to be hard for no reason. All typical first steps have been pursued.

TerryH
Posts: 637
Joined: Mon Jun 15, 2020 2:08 am
Has thanked: 158 times
Been thanked: 160 times

Re: Finding special key codes and bindings

Post by TerryH »

EfficientPup wrote: Thu Aug 19, 2021 10:01 pm

I tried this xev cmd in Ubuntu:

Code: Select all

xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'

and it didn't really work at all surprisingly like it did on BionicPup64 8.5 . That little action window would still pop up on the left (what is it for?) and I could type but no codes and nothing for mod keys like ctrl, alt, etc. Nothing for Fn key. I could close one of the windows generated by this cmd the 2nd time and on Ubuntu its known as "unknown" when hovered over :D .

To reiterate my goal is to find the scan code of the "Fn" key on my laptop which appears to be hard for no reason. All typical first steps have been pursued.

xev will display the key combinations of keys pressed. If the action window has focus, when keys are pressed it may show the keys codes you are looking for. It doesn't always work in some installations. The key information is displayed in the terminal window you ran xev from.

New Laptop - ASUS ZenBook Ryzen 7 5800H Vega 7 iGPU / 16 GB RAM

williams2
Posts: 1062
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 305 times

Re: Finding special key codes and bindings

Post by williams2 »

Why do you want the keycode for the Fn key?

Depending how you set the default in the bios, pressing the F3 key will be either F3 or XF86MonBrightnessUp

I can send either key using xdotool, like this:
xdotool key F3
xdotool key XF86MonBrightnessUp

No need to know the Fn key code.

I can right click any icon on the desktop, click Edit Item, then click the box to set a shortcut key.
Pressing F3 sets the shortcut to the F3 key.
Pressing Fn+F3 sets the shortcut to XF86MonBrightnessUp.
So i can execute it as if I clicked the icon by pressing either F3 or Fn+F3, depending which shortcut key I chose.
No need to know the Fn key code.

By the way, hexadecimal 0x9d is decimal 157
Typing xmodmap -pke tells me that key code 157 is XF86Launch2
keycode 157 = XF86Launch2 NoSymbol XF86Launch2

EfficientPup
Posts: 29
Joined: Thu Jun 03, 2021 8:19 pm
Has thanked: 7 times

Re: Finding special key codes and bindings

Post by EfficientPup »

Good additional info from both, and I also found this about the Fn key on laptops:

"The Fn key is intercepted by the Embedded Controller ("EC") of your laptop. It doesn't produce a normal key symbol...This means you cannot customize it, because ECs for laptops are all different, and if they are configurable, the manufacturer keeps that secret."

There is always more going on than I first thought.

williams2
Posts: 1062
Joined: Sat Jul 25, 2020 5:45 pm
Been thanked: 305 times

Re: Finding special key codes and bindings

Post by williams2 »

If you enable sticky keys, Puppy does seem to know if the Fn key was pressed or not, and treats the Fn key the same as the other mod keys.

For example, with sticky keys enabled, you can press and release the shift key, then, after a pause, you can press the c key which will type an uppercase C.

Same for all the other keys, and the other mod keys (shift, alt, ctrl, Win-key.)

The thing is, pressing then releasing the Fn key, then, after a pause, pressing one of the function keys (F1 to F12), types the correct key (at least, in xev.) That is, Puppy seems to know that the last key that was pressed and released, was the Fn key, and sticky keys treats the Fn key the same as all the other mod keys.

Post Reply

Return to “Users”