Originally Posted by
jonashendrickx
This my personal work. It's clearly based upon the idea in this thread. My script is synchronized with the brightness slider. This is the final and correct solution what we needed
I am still looking for a way to do it without nvidiabl. I believe we dont need nvidiabl at all since I can control brightness from nvidia-settings. Don't forget to give me credits for my solution if you post it elsewhere
!
How it works? /sys/class/backlight/nvidia_backlight/brightness contains the brightness value when the brightness keys are pressed. But the brightness doesn't change. I noticed this value has a range of 0-15. But the range of the nvidiabl is 0- 127. with some quick math I came with a formula y=15+8x where x represents the brightness value of the keys, and y is the actual brightness.
/sys/class/backlight/nvidia_backlight/max_brightness contains the maximum brightness, actually I can use this in my script and use remainders and few other things to make my script universal. It's very easy actually. I did not make it universal since I like to have every bit of performance.
- Install latest nvidiabl debian package from https://github.com/guillaumezin/nvidiabl/downloads
- Now open the terminal and type
Code:
$ sudo gedit /etc/acpi/events/lenovo_backlight_up
Enter
Code:
event=video LCD 00000086 00000000
action=/etc/acpi/lenovo_backlight.sh
And now save and close the file.
Code:
$ sudo gedit /etc/acpi/events/lenovo_backlight_down
Enter
Code:
event=video LCD 00000087 00000000
action=/etc/acpi/lenovo_backlight.sh
And now save and close the file.
Code:
$ sudo gedit /etc/acpi/events/lenovo_backlight.sh
Enter
Code:
#!/bin/bash
test -f /sys/class/backlight/nvidia_backlight/brightness || exit 0
NEW_VALUE=`cat /sys/class/backlight/acpi_video0/brightness`
let BRIGHTNESS=$NEW_VALUE*8+7
echo -n $BRIGHTNESS > /sys/class/backlight/nvidia_backlight/brightness
And now save and close the file. - Now let's set the necessary permissions for all the files we need to access
Code:
$ sudo chmod +x /etc/acpi/lenovo_backlight.sh
sudo chown YOURUSERNAME /sys/class/backlight/nvidia_backlight/brightness
- Now let's load nvidiabl at boot time, in terminal type:
Code:
sudo gedit /etc/modules
add to the bottom:
close and save. - reboot
This is the best method, Now the brightness is synchronized with the brightness slider applet.
Don't forget to buy me a beer if you like it
donation link
AND
Originally Posted by beatgeekFor those who are having a problem with maximum brightness, which version of the NVIDIA driver are you using? When I tried the most recent version (313.26 I think), I had problems with the brightness being too low (and it kept switching between high and low brightness on its own for no reason). I switched back to version-current-updates (304.88... I'm actually running linux mint 13, based on ubuntu precise) and it works perfectly.
OK I was having the low-brightness problem too. I'm on 319.49 and nvidiabl 0.81. Anyways, to get my brightness back up, try experimenting with the max:
sudo modprobe -r nvidiabl #removes the module
sudo modprobe nvidiabl max=20000 #experiment with this number
then:
cd /sys/class/backlight/nvidia_backlight
echo 127 | sudo tee brightness
If it's bright enough, then great. Otherwise, start at the beginning, and up the max. It takes some experimenting; for me, I had to put like 100000 to get the brightness up.
I just can't thank all of those who help to answer in this thread, and especially to both of those quoted. You guys just make my day.
So here is how I combine the work and finding of both the guys above and get a decent solution to Fn key to adjust brightness in the IdeaPad Y500
As first, I followed jonashendrickx for his guide and set up the event-listeners and the .sh file. It would work okay at first since the brightness did change accordingly and it utilised the indicator at the top right corner. But I find that, since he used the relation between the brightness in acqui-video to give a new value of brightness in nvidia_backlight, I thought to myself why not do the same. I also found out that the value of brightness in folder acpi_video0 varies from 0 to 100 with an interval of 6, while the brightness in folder nvidia_backlight has a maximum value of 127. So I changed his formula inside the lenovo_backlight.sh as followed:
Code:
let BRIGHTNESS=$NEW_VALUE*8+7
into
Code:
let BRIGHTNESS=$NEW_VALUE*127/100
I know this would give me integer division but the number should be close enough to be functional. Then I combine the condition of comparison for the BRIGHTNESS value with the value stored in nvidia_backlight/max_brightness and set it to be equal to that value if it gets bigger (which is not likely according to the formula). And so with that I had a smooth change of brightness with the Fn key.
But then the issue hasn't stopped. The maximum brightness is capped and to some people, the screen is just not bright enough. Here's where colby2 comes to save the day with his findings.
By experimenting with the value, I obtain 143000 to be a suitable max, since when the brightness indicator gets to 94%, 1 more increment (1 more hit of Fn+Up) doesn't change the brightness anymore. That's when I know the brightness is maxed out.
And so I have for myself a smooth change in brightness with maximum range (as I like to convince myself that).
With credits to jonashendrickx and rorschachwalter here is the code for lenovo_backlight.sh:
Code:
#!/bin/bashtest -f /sys/class/backlight/nvidia_backlight/brightness || exit 0
NEW_VALUE=`cat /sys/class/backlight/acpi_video0/brightness`
MAX=`cat /sys/class/backlight/nvidia_backlight/max_brightness`
let BRIGHTNESS=$NEW_VALUE*$MAX/100
if [$BRIGHTNESS -gt $MAX]; then
BRIGHTNESS=$MAX
fi
echo -n $BRIGHTNESS > /sys/class/backlight/nvidia_backlight/brightness
Then after that I ran snippet from colby2
sudo modprobe -r nvidiabl #removes the module
sudo modprobe nvidiabl max=143000 #actually the calculated value was 142880
then:
cd /sys/class/backlight/nvidia_backlight
echo 127 | sudo tee brightness
HOWEVER, I still haven't been able to make this permanent, since everytime I reboot, the maximum brightness is reset and I have to do the above to get the max brightness right again. So how can I make it permanent, how do I change the setting of nvidiabl?
Edit2: I figured that if I wrote in /etc/modules with the line
nvidiabl max=143000
then when I reboot I can have the max brightness as I wanted.
------
I'm using driver 3.13 nvidia with kernel 3.8.0.30-generic.
Y500, SLI GT650M with 16Gb SSD and 1Tb HDD
I can boot to Ubuntu and Window 8. But my Boot Mode is set to LEGACY MODE with UEFI FIRST and I use GRUB as default bootloader.
I just used Ubuntu approximately 24 hours, but I had tried and failed for like 3 days in a row. Thanks to these posts and contributions I was able to dual boot and enjoy Ubuntu while still having Win 8 for gaming (which to me is a BIG achievement since I'm super new to Linux)
Bookmarks