Toutatis Brightness control

32 risposte [Ultimo contenuto]
janith
Offline
Iscritto: 03/09/2013

from fn key it work fine from 3.2.* kernels.
i installed latest kernels. but from them its not working.
also i updated xserver-xorg.

this are from lspci
Intel Corporation 3rd Gen Core processor Graphics Controller
VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Thames [Radeon HD 7500M/7600M Series]

pogiako12345
Offline
Iscritto: 07/11/2014

So are you saying that you can't change your brightness settings?

janith
Offline
Iscritto: 03/09/2013

yes, except from linux 3.2.* kernels.

pogiako12345
Offline
Iscritto: 07/11/2014

Is the latest stable? I'd not install unstable kernels if I were you.

andrew
Offline
Iscritto: 04/19/2012

janith wrote:
> from fn key it work fine from 3.2.* kernels. i installed latest
> kernels. but from them its not working. also i updated xserver-xorg.
>
> this are from lspci Intel Corporation 3rd Gen Core processor
> Graphics Controller VGA compatible controller: Advanced Micro
> Devices, Inc. [AMD/ATI] Thames [Radeon HD 7500M/7600M Series]

You could try the suggestions here:

https://wiki.ubuntu.com/Kernel/Debugging/Backlight

Andrew.

janith
Offline
Iscritto: 03/09/2013

thanks
echo 500 > /sys/class/backlight/intel_backlight/brightness work nice

lembas
Offline
Iscritto: 05/13/2010

And you can bind that to the keys for controlling brightness if the xev command sees them.

Jane
Offline
Iscritto: 09/02/2014

Hi,

I have the same problem. Since I installed Trisquel on my laptop the brightness is always high. I try to change it and see the icon responds but not the brightness, it always stays high. I'm a beginner with GNU+Linux so I have not really understood the technical explanations.

It would be nice an easy step-by-step guide to solve it. If it is anyway possible...

Thanks!

lembas
Offline
Iscritto: 05/13/2010

Hey Jane! The first step would be to post the output of the lspci command. Welcome to free operating systems btw!

Jane
Offline
Iscritto: 09/02/2014

Thank you. But how? I opened the terminal and wrote Ispci, I guess that's what you meant. But this is the output I get:

bash: Ispci: command not found

jxself
Offline
Iscritto: 09/13/2010

It is not the letter "I" as in India but the letter "L" as in Lima.

TheAngel
Offline
Iscritto: 10/13/2014

try lspci

its L not i :)

Jane
Offline
Iscritto: 09/02/2014

Oops, sorry. Ok, there you go:

00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)
00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)
00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b4)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1f.0 ISA bridge: Intel Corporation HM65 Express Chipset Family LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller (rev 04)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Thames [Radeon HD 7500M/7600M Series]
02:00.0 Ethernet controller: Qualcomm Atheros AR8151 v2.0 Gigabit Ethernet (rev c0)
03:00.0 Network controller: Qualcomm Atheros AR9287 Wireless Network Adapter (PCI-Express) (rev 01)
05:00.0 USB controller: NEC Corporation uPD720200 USB 3.0 Host Controller (rev 04)

Thank you

lembas
Offline
Iscritto: 05/13/2010

Looks like you've got a pretty similar setup as janith who started this thread. These are your video cards

00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Thames [Radeon HD 7500M/7600M Series]

The Intel card should probably work nicely but the radeon will give you trouble...

If you try this mentioned command, what happens?

echo 500 > /sys/class/backlight/intel_backlight/brightness

(if nothing, try different numbers)

Jane
Offline
Iscritto: 09/02/2014

I typed
"echo 500 > /sys/class/backlight/intel_backlight/brightness"

And just got
"bash: /sys/class/backlight/intel_backlight/brightness: Permission denied"

I also tried with
"sudo echo 500 > /sys/class/backlight/intel_backlight/brightness"

but got the same
"bash: /sys/class/backlight/intel_backlight/brightness: Permission denied"

Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

Here is the command you want:
$ echo 500 | sudo tee /sys/class/backlight/intel_backlight/brightness

