# [Solved] Backlight Dimming

## Ktravaglini

Hello,

I've gotten most things up on my HP dv6458se Notebook, but one thing I cant get going is backlight dimming.  I've enabled kernel support for brightness but don't know where to go from there.

Here's data you may need

Platform: amd64, Up-to-date xorg, xfce-4.4

```

Osmosis ~ # lspci

00:00.0 RAM memory: nVidia Corporation C51 Host Bridge (rev a2)

00:00.1 RAM memory: nVidia Corporation C51 Memory Controller 0 (rev a2)

00:00.2 RAM memory: nVidia Corporation C51 Memory Controller 1 (rev a2)

00:00.3 RAM memory: nVidia Corporation C51 Memory Controller 5 (rev a2)

00:00.4 RAM memory: nVidia Corporation C51 Memory Controller 4 (rev a2)

00:00.5 RAM memory: nVidia Corporation C51 Host Bridge (rev a2)

00:00.6 RAM memory: nVidia Corporation C51 Memory Controller 3 (rev a2)

00:00.7 RAM memory: nVidia Corporation C51 Memory Controller 2 (rev a2)

00:02.0 PCI bridge: nVidia Corporation C51 PCI Express Bridge (rev a1)

00:03.0 PCI bridge: nVidia Corporation C51 PCI Express Bridge (rev a1)

00:05.0 VGA compatible controller: nVidia Corporation C51 [Geforce 6150 Go] (rev a2)

00:09.0 RAM memory: nVidia Corporation MCP51 Host Bridge (rev a2)

00:0a.0 ISA bridge: nVidia Corporation MCP51 LPC Bridge (rev a3)

00:0a.1 SMBus: nVidia Corporation MCP51 SMBus (rev a3)

00:0a.3 Co-processor: nVidia Corporation MCP51 PMU (rev a3)

00:0b.0 USB Controller: nVidia Corporation MCP51 USB Controller (rev a3)

00:0b.1 USB Controller: nVidia Corporation MCP51 USB Controller (rev a3)

00:0d.0 IDE interface: nVidia Corporation MCP51 IDE (rev f1)

00:0e.0 IDE interface: nVidia Corporation MCP51 Serial ATA Controller (rev f1)

00:10.0 PCI bridge: nVidia Corporation MCP51 PCI Bridge (rev a2)

00:10.1 Audio device: nVidia Corporation MCP51 High Definition Audio (rev a2)

00:14.0 Bridge: nVidia Corporation MCP51 Ethernet Controller (rev a3)

00:18.0 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] HyperTransport Technology Configuration

00:18.1 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Address Map

00:18.2 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] DRAM Controller

00:18.3 Host bridge: Advanced Micro Devices [AMD] K8 [Athlon64/Opteron] Miscellaneous Control

03:00.0 Network controller: Broadcom Corporation Unknown device 4328 (rev 03)

07:05.0 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller

07:05.1 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 19)

07:05.2 System peripheral: Ricoh Co Ltd Unknown device 0843 (rev 01)

07:05.3 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 0a)

07:05.4 System peripheral: Ricoh Co Ltd xD-Picture Card Controller (rev 05)

```

I tried the guide on power management but its only for IBM thinkpads and toshiba's.\

I'd also like to be able to map the keys to control dimming if possible...(fn key f7 (Down) fn key f8 (up))Last edited by Ktravaglini on Tue Jul 08, 2008 6:18 am; edited 1 time in total

----------

## bunder

did you turn on "backlight & lcd device support"? 

 *Quote:*   

>   │ CONFIG_BACKLIGHT_LCD_SUPPORT:
> 
>   │ Enable this to be able to choose the drivers for controlling the  
> 
>   │ backlight and the LCD panel on some platforms, for example on PDAs. 

 

i think that's the right one.

cheers

----------

## Ktravaglini

I already have that configured...What do I do next.

----------

## Ktravaglini

Any help will be appreciated...

----------

## pappy_mcfae

IMHO, the best thing to do is not to use the in-kernel brightness controls. In my particular case, having the brightness controlled by the kernel stopped my bright/dim control from working right. I created a script that sent a number to the kernel that told it how bright I wanted the display, and it worked until the screen saver kicked in. Then, it was full bright, and had to be readjusted. 

There might be some programs in portage that will get the job done by using a mix of kernel and userspace stuff, but nothing beats using the already provided keys and having the setting stay put. It's so much simpler. 

Blessed be!

Pappy

----------

## Ktravaglini

Ya, I'm trying to map the keys to the control (Something I need to get dimming to work first on though).  I'm kinda noobish with script stuff...can you provide me the one you wrote...so I may use it and/or alter it to make it work...I have a battery rated for 4 hours...and I only get 1.5 hours in linux  :/ (Im stuck in windows on long plane rides).

----------

## pappy_mcfae

Ok, here's the script:

