LCD brightness setting doesn't work with Sony Vaio VGN-S5M

Bug #77739 reported by LaurentAlmeras on 2007-01-02
22
This bug affects 1 person
Affects Status Importance Assigned to Milestone
hal (Ubuntu)
Undecided
Unassigned

Bug Description

Binary package hint: hal

LCD brightness setting doesn't work currently with hal in feisty and dapper release.

It doesn't work because the scripts hal-system-lcd-{get,set}-brightness-linux relies on acpi methods. But this computer doesn't support brightness setting with acpi.

Some workaround are needed (like in the acpi package, see /etc/acpi/sonybright.sh).

I have some scripts modifications I'll upload.

Here are :

- a hald fdi policy script (/usr/share/hal/fdi/policy/20thirdparty/10-laptop-panel-mgmt-policy.fdi) which :
  * modifies the hal "laptop_panel.num_levels" property provided by buggy acpi to replace it with 21 (the correct value for my computer)
  * changes the laptop_panel.access_method not to interfere with the others sony systems.
These modifications are applied only for Sony CorporationVGN-S5M_S.

- patches for hal-system-lcd-{get,set}-brightness-linux (hal 0.5.8.1-4ubuntu1)

With these, all works fine on my computer using gnome-power-manager.

Here are the patches.

Martin Pitt (pitti) on 2007-01-10
Changed in hal:
assignee: nobody → pitti
status: Unconfirmed → In Progress
Martin Pitt (pitti) wrote :

Where does 'smartdimmer' come from? It should certainly be a dependency or a recommends?

Changed in hal:
status: In Progress → Needs Info

smartdimmer comes from smartdimmer package from main.

It seems to be a good idea to set smartdimmer as a dependency of the hal package if my solution is accepted. smartdimmer is also a dependency of acpi-support.

------

apt-cache show smartdimmer
Package: smartdimmer
Priority: optional
Section: utils
Installed-Size: 80
Maintainer: Matthew Garrett <email address hidden>
Architecture: i386
Version: 0.1-2
Depends: libc6 (>= 2.3.4-1)
Filename: pool/main/s/smartdimmer/smartdimmer_0.1-2_i386.deb
Size: 16320
MD5sum: 124c6914f9d1395800a2bed62ee7074d
SHA1: 782ecec5fde1d62e01283b2b29d260f565594c45
SHA256: 27c1552303bc1f4439c31a7e6f719ab3811b416c3f5ad7631b16e1fefd4735e2
Description: Change LCD brightness on Geforce 6200Go cards
 Nvidia Geforce 6200Go cards contain hardware LCD brightness control.
 Smartdimmer allows this to be controlled through software.
Bugs: mailto:<email address hidden>
Origin: Ubuntu
Task: ubuntu-desktop, kubuntu-desktop, edubuntu-desktop, xubuntu-desktop

--------

apt-cache rdepends smartdimmer
smartdimmer
Reverse Depends:
  acpi-support

I'd like to try your patch on my vaio but your attachment with the fdi policy contains nothing

Ok I've writed an fdi following your instructions and It works on my vaio FE21M. I think however a shift is needed between the hal values(0->20) and the smartimmers values (1->21).
value=$((value-1)) in the get method
smartdimmer -s "$((value+1))" in the set method
the only strange think is that every time the brightness change, it goes to zero then grows up to the desired level by step of one.

fdi policy file is right. I download it and it is the same I keep here. The only problem I have is that if I click on the link, Firefox try to open the file (because it is xml) and only displays text nodes. So I need to right click and download.

You're right for the shift on brightness value. So the laptop_panel.num_levels needs to be set to 20 in my fdi policy file.

I don't have the strange problem you describe. When does it happen ? When you use smartdimmer in a terminal ? With the power management applet ?

You should give your "/org/freedesktop/Hal/devices/computer:smbios.system.product" property pour fdi policy file, in case Ubuntu packagers decide to integrate this workaround.

