I finally solved this using a couple of workarounds.
The first step was making the keys detectable. I had a laptop of a similar model (Lenovo Z400) and I looked at what keycodes were generated for it. Based on that, I put this in my /etc/rc.local/
:
setkeycodes e054 225 # Brightness up -> brightness up
setkeycodes e04c 224 # Brightness down -> brightness down
The second step was making the keys change the brightness. I first noticed that running xdotool key 232
and xdotool key 233
increased and decreased the brightness perfectly (including the change notification in Unity). Then I tried two things to get the brightness to work.
First, I noticed that xev
now showed me the events XF86MonBrightnessUp
and XF86MonBrightnessDown
for the two keys, which means everything was working fine at the X level. So I simply used Ubuntu's shortcut manager and registered the two keys (which were read as their XF86 equivalents) to the xdotool
commands. This worked great!
However, some weeks later, due to some packages/drivers I changed, xev
stopped reporting the XF86 events and so the above method did not work. However, acpi_listen
showed that video/brightnessdown
and video/brightnessup
events were being generated, so then, after some googling, I put the following in a new file, /etc/acpi/events/ideapad-monitor-brightness-up
:
# same event as reported by acpi_listen
event=video/brightnessup BRTUP 00000086 00000000 K
action=su vivek -c "export DISPLAY=:0.0; xdotool getactivewindow && xdotool key 233 2>&1 > /tmp/log"
# The redirection into /tmp/log probably doesn't make any difference
and also an equivalent ideapad-monitor-brightness-down
file with xdotool key 232
and that solved the problem. Haven't had any problems since. :)
The issue is related to the Renoir graphics in AMD 4000 series processors. Here is a Phoronix article that gives a short description of it. Starting from Linux kernel 5.5, Renoir support was marked as no longer experimental. Kernel 5.7 is the newest kernel, so updating to that provides support for your processor.
I have a laptop with a 4500U. Upgrading to 5.7 helped fix every issue besides the brightness control.
The following steps to install the kernel comes from this answer which is a general version of an ubuntuforums.org post from user lykwydchykyn. The following steps contain some additions that I found useful when installing the kernel:
Go here (sorted by most recent build): https://kernel.ubuntu.com/~kernel-ppa/mainline/?C=N;O=D
Select the build you want, then navigate to the amd64/ directory.
Download 3 (maybe 4) debs to a folder somewhere:
linux-headers-VERSION-NUMBER_all.deb
linux-headers-VERSION-NUMBER_amd64.deb
linux-image-VERSION-NUMBER_amd64.deb
linux-image-extra-VERSION-NUMBER_amd64.deb # if available
Install the debs with whatever package manager front-end you use, or use these commands:
cd /path/to/folder/where/you/put/the/debs
sudo dpkg -i *.deb
An additional resource is the Ubuntu wiki which explains how to install an upstream kernel with generic instructions. This is good for learning that you choose either the generic kernel or the lowlatency kernel and don't download all of them (like I did at first): https://wiki.ubuntu.com/Kernel/MainlineBuilds
Best Answer
FOR 12.10
Okay, I found an answer in this page.
This solved my brightness problems permanently:
You will find this line in the new opened window:
Change it to:
Save and close the window and type this in the terminal:
and reboot.
FOR 13.04