Jump to content
About Just Joined group Read more... ×
ivik

UPDATED 20.12. GenericBrightness.kext

675 posts in this topic

Recommended Posts

Hi all.

There are 2 drivers for brightness:
1.
For those who have apple brightness slider working (max backlight>0 in ioreg) can use GenericBrightness.kext.zip. There is also VoodooPS2Controller with mapped keys for brightness for hp, acer, dell, samsung and lg.
To make native slider work, you need to add PNLF device:

Device (PNLF)
{
Name (_HID, EisaId ("APP0002"))
Name (_CID, "backlight")
Name (_UID, 0x0A)
Name (_STA, 0x0B)
}

After that you need to find where _BCM, _BCQ and _BCL methods are and what graphics you use, since a lot of dsdt had multiple methods, because there is support for multiple cards in bios.

If your graphics is (for example) GFX0 (search it from ioreg), then you should find that device in dsdt. Under that device, there are other devices (usually LCD, CRT, TV...). Look for the device that has those methods (_BCM, _BCQ and _BCL) and then put Name (_HID, EisaId ("LCD1234")).
Example:

Device (LCD)
{
Name (_ADR, 0x0400)
Name (_HID, EisaId ("LCD1234")) //this must be added
Method (_DCS, 0, NotSerialized)
{
}
Method (_DGS, 0, NotSerialized)
{
}
Method (_BCL, 0, NotSerialized)
{
}
Method (_BCM, 1, NotSerialized)
{
}
Method (_BQC, 0, NotSerialized)
{
}

2.
The second one (NoSlider.zip) can control brightness without PNLF. But you still have to add some code to dsdt.
Only Name (_HID, EisaId ("LCD1234")) is needed, like in first method.

In NoSlider there are also 2 apps:
console utility brightness with parameters:

brightness get => returns current brightness
brightness set yourbrightness => sets your brightness (from 0 to 100)
brightness up => one step up (usefull for keyboard mapping)
brightness down => one step down

Second app is Brightness Menulet. It is menubar plugin with slider for setting brightness. :)

GenericBrightness.kext.zip

NoSlider.zip

VoodooPS2.zip

Sources.zip

Share this post


Link to post
Share on other sites
Advertisement

Hi ivik,
thanks for sharing, this sounds promising but it doesn't work with my Pavilion laptop
with PNLF code:

Device (PNLF)
{
Name (_HID, EisaId ("APP0002"))
Name (_CID, "backlight")
Name (_UID, 0x0A)
Name (_STA, 0x0B)
Name (BCL1, Package (0x0D)
{
0x5F,
0x2B,
0x14,
0x18,
0x1C,
0x20,
0x25,
0x2B,
0x32,
0x3B,
0x45,
0x51,
0x5F
})
Name (BCL2, Package (0x0D)
{
0x64,
0x2E,
0x14,
0x19,
0x1F,
0x24,
0x29,
0x2E,
0x34,
0x3D,
0x48,
0x55,
0x64
})
Method (SBCM, 1, NotSerialized)
{
Store (Arg0, \_SB.PCI0.LPCB.EC.BRTL)
Store (Arg0, Z00B)
TRAP (0x1C)
}
Method (_BCL, 0, NotSerialized)
{
If (LEqual (PTPE, One))
{
Return (BCL1)
}
Else
{
Return (BCL2)
}
}

Method (_BCM, 1, NotSerialized)
{
SBCM (Arg0)
}

Method (_BQC, 0, NotSerialized)
{
Return (\_SB.PCI0.LPCB.EC.BRTL)
}
}

DSDT file here

thanks in advance for any suggestions

regards
s

Share this post


Link to post
Share on other sites

What does dmesg say about max brightness and levels?

 

It look like your Pavilion also writes brightness to EC like my acer.

But it is weird that it writes that high values... Mine for 0x64 (100% brightness) writes F (15) to EC (BRTS register).

 

Try runing RW-everything under windows and watch EC register for changes when brightness is changed.

 

Also... try with different _BCL return tables... Under _BCL just write:

 

Method (_BCL, 0, NotSerialized)
                       {
                               Return (BCL1)
                       }

Share this post


Link to post
Share on other sites
Try this dsdt:

Both working with slider as well as the sun Plus Fn keys with appropriate dsdt modification and kext in extra

Thnx,

Lg x130,Snow Leopard 10.6.5

Share this post


Link to post
Share on other sites

Doesn't work. I've added a PNLF device with _BCM, _BQC, _BCL methods but the slider is stuck at 100%.

 

Also, I've got the following message in my /var/log/kernel.log

 

kernel[0]: Acpi brightness levels:8, lowest brightness:7, highest brightness:100 
kernel[0]: We still don't have brightness entry in ioreg... waiting...

