I tested a solution that works fine for me.
One solution is to add a script file in /etc/pm/power.d/
Just creates a file
sudo vi /etc/pm/power.d/run_after_pwrmanagmt.sh
Then writes this code into this file :
case "${1}" in
true) #battery_mode
xinput set-int-prop 12 277 8 2 3 0 0 1 3 2
echo 4000 > /sys/class/backlight/intel_backlight/brightness
;;
false) #ac_mode
xinput set-int-prop 12 277 8 2 3 0 0 1 3 2
echo 4000 > /sys/class/backlight/intel_backlight/brightness
esac
Now, you need to give execution rights to this file by typing
sudo chmod +x /etc/pm/power.d/run_after_pwrmanagmt.sh
Now it should work fine, just test to plug/unplug your computer.
Note that you can do similar things after a suspend (/etc/pm/sleep.d/run_after_sleep.sh
), that's how I found out this solution... You will find information on the web...
Note that xinput is just a command for my trackpad to set the middle button working... You should skip the two lines xinput if not needed (or adapt ).
For the value 4000, it may be diffrent for each screen, you should first see what is your max value with the command cat /sys/class/backlight/intel_backlight/max_brightness
Hope this helps, and that the moderator will not delete this post since this is an answer and not a question.
Thanks
Sometimes the graphical login hangs, while you could read an errormessage in the commandline, which indicates to hit the S or the Enter key, which isn't propagated to the graphical login.
So you can watch you HDD-led (Macbooks have such a thing too, do they?) to settle, which indicates, no loading and logging is going on and just hit those keys for good luck, keeping an eye on the LED to check if it has influence.
Or hit Ctrl+Alt+F1 (or F2, F3, ... F4) to get to the pure text screens. F1 should show the logging messages, with error cause as the last message(s). Alt+F7 (maybe F5) will bring you back into the graphical mode.
Or edit grub while booting, hitting e will give you an edit line, there you can remove 'quiet' and 'splash' from the kernel options. This will keep you longer in touch with the messages, and maybe you can read more about the cause.
Next option: Boot from a live cd, mount your system, and read the logfiles in /var/log, most recent files first, boot.log, kernel.log, syslog.
Afaik, Grub has a minimal HDD-access build in, so maybe you can even inspect logfiles from the grub bootscreen, but I don't know from my heart what key to hit, to do so. But there should be a help message, which get's you started.
Best Answer
Here is what worked for me. I got the solution from the folowing links. Check them out or read the summary below.
http://linuxon1001p.blogspot.com/2010/03/fixing-brightness-controls.html
Desktop doesn't remember brightness settings after a reboot
Summary:
Edit your /etc/default/grub file:
sudo gedit /etc/default/grub
Add the options "acpi_osi=Linux acpi_backlight=vendor" to the GRUB_CMDLINE_LINUX_DEFAULT line. It should look like this:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_osi=Linux acpi_backlight=vendor"
original line was:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Update grub configuration!!!! - do not forget to do this, the configuration change will not be set up if you don't run the next command:
sudo update-grub
This worked for me after trying a lot of other solutions. I have a HP dv7-6090ef with hybrid graphics Intel/AMD.
Have fun using Ubuntu!