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
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
191,415
Motherboard
Intel DH67BL
CPU
Core i7-2600K
Graphics
Intel 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
191,415
Motherboard
Intel DH67BL
CPU
Core i7-2600K
Graphics
Intel 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
56
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/topic/293500-i-found-the-brightnesss-working-principle-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,051
Motherboard
ASUS X556UA (Clover)
CPU
i5-6200U
Graphics
Intel HD 520, 15.6" 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!
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
191,415
Motherboard
Intel DH67BL
CPU
Core i7-2600K
Graphics
Intel HD 3000
Mac
MacBook Air
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!
The PWMMax value is determined by the data associated with your ig-platform-id. Look in the kext binary for these values.
Once you determine the PWMMax value, you can look for "example" data in native AppleBacklight Info.plist.
That will also help you configure SSDT-PNLF.dsl and SSDT-Config.dsl to set PWMMax correctly at boot (see my ACPI hotpatch guide/repo).
 
Joined
Jun 20, 2015
Messages
11
Motherboard
Lenovo ThinkPad X220
CPU
i5
Graphics
HD 3000
Mobile Phone
iOS
Hi @RehabMan

I use this patch with my ThinkPad. It works great under MacOS Sierra. My only problem is that it won't use the maximum brightness my laptop could produce. Could you tell me which file and how should I modify in this patch in order to increase the max brightness value?

Thanks!

edit: typo
 

Feartech

Moderator
Joined
Aug 3, 2013
Messages
8,497
Motherboard
Asus N752VX-Clover
CPU
i7-6700HQ / HM170
Graphics
HD530 + GTX 950m 1920 x 1080
Mac
iMac
Mobile Phone
iOS
Hi @RehabMan

I use this patch with my ThinkPad. It works great under MacOS Sierra. My only problem is that it won't use the maximum brightness my laptop could produce. Could you tell me which file and how should I modify in this patch in order to increase the max brightness value?

Thanks!

edit: typo
As per rules, please update your hardware profile to allow others to help you easier
https://www.tonymacx86.com/account/

please read the faq for proper hardware profile setup:
https://www.tonymacx86.com/threads/faq-read-first-laptop-frequent-questions.164990/
 

RehabMan

Moderator
Joined
May 3, 2012
Messages
191,415
Motherboard
Intel DH67BL
CPU
Core i7-2600K
Graphics
Intel HD 3000
Mac
MacBook Air
Mobile Phone
iOS
Top