How to make the screen brightness keys work again in KDE: Difference between revisions

From www.ReeltoReel.nl Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
First, we have to find the screen device, which is located somewhere in the /sys/devices/pci0000:00 directory.
First, we have to find the screen device, which is located somewhere in the /sys/devices/pci0000:00 directory.


Somewhere in this directory is a file located with the name 'brightness'. Let's find it.
Somewhere in this directory is a file located with the name 'brightness'. Let's find it. So, as root:
  #find /sys/devices/pci0000:00 -name "brightness"
  # find /sys/devices/pci0000:00 -name "brightness"
  /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness
  /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness
  /sys/devices/pci0000:00/0000:00:1c.2/0000:24:00.1/leds/mmc0::/brightness
  /sys/devices/pci0000:00/0000:00:1c.2/0000:24:00.1/leds/mmc0::/brightness
Line 16: Line 16:


When you read the content of the 'file', you get the current brightness level:
When you read the content of the 'file', you get the current brightness level:
  #cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness
  # cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness
  235
  235


The value lies somewhere between 0 and 255, it's a one byte value.
The value lies somewhere between 0 and 255, it's a one byte value.


You can test if this work for you by writing a different value to that file: (remeber to substitute the file for your graphics card)
You can test if this work for you by writing (still as root) a different value to that file: (remember to substitute the file for your graphics card)
  #echo 200 > /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness
  # echo 200 > /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness


If this works, you should see the brightness change, and you can go to the next step.
If this works, you should see the brightness change, and you can go to the next step.


I created a simple QAD(quick and Dirty) 3 line script to read that value and increase it:
I created a simple QAD(quick and Dirty) 3 line script to read that value and increase it.
 
I put the script in my home user's bin directory:
user> vi ~/bin/brp
<pre>
<pre>
br=$(cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness)
br=$(cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness)
Line 33: Line 36:
</pre>
</pre>


I called it 'brp' which is nice and short and stands for ''''br'''ightness '''p'''lus'
Note that I increase the value by 10 otherwise it would not change enough. You can vary that value of course to get finer control or get faster adjustment.
Note that I increase the value by 10 otherwise it would not change enough. You can vary that value of course to get finer control or get faster adjustment.
I put the script in my home bin directory:
user> vi ~/bin/brp
I called it 'brp' which is nice and short and stands for ''''br'''ightness '''p'''lus'


I created a similar script called brm which decreases the value:
I created a similar script called brm which decreases the value:

Revision as of 15:41, 9 November 2015

How to make button for screen brightness work on your laptop in KDE

When I started using a newer kernel in openSUSE 13.2, I noticed the buttons for screen brightness were no longer functioning on my laptop. This is verry annoying, so I decided to do something about it. I am using KDE. I will try to write the instructions as generic as possible, so that it will hopefully work in your situation too. This is a HP ELitebook 8570p.

First, we have to find the screen device, which is located somewhere in the /sys/devices/pci0000:00 directory.

Somewhere in this directory is a file located with the name 'brightness'. Let's find it. So, as root:

# find /sys/devices/pci0000:00 -name "brightness"
/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness
/sys/devices/pci0000:00/0000:00:1c.2/0000:24:00.1/leds/mmc0::/brightness
/sys/devices/pci0000:00/0000:00:1c.3/0000:25:00.0/leds/phy0-led/brightness

Remember, your output is probably different from what I got here.

I have a radeon card, so the first line contains the device we will be working with.

When you read the content of the 'file', you get the current brightness level:

# cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness
235

The value lies somewhere between 0 and 255, it's a one byte value.

You can test if this work for you by writing (still as root) a different value to that file: (remember to substitute the file for your graphics card)

# echo 200 > /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness

If this works, you should see the brightness change, and you can go to the next step.

I created a simple QAD(quick and Dirty) 3 line script to read that value and increase it.

I put the script in my home user's bin directory:

user> vi ~/bin/brp
br=$(cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness)
br=$((br+10))
echo $br > /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness

I called it 'brp' which is nice and short and stands for 'brightness plus' Note that I increase the value by 10 otherwise it would not change enough. You can vary that value of course to get finer control or get faster adjustment.

I created a similar script called brm which decreases the value:

user> vi ~/bin/brm

And paste the content

br=$(cat /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness)
br=$((br-10))
echo $br > /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness

Now, the problem is that this file /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card0/card0-LVDS-1/radeon_bl0/brightness may only be written by root. Notice that all commands manipulating the file so far have been executed as root.