Jane
Offline
Iscritto: 09/02/2014

Hey, it works! The brightness changes with that number!

By the way, what is that "tee" thing?

And, is there an easy way to bind it to a key combination? I think lembas commented so, but don't understand how to do it. Just in case it's easy...

I'm already happy that it works!

Thank you all.

lembas
Offline
Iscritto: 05/13/2010

That's good news then, it means it is possible.

You did the right thing when you used sudo when it said no permission. However, the output redirect part (the > in the command) is tricky with sudo, that's why tee is needed.

Binding keys is pretty straightforward with most keys. But the fact sudo is required makes things more complicated as you don't want to have to punch in the password every time you hit the key.

To try and get around that sudo requirement I wonder what would happen if you took ownership of that file /sys/class/backlight/intel_backlight/brightness

The command to do so is sudo chown $(whoami):$(whoami) /sys/class/backlight/intel_backlight/brightness

Then you could try to see if you can use the echo command without sudo to change the brightness.

The keybindings can be set somewhere in System settings > keyboard > custom bindings.

If this works we can make a startup script that will do that ownership change on every boot automagically.

Jane
Offline
Iscritto: 09/02/2014

Thanks a lot lembas.

It works, now I can use the echo command without sudo to change the brightness. But I did not manage to configure the shortcuts for the keyboard.

When adding a new shortcut (through System Settings > Keyboard) I can enter the name and the command, but don't know how to enter the key combination that activates the shortcut.

Jane
Offline
Iscritto: 09/02/2014

Oh,no! I'm wrong. I said it worked, but I was trying with sudo! Sorry.

And now I am stack.

I don't think I'm doing correctly this part:
sudo chown $(whoami):$(whoami) /sys/class/backlight/intel_backlight/brightness

Should it be
sudo chown jane:jane /sys/class/backlight/intel_backlight/brightness
?

I don't get any answer when entering it.

And then, I do not know if I am entering properly the commands to change the brightness without sudo. How should these commands be without sudo:
echo 500 | sudo tee /sys/class/backlight/intel_backlight/brightness

Thank you. As you see, I'm an absolute beginner.

lembas
Offline
Iscritto: 05/13/2010

Those both chown commands you mention should work and are the same. It is normal with many commands if there is no error you get no output. You can use the

ls -l /sys/class/backlight/intel_backlight/brightness

command before and after the chown command to see the file change owner and group. (from root:root to jane:jane)

The simplest form without sudo is

echo 500 > /sys/class/backlight/intel_backlight/brightness

however just omitting the sudo word from the longer form should work as well.

I guess it is possible this way does not work for whatever reason. In that case we can try and come up with another way, if you have the stamina to keep tinkering. :)

Jane
Offline
Iscritto: 09/02/2014

It does work. Now I do not know whether I did it right or wrong first time I tried, but the thing is it does work.

I mean I do
sudo chown jane:jane /sys/class/backlight/intel_backlight/brightness

And then
echo 500 > /sys/class/backlight/intel_backlight/brightness
and it works ok

So then I tried again to make it work through keyboard shortcuts. I managed to create keyboard shortcuts (using System Settings > Keyboard) for other applications but it does not work for

echo 500 > /sys/class/backlight/intel_backlight/brightness

I don't know why.

But I'm happy with what I have, now I can change the brightness and that's enough for me. So we can leave it here, unless it's fun for you, or we can contribute to a general fix that can be helpful to more people.

Thanks once more

lembas
Offline
Iscritto: 05/13/2010

It's fun! :) And perhaps somebody else with a similar problem finds this thread.

Ah, I guess the redirect (the >) might again be causing trouble...

The fix is fortunately easy, just open the text editor of your preference and put that echo command there and save the file somewhere. Then we need to make the file executable, that's done with the command

chmod +x /path/to/the/file

Finally point the shortcut key to that file.

To automate the chown thing, you need to open a text editor as a super user. (Prepend the name of the editor with sudo in case of CLI editors and with gksudo in case of graphical editors, e.g. sudo nano or gksudo gedit) Then save this script to /etc/rc2.d/S99-brightness

