Contribute
Register

Native Brightness working without 'blinkscreen' using patched AppleBacklight.kext

Joined
Mar 26, 2015
Messages
7
Motherboard
HP Pavilion 15, OS X 10.10
CPU
Intel i5-4288U
Graphics
Intel HD 5100 Iris
Mac
Classic Mac
Mobile Phone
I've applied the native patch to my SSDT and AppleBacklight*.kexts are loading. However I have a question, Is the patched AppleBacklight.kext required?

I ask because I have not patched it, yet my screen brightness is changing (also with ACPI brightness buttons). So I'm wondering what the purpose of the patched AppleBacklight.kext is?

I have native CPU Management and AGPM is loading.

My laptop specs:
Make/Model - HP Pavilion 15-p199sa
Graphics - Intel Iris 5100 (ig-platform-id: 0x0a2e000a + InjectEDID both via CLOVER)
Processor: Haswell i5-4288U
RAM: 8GB
OSX: Yosemite 10.10 - Clean install

EDIT: It seems the levels are enabled after waking from sleep and are not available after initial login. I will try the patch AppleBacklight.kext and report back.
 
Last edited:

RehabMan

Moderator
Joined
May 3, 2012
Messages
188,974
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
I've applied the native patch to my SSDT and AppleBacklight*.kexts are loading. However I have a question, Is the patched AppleBacklight.kext required?

I ask because I have not patched it, yet my screen brightness is changing (also with ACPI brightness buttons). So I'm wondering what the purpose of the patched AppleBacklight.kext is?

I have native CPU Management and AGPM is loading.

My laptop specs:
Make/Model - HP Pavilion 15-p199sa
Graphics - Intel Iris 5100 (ig-platform-id: 0x0a2e000a + InjectEDID both via CLOVER)
Processor: Haswell i5-4288U
RAM: 8GB
OSX: Yosemite 10.10 - Clean install

EDIT: It seems the levels are enabled after waking from sleep and are not available after initial login. I will try the patch AppleBacklight.kext and report back.
Patched AppleBacklight.kext is not needed, preferred method is a backlight injector kext. It is created by the script.

You will not get the full range of brightness using un-patched AppleBacklight.kext (without injector).

But the best method is to use ACPIBacklight.kext.

There is a guide: http://www.tonymacx86.com/yosemite-...ching-dsdt-ssdt-laptop-backlight-control.html
 
Joined
Mar 26, 2015
Messages
7
Motherboard
HP Pavilion 15, OS X 10.10
CPU
Intel i5-4288U
Graphics
Intel HD 5100 Iris
Mac
Classic Mac
Mobile Phone
Patched AppleBacklight.kext is not needed, preferred method is a backlight injector kext. It is created by the script.

You will not get the full range of brightness using un-patched AppleBacklight.kext (without injector).

But the best method is to use ACPIBacklight.kext.

There is a guide: http://www.tonymacx86.com/yosemite-...ching-dsdt-ssdt-laptop-backlight-control.html
I've implemented the ACPI Backlight, i tried this method because it made my boot time increase by some 30-40 seconds.

Also I believe CLOVER r3259 shutdown NVRAM is not working correctly so ACPIBacklight level is never saved when shutdown. I have tested NVRAM by setting my own variable 'MyVar=TestForNVRAM' and its persistent after a reboot/shutdown.

I tested the patched/injector AppleBacklight.kext and the brightness range was less than an un-patched AppleBacklight.kext. With an un-patched AppleBacklight.kext I am getting, what seems to be identical, brightness range as my earlier ACPIBacklight implementation.

With the brightness with the native fix and un-patched AppleBacklight.kext, the brightness levels are persistent after reboot/shutdown/sleep.
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
188,974
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
I've implemented the ACPI Backlight, i tried this method because it made my boot time increase by some 30-40 seconds.
ACPIBacklight.kext will not increase boot time. Your boot problems are something else (perhaps your patched ACPI files not in sync with native files).

