You are not logged in.

#1 2022-11-22 14:11:34

hully
Member
Registered: 2022-11-14
Posts: 149

Difference between wev codes and input-event-codes.h codes

I want to simulate the pressing of F5 with ydotool.

I got the keycode of F5 with wev, which shows:

[14:     wl_keyboard] key: serial: 2590; time: 844918; key: 71; state: 1 (pressed)
                      sym: F5           (65474), utf8: ''
[14:     wl_keyboard] key: serial: 2591; time: 844998; key: 71; state: 0 (released)
                      sym: F5           (65474), utf8: ''

so looks like the keycode is 71.

But

ydotool key 71:1 71:0

doesn't do.

Instead, ydotool's man page says it is using the keycodes from `/usr/include/linux/input-event-codes.h`, and

❯ cat /usr/include/linux/input-event-codes.h | grep F5
#define KEY_F5            63
#define KEY_FN_F5        0x1d6

so the correct keycode is 63, and indeed

ydotool key 63:1 63:0

works as expected.

What is the difference between these two types of keycodes?

Last edited by hully (2022-11-22 14:24:06)

Offline

#2 2022-11-23 08:14:54

hully
Member
Registered: 2022-11-14
Posts: 149

Re: Difference between wev codes and input-event-codes.h codes

Anyone?

Maybe it is not fit for the newbie corner?

Offline

#3 2022-11-23 13:01:36

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,427

Re: Difference between wev codes and input-event-codes.h codes

Don't do that: https://wiki.archlinux.org/title/Genera … es#Bumping

Xorg keycodes are generally 8 values larger than what's defined for the linux subsystem directly, likely for a few of the "fake" Xorg keys that allow manipulation/information of the xorg instance. since wev looks to emulate behavior of xev it will have taken this mapping into account.

Offline

#4 2022-11-26 07:19:00

hully
Member
Registered: 2022-11-14
Posts: 149

Re: Difference between wev codes and input-event-codes.h codes

oh ok. Thanks and sorry for the bump

Offline

Board footer

Powered by FluxBB