...
kernel[0]: We still don't have brightness entry in ioreg... waiting...

 

Here's my DSDT:

MyDSDT

 

Thanks

Share this post


Link to post
Share on other sites
Doesn't work. I've added a PNLF device with _BCM, _BQC, _BCL methods but the slider is stuck at 100%.

 

Also, I've got the following message in my /var/log/kernel.log

 

kernel[0]: Acpi brightness levels:8, lowest brightness:7, highest brightness:100 
kernel[0]: We still don't have brightness entry in ioreg... waiting...

...
kernel[0]: We still don't have brightness entry in ioreg... waiting...

 

Here's my DSDT:

MyDSDT

 

Thanks

 

Slider doesn't move or brightness doesn't change?

Share this post


Link to post
Share on other sites

Hi ivik,

where is this DSDT.aml from? I also have a Samsung R530 (-Nion, with Core i3 330M CPU) and I am wondering if I can use this too?

Greetings Jörg

Share this post


Link to post
Share on other sites

Thx ivik, great work!

 

How about without the "We still don't have brightness entry in ioreg... waiting..." Log Kext?

 

*For MSI Wind U100 its SBRG.EC.BRLV

Share this post


Link to post
Share on other sites
Thx ivik, great work!

 

How about without the "We still don't have brightness entry in ioreg... waiting..." Log Kext?

 

*For MSI Wind U100 its SBRG.EC.BRLV

 

I'll build it some time without this. Still testing it. :P

Do you have brightness keys mapped and onscreen "sun" image (with progress changing) when changing with keys?

 

Thnx for testing and reporting success.

Share this post


Link to post
Share on other sites
I'll build it some time without this. Still testing it. :P

Do you have brightness keys mapped and onscreen "sun" image (with progress changing) when changing with keys?

 

Thnx for testing and reporting success.

Nope, but I took Spark for that.

Share this post


Link to post
Share on other sites

Yeah... this is problem. OSX reads this brightness values from somewhere. I just monitor values from ioreg and then call acpi methods.

 

Maybe adding something to dsdt (_DSM in graphics section) would fix that...

Share this post


Link to post
Share on other sites

@Ivik

Thank for this stuff, My graphic card is intel x3100 ,I can use Fn key with up &down to adjust the brightness ,but no "sun" appears.Here is the logs :

Nov 12 22:24:00 Zproods-MacBook kernel[0]: IG: Invalid firmware max backlight setting
Nov 12 22:24:00 Zproods-MacBook kernel[0]: Acpi brightness levels:16, lowest brightness:20, highest brightness:100 
Nov 12 22:24:01 Zproods-MacBook kernel[0]: We still don't have brightness entry in ioreg... waiting...

And I manually add PNLF device in the dsdt file ,also add those code you mentioned above .

Here is my dsdt file :dsdt.dsl.zip

 

Thanks.

 

regards.

Share this post


Link to post
Share on other sites
Nope, but I took Spark for that.

 

Do your brightness keys emit scancodes? You could then map them to NX_KEYTYPE_BRIGHTNESS_UP/DOWN in VoodooPS2 and use native onscreen.

 

@Ivik

Thank for this stuff, My graphic card is intel x3100 ,I can use Fn key with up &down to adjust the brightness ,but no "sun" appears.Here is the logs :

Nov 12 22:24:00 Zproods-MacBook kernel[0]: IG: Invalid firmware max backlight setting
Nov 12 22:24:00 Zproods-MacBook kernel[0]: Acpi brightness levels:16, lowest brightness:20, highest brightness:100 
Nov 12 22:24:01 Zproods-MacBook kernel[0]: We still don't have brightness entry in ioreg... waiting...

And I manually add PNLF device in the dsdt file ,also add those code you mentioned above .

Here is my dsdt file :dsdt.dsl.zip

 

Thanks.

 

regards.

 

Do you have min/max brightness in ioreg? Slider works? On-screen appears if u have your brightness keys mapped in VoodooPS2. For me it also works with SCR LK (FN+12) for down and pause for up.

Share this post


Link to post
Share on other sites

Hi, thanks for this!

The normal behavior in my machine is: I can change the brightness up an down with F12 and scroll lock keys, I have the on-screen icon/bar, and the slider in the screen prefpane. I also have the AppleBacklightDisplay loaded under GFX0 in the IOReg. The problem is the brightness does not change smoothly (seems the values OSX sets for the display are not correct).
This is the section of the original DSDT that is in charge of brightness (I think) under (LCD) device:

