Brightness keys binded to the same scancode

Hi guys.

I’m trying to get the brightness keys to work, but I’m stuck.

i3 configuration:

# Sreen brightness controls
bindsym XF86MonBrightnessUp exec xbacklight -inc 20 # incr>
bindsym XF86MonBrightnessDown exec xbacklight -dec 20 # de>

If I execute those commands, I can change the brightness correctly. But if I press the brightness keys, they don’t work.

So, executing sudo journalctl -f I can see this happening when I press the brightness up button:

ott 04 12:39:09 PCABS kernel: atkbd serio0: Unknown key pressed (translated set 2, code 0xab on isa0060/serio0).
ott 04 12:39:09 PCABS kernel: atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
ott 04 12:39:09 PCABS kernel: atkbd serio0: Unknown key released (translated set 2, code 0xab on isa0060/serio0).
ott 04 12:39:09 PCABS kernel: atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.

In order to get the keycode for the event, I ran sudo evtest:

Available devices:
/dev/input/event0:	Lid Switch
/dev/input/event1:	Power Button
/dev/input/event2:	Power Button
/dev/input/event3:	AT Translated Set 2 keyboard
/dev/input/event4:	HP Wireless hotkeys
/dev/input/event5:	ST LIS3LV02DL Accelerometer
/dev/input/event6:	PC Speaker
/dev/input/event7:	PS/2 Generic Mouse
/dev/input/event8:	HDA NVidia HDMI/DP,pcm=3
/dev/input/event9:	HDA NVidia HDMI/DP,pcm=7
/dev/input/event10:	HDA NVidia HDMI/DP,pcm=8
/dev/input/event11:	HDA NVidia HDMI/DP,pcm=9
/dev/input/event12:	HDA NVidia HDMI/DP,pcm=10
/dev/input/event13:	ELAN0710:01 04F3:30ED Mouse
/dev/input/event14:	ELAN0710:01 04F3:30ED Touchpad
/dev/input/event15:	Video Bus
/dev/input/event16:	HP Wide Vision HD Camera: HP Wi
/dev/input/event17:	Video Bus
/dev/input/event18:	HDA Intel PCH Mic
/dev/input/event19:	HDA Intel PCH Headphone
/dev/input/event20:	HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event21:	HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event22:	HDA Intel PCH HDMI/DP,pcm=8
/dev/input/event23:	HDA Intel PCH HDMI/DP,pcm=9
/dev/input/event24:	HDA Intel PCH HDMI/DP,pcm=10
/dev/input/event25:	HP WMI hotkeys
/dev/input/event26:	Logitech G903

The event25 is the one I chose, getting this:

Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "HP WMI hotkeys"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 138 (KEY_HELP)
    Event code 141 (KEY_SETUP)
    Event code 148 (KEY_PROG1)
    Event code 153 (KEY_DIRECTION)
    Event code 224 (KEY_BRIGHTNESSDOWN)
    Event code 225 (KEY_BRIGHTNESSUP)
    Event code 226 (KEY_MEDIA)
    Event code 240 (KEY_UNKNOWN)
    Event code 358 (KEY_INFO)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
  Event type 5 (EV_SW)

So we have the codes for brightness up and down, 244 and 245. So now I can run sudo setkeycodes e02b 224 and the brightness down key starts to work. But, if I press the brightness up key, it does not increase the brightness, but it decreases it, because the two physical buttons share the same scancode.

Pressing brightness down before setkeycodes:

ott 04 12:46:50 PCABS kernel: atkbd serio0: Unknown key pressed (translated set 2, code 0xab on isa0060/serio0).
ott 04 12:46:50 PCABS kernel: atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
ott 04 12:46:50 PCABS kernel: atkbd serio0: Unknown key released (translated set 2, code 0xab on isa0060/serio0).
ott 04 12:46:50 PCABS kernel: atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.

Pressing brightness up before setkeycodes:

ott 04 12:48:03 PCABS kernel: atkbd serio0: Unknown key pressed (translated set 2, code 0xab on isa0060/serio0).
ott 04 12:48:03 PCABS kernel: atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.
ott 04 12:48:03 PCABS kernel: atkbd serio0: Unknown key released (translated set 2, code 0xab on isa0060/serio0).
ott 04 12:48:03 PCABS kernel: atkbd serio0: Use 'setkeycodes e02b <keycode>' to make it known.

As you can see, the scancode (e02b) it’s the same for both the keys.

Is there any way to remap the keys or to solve this issue? Thanks!

1 Like

Welcome aboard!

What does xev return?

xev -event keyboard
KeyRelease event, serial 25, synthetic NO, window 0x7a00001,
    root 0x134, subw 0x0, time 68368090, (-179,60), root:(532,432),
    state 0x10, keycode 233 (keysym 0x1008ff02, XF86MonBrightnessUp), same_screen YES,
    XLookupString gives 0 bytes:
    XFilterEvent returns: False

Is mine, for brightness up.

If I run xev -event keyboard right after boot, pressing the brightness key doesn’t output anything.

If I run sudo setkeycodes e02b 224 and then xev -event keyboard, I get this:

KeymapNotify event, serial 26, synthetic NO, window 0x0,
    keys:  4294967198 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   

KeymapNotify event, serial 26, synthetic NO, window 0x0,
    keys:  4294967198 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   
           0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0

The first one is brightness down, the second one is brightness up. As you can see, they are practically identical.

Then for some reason it is not detected. The only thing I can think of is to work around it, perhaps use control or alt and the Function key.

:Edit: What is the make & model? HP? Then I will have a search.

Similar problems:

Yeah, HP Pavilion Gaming - 15-dk0030nl, but I have already updated the BIOS, now I tried to power reset, but still not working.

Sorry, missed your reply, go for the work round, assign to another key that is recognised.

I’ll mark this as solution, for now. Thank you anyway!