```
#! /bin/bash

echo 0 > /sys/class/backlight/acpi_video0/brightness

echo 0 > /sys/class/backlight/acpi_video1/brightness

echo 0 > /sys/class/backlight/acpi_video0/actual_brightness

echo 0 > /sys/class/backlight/acpi_video1/actual_brightness
```

Yes, somehow I wound up with the kernel thinking my laptop had two LCD screens. You will probably have to modify it a bit, but if it will help, it's yours.

Blessed be!

Pappy

----------

## Ktravaglini

I was looking into your script ans noticed I don't have those brightness Directories...when I attempt to make them with mkdir I get:

Osmosis backlight # mkdir acpi_monitor0

mkdir: cannot create directory `acpi_monitor0': No such file or directory

Im using kernel support, asuumed the acpi_* was your monitor name in xorg.conf, and there was no other external software.

If any of this is incorrect please let me know.

----------

## pappy_mcfae

If you have the kernel set to operate the brightness, then those directories should exist. Since they don't, I have to assume the kernel wasn't set correctly.

Blessed be!

Pappy

----------

## Ktravaglini

Where exactly is kernel brightness support...I've enabled something and am loading a "lcd" and "backlight" module but uh?

----------

## pappy_mcfae

Those settings are the ones to which I am refering, and you need to compile them into the kernel. As modules, they don't load unless they are autoloaded, or are called by a process requiring modules. When compiled into the kernel, they start at boot time automatically.

Blessed be!

Pappy

----------

## Ktravaglini

I have them built in but it still doesn't have the paths

----------

## pappy_mcfae

Then I am lost. When the settings were compiled into my kernel, I had the directories. When I removed it from the kernel, the directories went away. So I am not sure what you're doing wrong.

Blessed be!

Pappy

----------

## Ktravaglini

Hmm....maybe I have some setting off.  Can I get the CONFIG_'s you have for backlight support and see if I missed something?Last edited by Ktravaglini on Mon Jul 07, 2008 4:21 am; edited 2 times in total

----------

## pappy_mcfae

This is a snippet of how I set it up. 

```
#

# Graphics support

#

CONFIG_BACKLIGHT_LCD_SUPPORT=y

CONFIG_BACKLIGHT_CLASS_DEVICE=y

CONFIG_LCD_CLASS_DEVICE=y

# CONFIG_BACKLIGHT_PROGEAR is not set
```

That should generate the directories and allow you to control your dimming.

Blessed be!

Pappy

----------

## Ktravaglini

I had progear enabled...compiling kernel now

Give me 2 minutes and Ill show my results.

EDIT: Nope...compiledmy kernel exactly as your have it and I have no directories.

----------

## pappy_mcfae

The only other thing I can think of is that it's a 64 bit bug in the kernel. Beyond that, I'm at a loss. Sorry.

Blessed be!

Pappy

----------

## Ktravaglini

Hmm, I was running a few locates and I found something interesting...

```
Osmosis conf.d # locate brightness

/usr/lib64/hal/scripts/linux/hal-system-lcd-set-brightness-linux

/usr/lib64/hal/scripts/linux/hal-system-lcd-get-brightness-linux

/usr/lib64/hal/scripts/hal-system-lcd-get-brightness

/usr/lib64/hal/scripts/hal-system-lcd-set-brightness

/usr/portage/sys-apps/hal/files/hal-0.5.7-sony-brightness.patch

/usr/portage/app-misc/hal-info/files/02_hardware_brightness_fixups.patch

/usr/share/gtk-doc/html/libgimpwidgets/stock-tool-brightness-contrast-22.png

/usr/share/gtk-doc/html/libgimpwidgets/stock-tool-brightness-contrast-16.png

Osmosis conf.d # 
```

Perhaphs there's some potential there...cant get it to run though...

Upon further testing (mostly running random things...poking around) I came up with this:

```
Osmosis linux # ls

hal-dockstation-undock-linux           hal-system-power-reboot-linux

hal-luks-remove-linux                  hal-system-power-set-power-save-linux

hal-luks-setup-linux                   hal-system-power-shutdown-linux

hal-luks-teardown-linux                hal-system-power-suspend-hybrid-linux

hal-system-killswitch-get-power-linux  hal-system-power-suspend-linux

hal-system-killswitch-set-power-linux  hal-system-wol-enable-linux

hal-system-lcd-get-brightness-linux    hal-system-wol-enabled-linux

hal-system-lcd-set-brightness-linux    hal-system-wol-linux

hal-system-power-hibernate-linux       hal-system-wol-supported-linux

Osmosis linux # ./hal-system-lcd-get-brightness-linux

org.freedesktop.Hal.Device.LaptopPanel.NotSupported

No ACPI method found

Osmosis linux # ./hal-system-lcd-set-brightness-linux

org.freedesktop.Hal.Device.LaptopPanel.NotSupported