#! /bin/sh
### BEGIN INIT INFO
# Provides: easy access to brightness control
# Required-Start: $all
# Required-Stop:
# Default-Start: 2
# Default-Stop:
# Short-Description: Make brightness user writeable
### END INIT INFO
chown jane:jane /sys/class/backlight/intel_backlight/brightness

And make it executable

chmod +x /etc/rc2.d/S99-brightness

Now the next time you boot you should find yourself the owner of the brightness file.

If you want we can make you two scripts that incrementally increase and decrease brightness like things work normally that you can bind to the related buttons/key combos.

Jane
Offline
Iscritto: 09/02/2014

Great! Everything worked. Even after a restart. Thank you.

I did different keyboard shortcuts for different values, so it's quite handy now. But if you feel like posting how to do the last thing you suggested, I will give it a go for sure.

lembas
Offline
Iscritto: 05/13/2010

Ain't tinkering wonderful?! :)

Here's script for one button (dunno if this makes it brighter of dimmer)

#!/bin/sh
file=/sys/class/backlight/intel_backlight/brightness
echo `expr $(cat $file) - 50` > $file

and here's the other

#!/bin/sh
file=/sys/class/backlight/intel_backlight/brightness
echo `expr $(cat $file) + 50` > $file

(So, save into a file and make the file executable and then bind to a key. You can try different increments besides 50.)

davidnotcoulthard (non verificato)
davidnotcoulthard

Regarding those commands which get longer with sudo, if one uses:

sudo su -c "THE_SHORTEST_FORM_OF_THE_COMMAND"

will it also work?

lembas
Offline
Iscritto: 05/13/2010

Looks like my test case (with redirect) worked, so perhaps yes.

Probably a good find. :)

I wait for the final judgement from the wise elders.

Jane
Offline
Iscritto: 09/02/2014

Done! It works!

Well, it didn't work with the actual key combination from which my laptop is supposed to control the brightness -I guess that might also be the cause of the original problem. But it does work with other key combination.

My laptop is suposed to use Fn+Right to increase brightness and Fn+Left to decrease it. When pressing those key combinations I have always been able to see the increasing or decreasing brightness indication on screen, but never a real change on brightness.

Your scripts didn't work with Fn+Right nor Fn+Left -and the brightness change indication on screen has always kept working. But I tried with other combination key and it worked ok. So now I use the Windows key instead of the Fn key to change the brightness.

Thank you again. Yes, tinkering is great, I've learnt many things.

Cheers

lembas
Offline
Iscritto: 05/13/2010

Glad to hear that.

For extra credits you could see if the xev command sees the Fn+right combo. I guess it must because you get the indicator. If you get a keysym you could use xbindkeys to bind it to a script.

Jane
Offline
Iscritto: 09/02/2014

Uh, I got lost again...

What is a xev command?
What is a keysym?
What is xbindkeys?

lembas
Offline
Iscritto: 05/13/2010

Sorry for being unclear. xev is a command you type at the terminal, ditto xbindkeys. The xev command brings up a little white box, move the cursor inside it. Now you'll see some output in the terminal window you launched xev from. Part of that output is keysyms for the keys you press.

I can't remember whether xev and xbindkeys are installed by default but the xbindkeys command is from a package with the same name and the xev command is from x11-utils package. So you need to install those packages.

The whole operation probably requires manual page reading, e.g.

man xbindkeys

(after you've installed xbindkeys)

GustavoCM

I am a member!

Offline
Iscritto: 11/20/2012

One could try adding "acpi_backlight=vendor" to the line "GRUB_CMDLINE_LINUX_DEFAULT=" in /etc/default/grub and rebooting the computer to see if the command keys work properly. Like this:

$ cat /etc/default/grub

[...]
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"
[...]
Jane
Offline
Iscritto: 09/02/2014

Thank you Lembas and all. I'm done with it. I'm more than satisfied with what I have now, and don't have much time to play further with this, especially when I have so many other technical problems!

Cheers