Also I believe CLOVER r3259 shutdown NVRAM is not working correctly so ACPIBacklight level is never saved when shutdown. I have tested NVRAM by setting my own variable 'MyVar=TestForNVRAM' and its persistent after a reboot/shutdown.
If you're using EmuVariable, you need to install "RC scripts" to the boot volume. You can also go without EmuVariable to use native UEFI NVRAM.

I tested the patched/injector AppleBacklight.kext and the brightness range was less than an un-patched AppleBacklight.kext. With an unmatched AppleBacklight.kext I am getting, what seems to be identical, brightness range as my earlier ACPIBacklight implementation.
You probably did something wrong... Keep in mind guide in post #1 is for HD3000/HD4000. Haswell requires different data.

Download patchmatic: https://bitbucket.org/RehabMan/os-x-maciasl-patchmatic/downloads/RehabMan-patchmatic-2015-0107.zip
Extract the 'patchmatic' binary from the ZIP. Copy it to /usr/bin, such that you have the binary at /usr/bin/patchmatic.

In terminal,
Code:
if [ -d ~/Downloads/RehabMan ]; then rm -R ~/Downloads/RehabMan; fi
mkdir ~/Downloads/RehabMan
cd ~/Downloads/RehabMan
patchmatic -extract
Note: It is easier if you use copy/paste instead of typing the commands manually.

Post contents of Downloads/RehabMan directory (as ZIP).

Also, post ioreg: http://www.tonymacx86.com/audio/58368-guide-how-make-copy-ioreg.html. Please, use the IORegistryExplorer v2.1 attached to the post! DO NOT reply with an ioreg from any other version of IORegistryExplorer.app.
 
Joined
Mar 26, 2015
Messages
7
Motherboard
HP Pavilion 15, OS X 10.10
CPU
Intel i5-4288U
Graphics
Intel HD 5100 Iris
Mac
Classic Mac
Mobile Phone
ACPIBacklight.kext will not increase boot time. Your boot problems are something else (perhaps your patched ACPI files not in sync with native files).
Maybe you're right I will check my SortedOrder and reimplement ACPIBacklight to see what happens.
If you're using EmuVariable, you need to install "RC scripts" to the boot volume. You can also go without EmuVariable to use native UEFI NVRAM.
I have native UEFI NVRAM but I also tried with EmuVariable and still the same results. Following Pokenguyen's guide I installed RC Scripts. All was working fine with the NVRAM being saved (older version of CLOVER) before I updated my CLOVER version.
You probably did something wrong... Keep in mind guide in post #1 is for HD3000/HD4000. Haswell requires different data.Download patchmatic: https://bitbucket.org/RehabMan/os-x-maciasl-patchmatic/downloads/RehabMan-patchmatic-2015-0107.zipExtract the 'patchmatic' binary from the ZIP. Copy it to /usr/bin, such that you have the binary at /usr/bin/patchmatic.In terminal,
Code:
if [ -d ~/Downloads/RehabMan ]; then rm -R ~/Downloads/RehabMan; fimkdir ~/Downloads/RehabMancd ~/Downloads/RehabManpatchmatic -extract
Note: It is easier if you use copy/paste instead of typing the commands manually.Post contents of Downloads/RehabMan directory (as ZIP).
Please see attached.
Also, post ioreg: http://www.tonymacx86.com/audio/58368-guide-how-make-copy-ioreg.html. Please, use the IORegistryExplorer v2.1 attached to the post! DO NOT reply with an ioreg from any other version of IORegistryExplorer.app.
Please see attached.

View attachment Patchmatic Results.zip
View attachment TashDev MacBook Pro.ioreg
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
188,974
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Maybe you're right I will check my SortedOrder and reimplement ACPIBacklight to see what happens.
Not only SortedOrder, but also that your files are patched from a recent native extract. Any BIOS change, BIOS update, hardware change can cause the native ACPI files to change... hence, re-extract/re-patch required.

I have native UEFI NVRAM but I also tried with EmuVariable and still the same results. Following Pokenguyen's guide I installed RC Scripts. All was working fine with the NVRAM being saved (older version of CLOVER) before I updated my CLOVER version.
No problem with latest Clover here. I'm using v3262 built from source.