Ok, I've got your fdi file now, sorry. My smbios.system.product key is VGN-FE21M. But wouldn't it be preferable to detect the GPU ?
I'm not sure but I think num_levels is 21 : 0.1.2...20 and 1.2.3...21 constitute 21 different levels.
The problem (going to 0 then step up to the desired level) occurs when I change the brightness using hal (through gnome-power-manager), not when I invoke smartdimmer from the command line.

Filtering on GPU is a bad idea because I think there is also computers with nvidia chip and correct acpi implementation.

You're right for num_levels.

I have the same problem of brighness going to 0 then going to the right brightness. It seems to be a gnome-power-manager bug (I don't have this bug on previous version, and I just reinstalled my patch on my Feisty).
If you are interested, I have debug trace of the instructions send to hal by gnome-power-manager (you can see it by yourself by
sudo killall hald
sudo hald --daemon=no --verbose=yes
) => there is a lot of brightness update starting from 0 value.

Any chance to see this included in the package one day ?

Same question.

My little update on this point :
- the gnome-power-manager bug talked about here is corrected (and was not related to my patch)
- my patches are still valid : I currently use them on a feisty install regularly updated. '/usr/share/hal/fdi/policy/20thirdparty/10-laptop-panel-mgmt-policy.fdi' is kept in the updates, and I install diversions for '/usr/lib/hal/scripts/linux/hal-system-lcd-{g,s}et-brightness-linux' files

I made a package from my patch, hal-sony-lcd-wa available at :
deb http://deb.likide.homelinux.org/ gutsy/

yleetiny (yleetiny) wrote :

Hello LaurentAlmeras!
I just would like to say thanks for your solution...I used it on my Sony Laptop VGN-C2Z_B...

Indeed I had to modify your file just a little bit...that is to say
1- Add my sony laptop model in the .fdi file by
2- Comment two exits in the other files...
I attach the "diff" files to this message

PS: Sorry for my bad english, i'm french and it's my first post on launchpad...
and maybe for my diff files (my first time too)

I don't really have knowledge about ubuntu and linux in general. So I have two questions: The patch first mentioned in this thread - is it still a solution? And how do i have to install it? firefox saves it to directory ~/src/, is that important? I have a Sony VGN-FE 48 and the only possibility to change brightness is smartdimmer at the moment... I hope some of these files can help me?

And to the package of LaurentAlmeras: The deb-file aborts because of 32bit-mode. Is there a way to install it on a 64 bit system? would it work on it? I hope somebody can help me...

yleetiny : I'm french too. I updated my package with your system name so the package should work for you (but I don't comment out the exit line in the panel scripts because it works perfectly here).

Sebastian : I added amd64 package, so you can try it : http://data.likide.homelinux.org/hal-sony-lcd-wa_0.2-2_amd64.deb . But as I don't have your hal system product key, it's not sure it works. Install it, reboot then try the gnome brightness applet. If it doesn't work, you can run the command and give me the result so that I modify the package :
hal-device|grep smbios.system.product

New packages :
http://data.likide.homelinux.org/hal-sony-lcd-wa_0.2-2_amd64.deb
http://data.likide.homelinux.org/hal-sony-lcd-wa_0.2-2_i386.deb

I have just installed the package, but there is no difference. The brightness applet is out of function.
The command returned: smbios.system.product = 'VGN-FE48E' (string)
Is that really important for a function like that? I hope so, thanks a lot...

yleetiny (yleetiny) wrote :

Sebastian : could you post here the result of the command "lshal".

Laurent : I think that commenting out the exit line, will be necessary for some VAIO model, because the laptop_panel is partially detected as a sony's panel ("linux.sysfs_path"). And thus, it uses it's behaviour ( the "echo" way and then exit)
For example, my lshal laptop_panel part is :