No ACPI method found
```

Indicating that there maybe some issues with acpi somehow...USE flags or something...

Further suggesting this is either a hardware error (Not being detected properly (Monitor)) or a software issue.

----------

## pappy_mcfae

This is possible. You may have to move around a bit to find workable drivers, if that's the case. Try the generic nvidia drivers (xf86-video-nv) to see if that helps. Yes, that sounds like a good avenue to explore.

Blessed be!

Pappy

----------

## Ktravaglini

I have the generic nvidia drivers....going to explore a few more things..

EDIT: After much intense googling and a lot of poking around I have concluded that this is NOT an isolated incident.  On every OS (Expect ubuntu) lcd brightness is an issue in the dv6000 notebook class.  Somehow ubuntu manages to get around it and has the brightness working perfectly.

Im downloading Xubuntu as we speak so I can investigate how exactly they have done this.

Hopefully my findings will help all the other annoyed dv6000 users out there...google shows many...

EDIT2: Success!

I didn't even need to go into ubuntu...

I found a nifty little guide trying to probe how ubuntu did it...completely on accident.

In the ACPI kernel settings (Under Power Management) the < > Video was unset....I simply Added it as a module echo'd it  to autoload and rebooted.

After I had that module loaded I catted "proc/acpi/video/VGA/LCD/brightness" for available brightnesses

Once I had that a simple echo NEW_BRIGHTNESS   | sudo dd of=/proc/acpi/video/VGA/LCD/brightness did the trick.

EDIT3: It seems this has also brought function to my brightness shift keys  :Wink:  I can now use fn+f7 and fn+f8 to adjust screen brightness!!

Im so happy that random blog was there... here's the link: http://brightlcd.blogspot.com/2007/10/god-said-videoko-and-lcd-was-bright.html

Now all thats needed is a script to adjust the brightness when the battery changes...or maybe there's a setting somewhere...anyway im estatic!  I can be in linux during the plane ride home now  :Smile: 

----------

## pappy_mcfae

That's great to hear. Glad you sorted it out.

Blessed be!

Pappy

----------

## Ktravaglini

More Success!

I had already created a battery runlevel from the power management guide, and I already had the battery/ac power runlevel script switch so I simply added a few lines...

This is /etc/acpi/actions/pmg_switch_runlevel.sh with my additions:

```

#!/bin/bash

# BEGIN configuration

RUNLEVEL_AC="default"

RUNLEVEL_BATTERY="battery"

# END configuration

if [ ! -d "/etc/runlevels/${RUNLEVEL_AC}" ]

then

    logger "${0}: Runlevel ${RUNLEVEL_AC} does not exist. Aborting."

    exit 1

fi

if [ ! -d "/etc/runlevels/${RUNLEVEL_BATTERY}" ]

then

    logger "${0}: Runlevel ${RUNLEVEL_BATTERY} does not exist. Aborting."

    exit 1

fi

if on_ac_power

then

    if [[ "$(</var/lib/init.d/softlevel)" != "${RUNLEVEL_AC}" ]]

    then

        logger "Switching to ${RUNLEVEL_AC} runlevel"

         /sbin/rc ${RUNLEVEL_AC}

         # Teh Crazy line that brightens my display ;-) - path may need to be changed

        echo 92 | sudo dd of=/proc/acpi/video/VGA/LCD/brightness

   fi

elif [[ "$(</var/lib/init.d/softlevel)" != "${RUNLEVEL_BATTERY}" ]]

then

    logger "Switching to ${RUNLEVEL_BATTERY} runlevel"

    /sbin/rc ${RUNLEVEL_BATTERY}

         # Teh Crazy line that dims my display ;-) - path may need to be changed

    echo 20 | sudo dd of=/proc/acpi/video/VGA/LCD/brightness

fi

```

NOTE: The path or /proc/acpi/.../brightness is NOT always the same for everyone! Please check it!

NOTE2: Also...The brightness levels, 92 and 20, may need to be changed as not all displays share the same levels (I assume).  You can find available levels by using the cat command above.

Hope this helps everyone else who has my issue...

----------

## mikegpitt

Cool! Nice script.

I added the echo | dd line into my /etc/acpi/default.sh on the ac_adapter event, and it works great.

----------

## keenblade

 *Ktravaglini wrote:*   

> ...
> 
> In the ACPI kernel settings (Under Power Management) the < > Video was unset....I simply Added it as a module echo'd it  to autoload and rebooted...

 

While I was trying to find a way to make it work brightness for my toshiba a100-599, I remember I read an article that it is not recommended to use video module. It was considered dangerous in some situations and so it was default unset in the kernel. I can't remember where I read it. But apparently it worked fine for you. My brightness does not work under linux for the shake of its crap phoenix bios. The next laptop I will buy will be the ones that does not have backlite florescent bulbs, so it will more power friendly.

----------