Your problem may stem from using OsxAptioFix2Drv-64.efi instead of OsxAptioFixDrv-64.efi.

Please see attached.Please see attached.
Wrong PNLF patch for using ACPIBacklight.kext (Note: correct patch can be used both for AppleBacklight and ACPIBacklight as it is a superset).

And no injector for using AppleBacklight.kext.

For a while, ACPIBacklight.kext was not working in 10.11. I published some information for using AppleBacklight.kext (with injector) including the proper data for Haswell. See here: http://www.tonymacx86.com/el-capitan-laptop-support/167963-backlight-control.html

But ACPIBacklight.kext (with correct DSDT patch) is the recommended method.
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
188,974
Motherboard
Intel DH67BL
CPU
i7-2600K
Graphics
HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Thank you very much, I've reapplied the PNLF patch for Sandy Bridge and it worked now fine for both Mavericks and El Capitan. Seems there have been some changes to the patch :)
I need to use ACPIBacklight though (nearly obvious). And currently the AppleBacklightInjector is installed together without any problems. Should I remove it?
Please note I'm going to be making some changes to this patch that will probably impact you...

This setting of PCHL has been shown to cause a problem when you boot with the lid closed. Details here: https://github.com/RehabMan/OS-X-ACPI-Backlight/issues/8

Diffs to the patch coming:
Code:
Speedy-OSX:laptop.git RehabMan$ git diff
diff --git a/graphics/graphics_PNLF_ivy_sandy.txt b/graphics/graphics_PNLF_ivy_sandy.txt
index 523910b..cd56a62 100644
--- a/graphics/graphics_PNLF_ivy_sandy.txt
+++ b/graphics/graphics_PNLF_ivy_sandy.txt
@@ -65,12 +65,15 @@ Device (PNLF)\n
     // KMAX: defines the unscaled range in the _BCL table below\n
     Name (KMAX, 0x710)\n
     // KPCH: saved value for PCHL\n
-    Name(KPCH, 0)\n
+    //   use Ones if PCHL does not need to be set (normal)\n
+    //   use Zero if your laptop nees PCHL set on every brightness set\n
+    //   you can also use a custom value (not Ones, not Zero)\n
+    Name(KPCH, Ones)\n
     // _INI deals with differences between native setting and desired\n
     Method (_INI, 0, NotSerialized)\n
     {\n
         // save value of PCHL for later\n
-        Store(PCHL, KPCH)\n
+        If (LNot(KPCH)) { Store(PCHL, KPCH) }\n
         // determine LMAX to use\n
         If (LNot(LMAX)) { Store(ShiftRight(LEVX,16), LMAX) }\n
         If (LNot(LMAX)) { Store(KMAX, LMAX) }\n
@@ -110,7 +113,7 @@ Device (PNLF)\n
     Method (_BCM, 1, NotSerialized)\n
     {\n
         // initialize for consistent backlight level before/after sleep\n
-        If (LNotEqual(PCHL, KPCH)) { Store(KPCH, PCHL) }\n
+        If (LAnd(LNotEqual(KPCH, Ones),LNotEqual(PCHL, KPCH))) { Store(KPCH, PCHL) }\n
         If (LNotEqual(LEVW, 0x80000000)) { Store (0x80000000, LEVW) }\n
         If (LNotEqual(LEVX, KLVX)) { Store (KLVX, LEVX) }\n
         // store new backlight level\n
@@ -136,7 +139,7 @@ Device (PNLF)\n
     Method (XBCM, 1, NotSerialized)\n
     {\n
         // initialize for consistent backlight level before/after sleep\n
-        If (LNotEqual(PCHL, KPCH)) { Store(KPCH, PCHL) }\n
+        If (LAnd(LNotEqual(KPCH, Ones),LNotEqual(PCHL, KPCH))) { Store(KPCH, PCHL) }\n
         If (LNotEqual(LEVW, 0x80000000)) { Store (0x80000000, LEVW) }\n
         If (LNotEqual(LEVX, KLVX)) { Store (KLVX, LEVX) }\n
         // store new backlight level\n
So, by default KPCH will be Ones (-1), and so will not write on every _BCM/XBCM call. The same is already implemented in the IntelBacklightHandler.

You can set it to Zero and it will revert to the old behavior.

Advanced users can also set KPCH to a fixed value (other than -1), and _BCM/XBCM (and IntelBacklightHandler) will write it on each brightness set. Requires using ACPIDebug to determine the normal value. Using this technique will help someone with both issues fix them.
 
Joined
Nov 17, 2010
Messages
62
Motherboard
Pavilion 17 e040us
CPU
Intel Core i3-4000M
Graphics
Intel HD Graphics 4600 1536 MB
Is this still working for el capitan. Thank you and have a nice day :)
I've been doing some research on Haswell Intel graphics/backlight and I ran across a couple of things:

- information on AppleBacklight.kext: http://www.insanelymac.com/forum/to...ple-and-i-dont-need-genericbrightness-at-all/

AND

- some documentation on Intel graphics registers: https://01.org/linuxgraphics/documentation/driver-documentation-prms

Based on what we know from this thread, http://www.tonymacx86.com/hp-probook-mavericks/118805-full-range-brightness-using-acpibacklight.html, I decided to see if I could get brightness working correctly with the native kext.

The result is some new patches at my patch repo for the ProBook: https://github.com/RehabMan/HP-ProBook-4x30s-DSDT-Patch and a patch script for AppleBacklight.kext (attached).

To test/use...

Patch your DSDT:
- Apply "Native backlight fix" from the ProBook repo to your DSDT (https://github.com/RehabMan/HP-ProBook-4x30s-DSDT-Patch, this MaciASL repo added to Sources: http://github.com/RehabMan/HP-ProBook-4x30s-DSDT-Patch/raw/master)

Remove blinkscreen:
- sudo rm /Library/LaunchAgents/org.rehabman.blinkscreen.plist

Reboot.
Create patched AppleBacklight and AppleBacklightInjector:
- unzip the PatchAppleBacklight.zip into a directory.
- make a subdirectory there called 'vanilla'
- copy unpatched AppleBacklight.kext to the 'vanilla' directory
- run the script, ./patch.sh
Code:
# for example, in Terminal
cd ~/Downloads/PatchAppleBacklight
./patch.sh
- it will create a patched/AppleBacklight.kext which contains the correct data for your display

Install the resulting AppleBacklight.kext (or AppleBacklightInjector.kext) using Kext Wizard. Remove ACPIBacklight.kext if you were using that previously. Repair permissions (because my script is lazy), rebuild cache.

Reboot and test. Provide feedback here.

Note: There is no gradual transitions with this technique. I don't know the secret to enable it yet.

Note: The sub-levels below the lowest level do not work. Just like my MacBookAir6,2... so this is Apple's bug.

Note: Even though the plist file is 4x40s_Backlight.plist pay no attention. The 4530s uses the same data with this technique (because we are adopting OS X range 0-0x710)

Note: This is likely applicable to any laptop with HD3000 or HD4000.

Update

Uploaded PatchAppleBacklight_v2.zip. This version has kpkp's modified data and the script creates both a patched kext and an 'injector' kext. The AppleBacklightInjector.kext can be installed alongside vanilla AppleBacklight.kext. The injector is more update-proof. Please provide feedback on whether the injector causes any other issues/errors/warnings/logs...
 
Joined
Apr 21, 2016
Messages
1,349
Motherboard
ASUS X556UA-Clover
CPU
i5-6200U
Graphics
HD 520,1366x768
Mobile Phone
iOS
Hi @RehabMan
It seems that to make brightness control work (with preferences slider and keys) is to use an AppleBacklight.kext injector (or patching the kext itself)

How can I edit the 4x40s plist to make it fit my display and newer hardware (like skylake)?
Is the only thing I should do is edit the plist file and create an injector, or I also need an ACPI patch (or another SSDT)?

Thank you!
 
Top