udi = '/org/freedesktop/Hal/devices/computer_backlight'
  info.capabilities = {'laptop_panel'} (string list)
  info.category = 'laptop_panel' (string)
  info.interfaces = {'org.freedesktop.Hal.Device.LaptopPanel'} (string list)
  info.parent = '/org/freedesktop/Hal/devices/computer' (string)
  info.product = 'Generic Backlight Device' (string)
  info.udi = '/org/freedesktop/Hal/devices/computer_backlight' (string)
  laptop_panel.access_method = 'general' (string)
  laptop_panel.num_levels = 8 (0x8) (int)
  linux.hotplug_type = 2 (0x2) (int)
  linux.subsystem = 'backlight' (string)
  linux.sysfs_path = '/sys/class/backlight/sony' (string)
  org.freedesktop.Hal.Device.LaptopPanel.method_argnames = {'brightness_value', ''} (string list)
  org.freedesktop.Hal.Device.LaptopPanel.method_execpaths = {'hal-system-lcd-set-brightness', 'hal-system-lcd-get-brightness'} (string list)
  org.freedesktop.Hal.Device.LaptopPanel.method_names = {'SetBrightness', 'GetBrightness'} (string list)
  org.freedesktop.Hal.Device.LaptopPanel.method_signatures = {'i', ''} (string list)

