I have found out the problem. I'll use my laptop as an example. It has 7
brightness levels (from 0 to 6).

The default brightness parameters are brightness_ac=100,
brightness_battery=70, idle_brightness=30.

Hence, if I start the system plugged, my LCD starts at level 6. Then I
unplug: gnome-power-manager tries to decrease the brightness level by
30%. It computes the current level, and it is 100%, it then decreases
the brightness to 70%. Since the actual levels are only 7 and truncates
this value to level 4 (which correspontos to 66.66%, the first valid
level smaller than 70%).

Now I plug my system back. It computes the level and it is now 66.66%,
it then increase it to 66.66 + 30 = 96.66%. However this value does not
correspond to a discrete, it then truncates the value to the closest
level which is now 5 and not 6 anymore. (Note that 5 corresponds to
83.33%, which is much smaller than 96.66%, however gpm always truncate
when looking for the correct discreate level).

Now I unplug the system, which is in level 83.33%. It decreases the
level to 83.33 - 30 = 53.33%. The new discrete level is now 3 (and not 4
as before in the un-plugged state).

The cycle goes on, loosing one level at a time.

The problem is the truncation, or more precisely the weird idea of
increasing or decreaseing the current level by the amount 100 -
brightness_battery (in floating point). This kind of floating point
computation, when translated to a very small number of discrete levels
will always result in weird behavior.

I am proposing a patch that use gpm brightness parameters as absolute
targets. When you plug the cord it will take you LCD level to
brightness_ac (or leave it alone if it was alerady there or above). When
you unplug it will take the level to brightness_battery (or leave it
alone if it was already there or below). It also works with the auto-dim
feature. Note that my patch  uses brightness_battery as a target value.
Hence if you want your brightness level to be around 30% of the total
level when unplugged set it to 30 (instead of the current 70, which I
find odd. I can easily cahnge this).

Please test the patch and say what you think.

If you are too lazy to apply the patch and compile, and if you trust me,
you can download a compiled package at

http://www.ime.usp.br/~pjssilva/gnome-power-
manager_2.22.1-1ubuntu4_i386.deb


** Attachment added: "Proposed patch. Apply it to a source after applying all 
Ubuntu patches."
   http://launchpadlibrarian.net/15490655/80-fix-backlight.patch.level-1.log

-- 
g-p-m does not honor its configuration for LCD brightness levels after multiple 
unplug-replug from AC
https://bugs.launchpad.net/bugs/215484
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to