Name (C1AF, Package (0x0D) /*backlight control of supported brightness levels*/
{
0x64,
0x33,
0x1E,
0x25,
0x2C,
0x33,
0x3A,
0x41,
0x48,
0x4F,
0x56,
0x5D,
0x64 /*set in AAPL01,BacklightIntensity for testing*/
})
Name (C1B0, 0x00)
Method (_BCL, 0, Serialized)
{
If (LAnd (LEqual (C1B0, 0x00), And (C06C, 0x10)))
{
Store (C06E, Local0)
Store (0x00, Local1)
While (LLess (Local1, 0x0B))
{
Store (DerefOf (Index (Local0, Local1)), Local2)
Multiply (Local2, 0x64, Local3)
Divide (Add (Local3, 0x7F), 0xFF, Local4, Local2)
Store (Local2, Index (C1AF, Add (Local1, 0x02)))
Increment (Local1)
}

Store (DerefOf (Index (C1AF, 0x05)), Index (C1AF, 0x01))
Store (Local2, Index (C1AF, 0x00))
Store (0x01, C1B0)
}

Return (C1AF)
}

Name (C1B1, 0x64)
Method (_BCM, 1, Serialized)
{
Store (0x00, Local0)
If (LGreater (\OSDW (), 0x05))
{
Or (C05B, 0x40, C05B)
Store (0x01, Local0)
}

Store (Arg0, C1B1)
Store (Match (C1AF, MGE, Arg0, MTR, 0x00, 0x02), Local1)
If (LEqual (Local1, Ones))
{
Subtract (SizeOf (C1AF), 0x01, Local1)
}

Subtract (Local1, 0x02, Local1)
If (Local0)
{
Store (Local1, C072)
If (LEqual (C169 (), 0x00))
{
\_SB.C1B2 (0xEA74, 0x04, Local1, 0x00, 0x00)
}

Signal (\_SB.C1AC)

}
}

Method (_BQC, 0, Serialized)
{
Store (C1B1, Local0)
Return (Local0)
}

I think (correct me if Im wrong) the register to write the brightness value is C1AF (within the EC device)
I've tried the kext and added the code under the PNLF device:
 
Device (PNLF)
{
Name (_HID, EisaId ("APP0002"))
Name (_CID, "backlight")
Name (_UID, 0x0A)
Name (_STA, 0x0B)

Method (BRGE, 1, Serialized)
{
Store (Arg0, ^^PCI0.LPCB.EC.C1AF)
Return (^^PCI0.LPCB.EC.C1AF)
}
Method(_BCL, 0x0, NotSerialized)
{
Return(Package(0x12)
{
0x64,
0x14,
0x14,
0x19,
0x1e,
0x23,
0x28,
0x2d,
0x32,
0x37,
0x3c,
0x41,
0x46,
0x4b,
0x50,
0x55,
0x5a,
0x64
})
}
Name(BCLP, Package(0x10)
{
0x14,
0x19,
0x1e,
0x23,
0x28,
0x2d,
0x32,
0x37,
0x3c,
0x41,
0x46,
0x4b,
0x50,
0x55,
0x5a,
0x64
})
Name(BCLL, Package(0x10)
{
0x0,
0x1,
0x2,
0x3,
0x4,
0x5,
0x6,
0x7,
0x8,
0x9,
0xa,
0xb,
0xc,
0xd,
0xe,
0xf
})
Method(_BCM, 0x1, NotSerialized)
{
Store(Match(BCLP, MEQ, Arg0, MTR, 0x0, 0x0), Local0)
If(LNot(LEqual(Local0, Ones)))
{
Store(DerefOf(Index(BCLL, Local0, )), \_SB_.PCI0.LPCB.EC_.C1AF)
}
}
Method(_BQC, 0x0, NotSerialized)
{
Store(\_SB_.PCI0.LPCB.EC_.C1AF, Local0)
If(LNot(LGreater(Local0, 0xf)))
{
Return(DerefOf(Index(BCLP, Local0, )))
}
Else
{
Return(Zero)
}
}
}

As you see I've replaced 'EC0.BRTS' with 'EC.C1AF' but I still get the same buggy brightness change.
I get this on boot:

11/12/10 4:04:46 PM kernel Acpi brightness levels:16, lowest brightness:20, highest brightness:100
11/12/10 4:04:46 PM kernel We still don't have brightness entry in ioreg... waiting...

And the io reg:
post-51637-1289576879_thumb.png

Share this post


Link to post
Share on other sites

It looks like this is right register in EC.

 

I see that you used my methods. The best way to find out which values are writed to this register is to use RW-everything under windows and watch it how it changes when u change brightness.

 

For me it is 0x0 for min and 0xF for max brightness.

 

What do you mean under buggy brightness change?

Brightnes from ioreg is readed once per sec, and if it changed ACPI methods are then called.

Share this post


Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.

Announcements

×