If we comment or delete the "exits", no harm will be done since you have the same command in the end of the files...(I admit, it's not a clean).
So deleting the "exits" seems to me the best way to just make more things works (because i absolutely don't how to change the detection of the "sysfs" path ).

I put the return into a file, because there was a lot of data. I hope that will help.

yleetiny (yleetiny) wrote :

Sebastian Gaul:
Thanks, i have edited the fdi file to make it work, but i don't know how to create packages...
but if you want to make it work you can :
1- install the package
2- move the file attached here to :
"/usr/share/hal/fdi/policy/10osvendor/10-sony-laptop-panel-mgmt-policy.fdi "

Thank you yleetiny, but nothing changed...
What I did was installing the package http://data.likide.homelinux.org/hal-sony-lcd-wa_0.2-2_amd64.deb, then moved the file modified by yleetiny to /usr/share/hal/fdi/policy/10osvendor/10-sony-laptop-panel-mgmt-policy.fdi, as he said.
Is there perhaps something I forgot?

I updated my packages.
- your computer id (VGN-FE48E) is used to enable the smartdimmer use
- I integrate the suggestion of yleetiny to comment out the two exit. They are harmful because your computers (and not mine) provide a standard and not working method which disables smartdimmer

Try these new packages :
http://data.likide.homelinux.org/hal-sony-lcd-wa_0.3-2_amd64.deb
http://data.likide.homelinux.org/hal-sony-lcd-wa_0.3-2_i386.deb

I don't really understand where the things are going wrong...
Have you reboot your hal by doing "/etc/init.d/hal restart" as root?
Then you should have in response to "lshal | grep sony-nvidia" this :

          laptop_panel.access_method = 'sony-nvidia' (string)

If you have this, it means that you have the right informations about your
hardware...

To test if the patch works, you install the brightness applet and then try
to change the brightness...
If you expected the FN+F5 or FN+F6 to work, you will have to wait a little
since only recent kernels seems to detect correctly de keys...

I hope this will solve your problem

2008/1/24, Sebastian Gaul <email address hidden>:
>
> Thank you yleetiny, but nothing changed...
> What I did was installing the package
> http://data.likide.homelinux.org/hal-sony-lcd-wa_0.2-2_amd64.deb, then
> moved the file modified by yleetiny to
> /usr/share/hal/fdi/policy/10osvendor/10-sony-laptop-panel-mgmt-policy.fdi,
> as he said.
> Is there perhaps something I forgot?
>
>
> --
> LCD brightness setting doesn't work with Sony Vaio VGN-S5M
> https://bugs.launchpad.net/bugs/77739
> You received this bug notification because you are a direct subscriber
> of the bug.
>

He yleetiny,
I did everything, but it doesn't work. The laptop_panel.access_method is "'sony-nvidia' (string)" just like you said.

My FN-Keys dont't work at all. As far as I have read this is a general problem with vaio computers and for most models there is no way to fix it (if you know something different...?).

But I have just recognized that this thread is about "feisty and dapper release" - so perhaps my Gutsy uses another way for brightness settings? Sorry if that's the problem, I haven't read that before.

I'm currently running hardy and it works for me (minus new bugs).

Do you try to use the smartdimmer -s <number> command ? Does it work ?

For me Fn key works quite well since a long time (because they are binded via acpi event scripts to smartdimmer). The fix presented here is for the hal subsystem (used by gnome-power-manager and the brightness applet).

Yes, smartdimmer works without problems. So shall this work on Gutsy too?
And how can I... bind Fn keys... via ...acpi (sorry, no idea what all this means)?

yleetiny (yleetiny) wrote :

Yes it should work on Gusty...
It works for me (VAIO VGN-C2Z_B)

Have you tried the new package of LaurentAlmeras?

I made a small script to set/test your brightness...
Could you try it? (to see what is wrong, the getbrightness/the set Brightness)

Thanks for the script. Getting the level is no problem, but turning down returned:

---
sg@sg-vaio:~$ ~/Desktop/Brightness_test.sh down
your current brightness level is : 21
Error org.freedesktop.Hal.Device.LaptopPanel.Invalid: /usr/lib/hal/scripts/hal-system-lcd-set-brightness: 29: arith: syntax error: "HAL_PROP_LAPTOP_PANEL_NUM_LEVELS - 1"
your new brighness level is :20
---

I also tried with sudo, I don't know if this it's necessary for that. The return is the same at all.

yleetiny (yleetiny) wrote :

I know where the bug come from :
it's a range issue :
smartdimmer level goes from 1 to 21
hal laptop_panel level goes from 0 to 20 ( the one we want ).
but there is a small bug when you get / set the brightness :
so the lines :
"`smartdimmer -g| awk '{print $3;}`" should become "$(( `smartdimmer -g | awk '{print $3;}'` -1 ))"
and
smartdimmer -s "$value" should become smartdimmer -s "$(( $value + 1 ))"

Laurent Almeras, will probably fix this problem as soon as he sees those comments...

Neithertheless, the program i gave you have a small bug (in the "your new brightness level is: " ) but nothing harmful...
You don't have to run it in sudo...
Meanwhile, Laurent Almeras corrects the small bug, you should be able to set it more or less properly by doing the command (my small script)
"Brightness_test.sh 5" for example, and then the up/down options should work...
If they don't, please inform us...

1. "And how can I... bind Fn keys... via ...acpi" :
If this doesn't work out of the box for you, I am pessimistic about make it work. But we can try :
 - in a terminal window, run the 'acpi_listen' command
 - press your brightness up and brightness up key
 - copy the lines printed (here it is :
sony/hotkey SPIC 00000001 00000010
sony/hotkey SPIC 00000001 0000003b
sony/hotkey SPIC 00000001 00000011
sony/hotkey SPIC 00000001 0000003b
 - if acpi_listen doesn't print anything, so the acpi events are invisible to linux and there's nothing to do
 - else edit the /etc/acpi/events/sony-brightness-up and /etc/acpi/events/sony-brightness-down by replacing the line with the correct event : for me :
sony-brightness-down: event=sony/hotkey SPIC 00000001 00000010
sony-brightness-up:event=sony/hotkey SPIC 00000001 00000011

2. I'm currently updating my packages with the yleetiny

My packages updated :

http://data.likide.homelinux.org/hal-sony-lcd-wa_0.4-1_amd64.deb
http://data.likide.homelinux.org/hal-sony-lcd-wa_0.4-1_i386.deb

(for the persons who use hardy, it seems there's at the moment a problem with policykit which breaks gnome-power-management lcd brightness setting).

yleetiny (yleetiny) wrote :

Hello, i just make a topic on the developpement on the french ubuntu forum :
here is the link (you'll find other people that uses smartdimmer too, and
maybe test your solution on KDE)
http://forum.ubuntu-fr.org/viewtopic.php?id=185566

2008/1/25, LaurentAlmeras <email address hidden>:
>
> My packages updated :
>
> http://data.likide.homelinux.org/hal-sony-lcd-wa_0.4-1_amd64.deb
> http://data.likide.homelinux.org/hal-sony-lcd-wa_0.4-1_i386.deb
>
> (for the persons who use hardy, it seems there's at the moment a problem
> with policykit which breaks gnome-power-management lcd brightness
> setting).
>
> --
> LCD brightness setting doesn't work with Sony Vaio VGN-S5M
> https://bugs.launchpad.net/bugs/77739
> You received this bug notification because you are a direct subscriber
> of the bug.
>

The new file makes the script from yleetiny work, it now returns:
"method return sender=:1.3 -> dest=:1.23 reply serial=2
    int32 0"
And it sets brightness from 2 to 3; smartdimmer and of my display brightness say the same. But nothing changed in the brightness applet. The applet is in version 2.20.0 and it's a little tricky to get the regulator to the position I want. Is that right?

If there's no way to make it work I still have smartdimmer, so don't spend more time with my problems then with yours. Except you have the final big idea :)

have a nice weekend everyone.

yleetiny (yleetiny) wrote :

Sebastian Gaul:
My script is not perfect : it overides the applet (in fact it does exactly what the applet does in a different language).
But i think it still a good thing because :
1- it better respect the security
2- with it Gnome brightness preferences works (when you swith form sector/battery the light changes)

Laurent Almeras:
Firstly thanks for all your work...
Secondly, setting the brightness for VAIO seems to be a common problem (on ubuntu's french forum), what we have done so far should works out of the box for smartdimmer users !
But unfortunately many users still have to use xbacklight or even software solution. I think we can easily provide a solution for them too.
Thinking a bit about it, it seems to me that the best way is just to use a common platform for all VAIO users in hal which will call acpi.
This way it will allows every users to set his brightness correctly (or if not with a software implementation).
Advantages :
1- more flexible (people will just have to change a variable to switch between different solution ("echo", xbacklight, smartdimmer, nvclock)
2- it will reduce the complexity of the problem because there will have only one file or two for everyone
3- you can make it for every vaio users
Disvantages :
1- it makes hal dépendant of acpi
2- others ideas that i haven't been thinking of...

Thirdly and Finally, i'm asking you if you're interrested in it so that i can count on you to "package" it and helping me if i got a problem.

yleetiny (yleetiny) wrote :

Laurent Almeras :
There is a really small bug in your file when I checked them its in your fdi file :
If you say "laptop_panel.num_levels = 20 (0x15) (int)"
that means the levels will begin from "0" to "19" ( 19-0+1= 20 =num_levels, that is the difference between the number of levels, and the maximum level)
It implies that in fact there is "21" num_levels, so you have to update your fdi file!

Sebastian Gaul :
I made some tests and it seems that the applet read its informations during the starting of gdm...

1- Firstly you will have to update your fdi file :
sudo gedit "/usr/share/hal/fdi/policy/10osvendor/10-sony-laptop-panel-mgmt-policy.fdi"
change all the "20" into "21", then save :

2- restart hal :
sudo /etc/init.d/hal restart

3- restart your gdm (Ctrl + Alt + backspace), and enjoy

(NB: you can just reboot you computer to automatically restart hal and gdm)

Yes, finally it works. Thanks a lot to you. Okay, the Brightness Applet itself is very tricky to handle, changes the brightness already by clicking on the icon (is it working fine on yours?). But that doesn't really matter, the brightness is now controlled by Gnome Energy Management. Merci beaucoup mes voisins francais (hope that means what I meant - 3 years french and there's nothing in my head anymore, terrible...).

yleetiny : thanks for the new bug report. I agree to help you for your scripts (tests, packages). You can contact me directly via jabber or mail to lalmeras %at% gmail.com

Sebastian : very good french. I also have problems with brightness applet, but I run a beta release so the problem is maybe normal.

New packages (thanks yleetiny) :

http://data.likide.homelinux.org/hal-sony-lcd-wa_0.5-1_i386.deb
http://data.likide.homelinux.org/hal-sony-lcd-wa_0.5-1_amd64.deb

The num_levels bug affects gnome-power-manager because when it encounters out of range value at starting, it doesn't set desired brightness value.

Sorry, there is one more problem i've just reckognized:

After logout with strg+alt+backspace and relogin I get an "internal error: failed to initialize HAL".

Just wanted to mention that...

yleetiny (yleetiny) wrote :

@Sebastian
is your issue reproductible after a complete reboot of your PC?
(maybe, there is an issue about hal, if you restart/start it manually when you are in an X session, i don't know)
If it is reproductible that will means that is a real issue....
take us inform!
(sorry for my english i'm sure i've made a lot of mistakes)

There are some facts that are different:
1. The new script only works after log on my computer manually, auto login itself works, but the brightness applet does not work then.
2. After start/ restart everything works fine.
3. When log out with ctrl+alt+backspace and relogon I get the message: "internal error: failed to initialize HAL".

I can't reproduce this problem. I currently use v0.5-1 package.

You can try to remove my package (dpkg -r hal-sony-lcd-wa), verify that /etc/hal/fdi/policy/10osvendor no longer contains 10-sony-laptop-panel-mgmt-policy.fdi.

Then see if your HAL initialization error still occurs.

You can also check your ~/.xsession-errors to check if there is hal-related errors and detailled output.

yleetiny (yleetiny) wrote :

I can't reproduce this problem too...

Could you please give me the results of this command ?:
 grep -i hald /var/log/* > ~/hald_errors.log
which will create a file hald_errors.log in your HOME directory...
Please send us it...

Hmmm... At the moment I don't have the problem. Hope that wont change again. But when this problem returns i'll post it here immediately...

benste (benste) wrote :

Someone here who can help me with my FE31m? --> https://bugs.launchpad.net/ubuntu/+source/hotkey-setup/+bug/277589
(first hotekeys didn't work but now it's the change which woun't work)

yleetiny (yleetiny) wrote :

Here is a package to install the new method "sony-smartdimmer" in hal and hal-info.
It will allows the sony vaio user who can use smartdimmer to change their brightness, to change their brightness though the gnome-applet, and also have a functionnal FN-keys.

NB: only a few model will have the FN-keys working, there are 5 models at the moment :
 VGN-S5M_S, VGN-FE31M, VGN-FE21M, VGN-C2Z_B, VGN-FE48E

Salut and thank you for the fix. Really works fine on FE48E. Only one thing: over the keyboard there are 5 special keys: Mute, volume down, up and S1 and S2. Volume keys work fine, but the S keys have the same function (and even keycode) like brightness up and down via FN keys.

Doesn't really matter to me anymore, I've just ordered a new notebook yesterday. And now everything works fine on my Sony. Murphy's Law, huh?

enton (8365c048a696) wrote :

Hello,

my FN Keys are working too. But I got a Sony Vaio VGN-FE11H. First it only display that the brightness would change, but nothing happend. After I installed hal-sony-lcd-wa_0.5-1_i386.deb it still doesnt work. But then I change the
/usr/share/hal/fdi/information/10freedesktop/10-sony-laptop-panel-mgmt-policy.fdi
file and insert my Vaio model like yleetiny above tells and now its works.

Thank you very much for the package and the informations.

Ps
sorry for my english...

yleetiny (yleetiny) wrote :

I made some modification to base the recognition not on the vaio model but
on the graphic card

See Bug 277589 to get it
2008/10/19 enton <8365c048a696@61f8fac6a94f.anonbox.net>

> Hello,
>
> my FN Keys are working too. But I got a Sony Vaio VGN-FE11H. First it only
> display that the brightness would change, but nothing happend. After I
> installed hal-sony-lcd-wa_0.5-1_i386.deb it still doesnt work. But then I
> change the
>
> /usr/share/hal/fdi/information/10freedesktop/10-sony-laptop-panel-mgmt-policy.fdi
> file and insert my Vaio model like yleetiny above tells and now its works.
>
> Thank you very much for the package and the informations.
>
> Ps
> sorry for my english...
>
> --
> LCD brightness setting doesn't work with Sony Vaio VGN-S5M
> https://bugs.launchpad.net/bugs/77739
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Martin Pitt (pitti) wrote :

I don't have this hardware, so I cannot work on this.

Changed in hal:
assignee: pitti → nobody
status: Incomplete → New
Gaetan Nadon (memsize) wrote :

Thanks for reporting this bug and any supporting documentation. Since this bug has enough information provided for a developer to begin work, I'm going to mark it as confirmed and let them handle it from here. Thanks for taking the time to make Ubuntu better!
BugSquad

Changed in hal:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers