# screen brightness keys work, change is very slow



## phalange (Sep 16, 2020)

This is a T470s, and I started with only intel-backlight installed. I wanted to assign intel_backlight incr and decr to the brightness keys, but these are apparently not exposed to X. xev(1) sees the other xf86 keys (like volume), but not screen brightness.

So I put acpi_video_load="YES" in my loader.conf, and now I the brightness keys change the brightness.

But I have to press the key about 1000 times to effect any change. It's way too fine-grained.

I tried putting 
	
	



```
hw.acpi.video.led0.levels=10 20 [...] 100
```
 in sysctl.conf as per acpi_video(4), but no change in granularity. With no example, I can't even tell the correct syntax (comma, space, equal, colon).

Any suggestions?


----------



## Mjölnir (Sep 16, 2020)

`hw.acpi.video.lcd0.levels` is a readonly sysctl knob.  It tells which levels are available.  What you want is /usr/local/etc/devd/acpi-video-intel-backlight.conf:

```
notify 100 {
        match "system" "ACPI";
        match "subsystem" "Video";
        match "type" "brightness";
        action "/usr/local/bin/intel_backlight $notify";
};
```


----------



## phalange (Sep 16, 2020)

Thanks, I tried this but no change. Still each keypress makes only a tiny change in brightness. I'm surprised that setting hw.acpi... has no effect. The man page says the defaults can be set.


----------



## Mjölnir (Sep 16, 2020)

phalange said:


> Thanks, I tried this but no change. Still each keypress makes only a tiny change in brightness. I'm surprised that setting hw.acpi... has no effect. The man page says the defaults can be set.


EDIT 1st unload the acpi_video(4) and then load the acpi__vendor_ kernel module e.g. `kldload acpi_ibm`.  If it works, do `sysrc kld_list+=" acpi_ibm"` to make it persistent.
Next EDIT Maybe you have to reboot without acpi_video & with acpi_ibm; switching at runtime does not seem to work.


----------



## phalange (Sep 16, 2020)

acpi_ibm doesn't work. Anyway, thanks for the suggestions though.


----------



## Mjölnir (Sep 16, 2020)

Do you have graphics/drm-kmod install & configured?  My system is near your's, I have a ThinkPad T450s.  I also have acpi_wmi(4) loaded via `kld_list`, but I don't think that's related.


----------



## phalange (Sep 17, 2020)

I do have drm-kmod. I think I needed it to get video working.
I also have a T430s with FreeBSD which works really well. That one was even easier to configure since the brightness keys showed up as XF86MonBrightnessUp / Down in X.

And circling back, my brightness keys work, I was just hoping to decrease the number of brightness levels (and key presses) to something sane. It must be 100 right now.


----------



## George (Sep 17, 2020)

It seems more like an issue with the keyboard driver or window manager to me.

Acpi_video doesn't care about brightness keys at all. And yes, hw.acpi.video.lcd0.levels is read-only.

FreeBSD Laptops t430s says that intel-backlight is required for the media keys.


----------



## phalange (Sep 17, 2020)

Elazar said:


> It seems more like an issue with the keyboard driver or window manager to me.



That was my thought too. I'm using spectrwm. But using xev, there is no response to pressing Fn-F5 (brightness down) or Fn-F6 (up). The volume keys do show up. Fn-F1 -F2 -F3 all show up in xev as XF86[...]. And the F5 and F6 keys show up too, so the keys themselves are working.

And as I found, with acpi_video loaded, the brightness keys do work (Fn-F5 -F6), it just takes an extraordinary number of presses to make a change. But with or without acpi_video loaded, xev doesn't see those brightness keys.


----------



## Mjölnir (Sep 17, 2020)

The vendors change the key scancodes every now and then... You'd need to find a tool to log the keycodes and patch the appropiate driver...


----------



## phalange (Sep 17, 2020)

mjollnir said:


> The vendors change the key scancodes every now and then... You'd need to find a tool to log the keycodes and patch the appropiate driver...



Do you have a tool to suggest? I only know xev.


----------



## Mjölnir (Sep 17, 2020)

`psearch -s scan|grep -i key`: [...] misc/kbdscan              Show scancodes of keys pressed and released


----------



## ranefjord (Dec 7, 2020)

You have probably already checked this, but just in case.


Update BIOS.

On my T450s:
FN swap keys DISABLE
FN sticky DISABLE
F1-F12 as primary functions DISABLE
Trackpoint and trackpad ENABLE

And...
CSM support YES
If NO: Lenovo logo will display on boot
if YES: Thinkpad logo will display on boot


----------

