Nvidia graphics adapter, display backlight, part II
Hi all,
as reported in the preceding thread, NvClock is also able to change the display backlight by driving the chip's smartdimmer directly. After my recent examination, I found some time to have a closer look at NvClock and put it into a separate driver.
The new approach offers some advantages over mbp_nvidia_bl:
- More fine-grained brightness control: The chip supports 1024 levels.
- Lower minimum brightness, allowing to save power at night.
- Should work on the problematic machines (MacBook 5, MacBook Air 2) as well.
Please give it a try and report whether it works. To do so, install nvidia-bl-dkms from the Mactel-PPA, replace the line for mbp_nvidia_bl in /etc/modules with
and reboot. Do not load both nvidia_bl and mbp_nvidia_bl.
Please note: The 'shift' parameter is necessary because some userland tools (either hal or g-p-m) seem to not play well with more than 256 levels. This parameter shifts all values by 2 bit, effectively reducing the valid range from 1024 to 256 levels for now.
After rebooting, the command
Code:
lshal -u /org/freedesktop/Hal/devices/computer_backlight
should output:
Code:
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.subsystem = 'backlight' (string)
info.udi = '/org/freedesktop/Hal/devices/computer_backlight' (string)
laptop_panel.access_method = 'general' (string)
laptop_panel.num_levels = 256 (0x100) (int)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'backlight' (string)
linux.sysfs_path = '/sys/devices/virtual/backlight/nvidia_backlight' (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)
And you should be able to adjust brightness by running
Code:
echo 100 | sudo tee /sys/class/backlight/nvidia_backlight/brightness
as well as using the function keys.
MacBook 5, MacBook Air 2 users: Does it work using Nvidia's proprietary driver?
MacBook Pro 5 users: Since your machines incorporate 2 graphics chips, I, honestly, don't know which one to drive. I chose the first one. Does it work at all?
ciao,
Mario
Re: Nvidia graphics adapter, display backlight, part II
Hi Mario!
It works on a MBP 4,1.
Thanks for the good work.
Re: Nvidia graphics adapter, display backlight, part II
On MacBook 5,1 && Nvidia driver it works (also F2/F3) :)
No problem with suspend to ram (it restores correctly the brightness).
Some issues:
- if "Use a ambient light to adjust LCD brightness"is set in gnome power manager, the brightness goes to 100% randomly.
- if "Dim display when idle" is set, when you resume after idle status (for example with a trackpad gesture or button pressing) the brightness goes more high that before idling.
Quote:
ercoppa@ercoppa-laptop:~$ lshal -u /org/freedesktop/Hal/devices/computer_backlight
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.subsystem = 'backlight' (string)
info.udi = '/org/freedesktop/Hal/devices/computer_backlight' (string)
laptop_panel.access_method = 'general' (string)
laptop_panel.num_levels = 256 (0x100) (int)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'backlight' (string)
linux.sysfs_path = '/sys/devices/virtual/backlight/nvidia_backlight' (string)
org.freedesktop.Hal.Device.LaptopPanel.method_argn ames = {'brightness_value', ''} (string list)
org.freedesktop.Hal.lsDevice.LaptopPanel.method_ex ecpaths = {'hal-system-lcd-set-brightness', 'hal-system-lcd-get-brightness'} (string list)
org.freedesktop.Hal.Device.LaptopPanel.method_name s = {'SetBrightness', 'GetBrightness'} (string list)
org.freedesktop.Hal.Device.LaptopPanel.method_sign atures = {'i', ''} (string list)
EDIT: Ehm, in my output I have only 256 levels (/etc/module has the shift=2 param for nvidia_bl)
Greets, ercoppa.
P.s. @Mario: thanks for your work.
P.P.s It works also under KDE 4.2 RC & battery widget (that have a bar to control brightness like as brightness applet)
Re: Nvidia graphics adapter, display backlight, part II
Just installed on MBP 5,1 and it doesn't seem to work, lshal reports correctly:
Code:
lshal -u /org/freedesktop/Hal/devices/computer_backlight
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.subsystem = 'backlight' (string)
info.udi = '/org/freedesktop/Hal/devices/computer_backlight' (string)
laptop_panel.access_method = 'general' (string)
laptop_panel.num_levels = 256 (0x100) (int)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'backlight' (string)
linux.sysfs_path = '/sys/devices/virtual/backlight/nvidia_backlight' (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)
But when pressing brightness keys it doesnt't change the brightness and doing
Code:
echo 1 | sudo tee /sys/class/backlight/nvidia_backlight/brightness
doesn't have any effect either.
It correctly detects the 9600M GT:
Code:
[ 17.825672] nvidia_bl: Supported Nvidia graphics 10de:0647 detected
So am reverting back to mbp_nvidia_bl for now. Let me know if I can do any more debugging for you.
Re: Nvidia graphics adapter, display backlight, part II
hi everybody, first of all thanks for the great work you have been doing here with the new apple hardware. i've been reading these pages since a few months, and put my hands on a MBP5.1 two weeks ago. kubuntu user since two years, i immediately installed kubuntu 8.10 it on my first apple machine. and thanks to the great documentation on the forum, now also well organised in the help pages, i was able to get most things working. i'm obviously still working on a few kinks, one of them being the media keys.
sorry for my introduction in your tech post, Mario, but here i'm back to your alternative nvidia module.
i ran both the nvidia-glx-177 and now nvidia-glx-180 proprietary drivers with all kernel modules from mactel/ppa. with the mbp_nvidia_bl module loaded, in the kde4 guidance power manager, the sliders for display brightness pop-up and do work.
moreover the keyboard backlight can be controlled with the echo command, thanks to the hal-applesmc module (if any other kde-user confirms this, it can be corrected in the mactel wiki page).
i just didn't get the media keys to control these settings. in fact even eject does not work, the only ones working are volume up/down. i'm aware that it might be related with the keyboard mapping layout, but after trying all possible combinations (including the mbp/us combination) i came back to modules.
hence i tried to install the nvidia-bl-dkms, commenting out mbp_nvidia_bl and adding nvidia_bl shift=2 in the file /etc/modules. after rebooting, the media keys (apart from volume up/down) still didn't work, and the sliders in the power manager disappeared. moreover the sensor application didn't start, complaining about missing modules, as well as the echo command to the fans would have no effect. is it a conflict with applesmc.768?
reverting the /etc/modules file and removing nvidia-bl-dkms, fixed it back. but i had to reboot four times to get back the fans spinning faster and the aluminium brick to start cooling down..
if what i did is correct, i report this module not working for me.
thanks for your time spent working on this and all other issues!
greetings, Lo.
Re: Nvidia graphics adapter, display backlight, part II
Quote:
Originally Posted by
alexmurray
Just installed on MBP 5,1 and it doesn't seem to work, lshal reports correctly: ...
Let me know if I can do any more debugging for you.
yes, you can. that's what i almost expected. the driver seems to drive the wrong graphics chip. please send me the output of:
as well as thanks & ciao,
Mario
Re: Nvidia graphics adapter, display backlight, part II
Quote:
Originally Posted by
buntuLo
hence i tried to install the nvidia-bl-dkms, commenting out mbp_nvidia_bl and adding nvidia_bl shift=2 in the file /etc/modules. after rebooting, the media keys (apart from volume up/down) still didn't work, and the sliders in the power manager disappeared. moreover the sensor application didn't start, complaining about missing modules, as well as the echo command to the fans would have no effect. is it a conflict with applesmc.768?
reverting the /etc/modules file and removing nvidia-bl-dkms, fixed it back. but i had to reboot four times to get back the fans spinning faster and the aluminium brick to start cooling down..
thanks for your testing. i'm not an expert for KDE. but the module is not conflicting with applesmc. i use both. what you observed is indeed very strange... right now, it doesn't work on your MBP5,1. please, use mbp_nvidia_bl for now.
regarding the function keys: do they work in KDE at all? i mean: on other machines. i'm asking because Macs aren't different in this case. what does the lshal test mentioned in my initial post output?
ciao,
Mario
Re: Nvidia graphics adapter, display backlight, part II
Mario,
the lshal output seems correct with both modules.
with mbp_nvidia_bl loaded:
Code:
lo@lomac:/etc$ lshal -u /org/freedesktop/Hal/devices/computer_backlight
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.subsystem = 'backlight' (string)
info.udi = '/org/freedesktop/Hal/devices/computer_backlight' (string)
laptop_panel.access_method = 'general' (string)
laptop_panel.num_levels = 16 (0x10) (int)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'backlight' (string)
linux.sysfs_path = '/sys/devices/virtual/backlight/mbp_backlight' (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', ''} (stringlist)
with nvidia-bl-dkms loaded:
Code:
lo@lomac:~$ lshal -u /org/freedesktop/Hal/devices/computer_backlight
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.subsystem = 'backlight' (string)
info.udi = '/org/freedesktop/Hal/devices/computer_backlight' (string)
laptop_panel.access_method = 'general' (string)
laptop_panel.num_levels = 256 (0x100) (int)
linux.hotplug_type = 2 (0x2) (int)
linux.subsystem = 'backlight' (string)
linux.sysfs_path = '/sys/devices/virtual/backlight/nvidia_backlight' (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', ''} (stringlist)
by the way, loaded it back to copy this output, and now fans and sensors are working properly.. weird, i'm pretty sure i didn't change anything else the previous time. moreover the brightness sliders in the power manager are there, but they have no effects.
about the function keys under kde, they all works on my old laptop running 7.10 and kde3.5, using some asus-acpi modules.
cia'cia', Lo.
Re: Nvidia graphics adapter, display backlight, part II
This works great on my 13" MacBook (Unibody) 5.1, both the slider on the menu bar and the F1/F2 keys on the keyboard. The instructions worked as stated. Had a little trouble sorting out the packages to get it to work, but that was due to my inexperience with Linux.
It appeared (brightness level) to be a little sporadic sometimes, changing brightness a little after I've set it. It seems to happen when the ambient light sensor settings is turned on in the Gnome power management. Although with the ambient setting on it doesn't seem to change the brightness with actual changes in the ambient light.
Thank you so much for your work on this. I would be happy to help with updating the MacBook install instructions with this information if I'm allowed to. So much info on the web pertaining to this is out of date (or plain wrong) and I'd be happy to help out with that so you can keep doing the important stuff, like updating actual code. PS - if you want to work on power management and sound next I can edit whatever you'd like. Bob
Re: Nvidia graphics adapter, display backlight, part II
I added the mactel repository to my system, and enabled nvidia_bl_dkms, but I can't seem to get any further.
There is no nvidia line in my /etc/modlues file
I think something isn't installed properly.
Any thoughts?
-Sterling
System info:
Macbook 13" 5.1
Ubuntu 8.10