Page 1 of 1

Finding special key codes and bindings

Posted: Sun Aug 15, 2021 12:32 am
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?


Re: Finding special key codes and bindings

Posted: Sun Aug 15, 2021 6:40 pm
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...


Re: Finding special key codes and bindings

Posted: Mon Aug 16, 2021 3:28 am
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.


Re: Finding special key codes and bindings

Posted: Mon Aug 16, 2021 2:01 pm
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


Re: Finding special key codes and bindings

Posted: Mon Aug 16, 2021 2:11 pm
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.


Re: Finding special key codes and bindings

Posted: Thu Aug 19, 2021 10:01 pm
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.


Re: Finding special key codes and bindings

Posted: Thu Aug 19, 2021 11:16 pm
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.


Re: Finding special key codes and bindings

Posted: Fri Aug 20, 2021 6:54 am
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


Re: Finding special key codes and bindings

Posted: Mon Aug 23, 2021 4:12 am
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.


Re: Finding special key codes and bindings

Posted: Mon Aug 23, 2021 4:44 am
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.