Apple MacBook backlight brightness doesn't work

Bug #72287 reported by Davide Bertola
42
Affects Status Importance Assigned to Milestone
HAL
Fix Released
Medium
hal (Ubuntu)
Fix Released
Medium
Martin Pitt

Bug Description

There is no support for backlight control of the macbook.
Currently I use the package macbook-backlight-hal from desrt (http://desrt.mcmaster.ca/macbook.xhtml) that needs to be manually fixed to work on feisty/edgy. This package uses an init script that creates a hal device at boot. I think this is not a good solution (?)

Tags: apple macintel
Revision history for this message
Martin Pitt (pitti) wrote :

Hi Ryan!

So what are your magic runes to get backlight control working on the MacBook?

Thanks in advance! *hug*

Changed in hal:
status: Unconfirmed → Needs Info
Revision history for this message
Allison Karlitskaya (desrt) wrote :

Hi Martin

I'm more or less using what I describe on that page.

I'm working on a better solution for the longterm. Maybe I'll get some time to hack on it this week at the conference..... (I wouldn't be suprised if I don't, though) :)

I'll keep you posted.

Revision history for this message
Lionel Le Folgoc (mrpouit) wrote :

Hi,

There is also in feisty the program pommed which lets you change backlight brightness with F1 and F2 keys. But I don't think it uses hal.

Revision history for this message
In , Allison Karlitskaya (desrt) wrote :

here's the code.

i'd email the mailing list, but this conference has no smtp server :)

Revision history for this message
In , Allison Karlitskaya (desrt) wrote :

Created an attachment (id=8441)
support for macbook backlight

first try. comments, please.

Revision history for this message
Allison Karlitskaya (desrt) wrote :

Hi Martin

Patch is written and has been sent upstream. David has said that he will try to make a release in the coming weeks, so should be good to go for feisty.

Cheers

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks, Ryan! Will grab the patch.

Changed in hal:
assignee: nobody → pitti
importance: Undecided → Medium
status: Needs Info → In Progress
Revision history for this message
Allison Karlitskaya (desrt) wrote :

It turns out that on suspend/resume, the backlight control register is clobbered to all-zeros.

The only way to fix this is to use vbetool to save/restore the BIOS state. This is currently broken on the macbook due to the init scripts being out of order (vbesave runs before acpid, and on macbook this causes vbesave to fail to detect that we're a laptop).

There is, however, another fix. The attached program (which is a hackish modification of part of the patch submitted upstream) will reset the value of the register. This seems to be sufficient to get the card working properly again (ie: no need for a full vbetool state restore).

Link with -lpci.

This code needs to be somewhere -- be it in the kernel, the X server, HAL or the system resume scripts -- but only run for Macbooks. I'm guessing that for now, HAL or "system resume scripts" is the easy answer.

Also: to do this properly we should probably look at the value of the backlight at suspend, save this value, then write the same value back on resume. The current code just sets to max value on resume.

David is currently romping around in the aussie outback. I'll try to nail him down to find out what he thinks :)

Changed in hal:
status: Unknown → Confirmed
Revision history for this message
Matthew Garrett (mjg59) wrote :

In bzr

Changed in hal:
status: In Progress → Fix Committed
Revision history for this message
In , Zeuthen (zeuthen) wrote :

Looks good; any chance you can

 1) rebase to HEAD
 2) fix up coding style to match the rest of the source code?

thanks!

Revision history for this message
In , Zeuthen (zeuthen) wrote :

Also, you mentioned somewhere else that this has issues with suspend? What were those?

Changed in hal:
status: Confirmed → In Progress
Revision history for this message
Martin Pitt (pitti) wrote :

 hal (0.5.8.1-4ubuntu9) feisty; urgency=low
 .
   [ Sebastian Dröge ]
   * debian/patches/62_dbus-python-0.8.patch:
     + Correctly show HAL properties in hal-device-manager with dbus-python
     0.80. https://bugs.freedesktop.org/show_bug.cgi?id=9343
 .
   [ Matthew Garrett ]
   * debian/patches/63_fixup_macbook_pro.patch:
     + Fix building the MBP addon, and edit the FDI files so it binds to new
     hardware.
   * debian/patches/64_macbook_backlight.patch:
     + Add support for the backlight on Macbooks.
     https://launchpad.net/ubuntu/+source/hal/+bug/72287
 .
   [ Martin Pitt ]
   * Add debian/patches/62_ignore_single_slash_label.patch: Ignore labels which
     only consist of a slash, so that they do not end up as /media/-.
     (LP: #83323)
   * debian/patches/30-mp3-player-fdi.patch: Add Sony Ericsson W300i.
     (LP: #86866)
   * debian/patches/30-mp3-player-fdi.patch: Add Transcend T.Sonic 520.
     (LP: #90117)

Thanks, Matthew!

Changed in hal:
status: Fix Committed → Fix Released
Revision history for this message
In , Richard Hughes (richard-hughes) wrote :

Pushed to master:

add support for the macbook backlight

Apply a patch from Ryan Lortie <email address hidden> to support the Macbook
backlight.
The code was written after the AppleIntelIntegratedFramebuffer.kext kernel
extension was reverse engineered by Ryan.

Rebased to master, and CodingStyle corrected by me, no other changes.

Revision history for this message
In , Allison Karlitskaya (desrt) wrote :

Thanks for this, Richard.

cheers

Changed in hal:
status: In Progress → Fix Released
Revision history for this message
Martin Böhm (martin.bohm) wrote :

I am running a fully updated Gutsy install on a non-pro MacBook and the brightness controls are not working here.

Revision history for this message
Stefano Rivera (stefanor) wrote :

Martin, your bug is different: Bug 119184

Revision history for this message
Bruno Santos (bsantos) wrote :

Stefano, the bug he is referring isn't that one either. The keys work (as in send the events) but the brightness level gets stuck on the minimum. Considering the keys work and g-p-m can adjust the brightness (even from the applet) what can be the problem here?

Revision history for this message
Whisky (xwhisky) wrote :

Hi,

today I was installing gutsy tribe 4. I upgraded it to new staff from repositories. And my backlight on macbook don't function. I have black macbook first generation. And It is behave strange, cause I can decrease it but when I want increse it increse only one unit and on next it goes one unit down. It is really strange.

Revision history for this message
Whisky (xwhisky) wrote :

I have latest - and it still doesnt work. As I wrote to comments.

Changed in hal:
status: Fix Released → Invalid
Revision history for this message
Bruno Santos (bsantos) wrote :

Hello Whisky, this isn't the same issue. This one was related to missing rules in hal fdi files for newer models recognition. Our problem right now has to do with something else, I believe. So this bug is solved, hal supports our hardware. Can it be g-p-m?

Do other laptop models work well? I get the same behavior as Whisky on a Macbook C2D.

Revision history for this message
Whisky (xwhisky) wrote :

Maybe you are right, do you think that we should make new bug? Maybe it's a good idea!

Revision history for this message
Bruno Santos (bsantos) wrote : Re: [Bug 72287] Re: Apple MacBook backlight brightness doesn't work

I think someone already did:
https://bugs.launchpad.net/ubuntu/+source/gnome-power-manager/+bug/123548

:)

On Tue, 2007-08-21 at 16:51 +0000, Whisky wrote:
> Maybe you are right, do you think that we should make new bug? Maybe
> it's a good idea!
>

Martin Pitt (pitti)
Changed in hal:
status: Invalid → Fix Released
Changed in hal:
importance: Unknown → Medium
Changed in hal:
importance: Medium → Unknown
Changed in hal:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.