四叶草Clover引导提取DSDT/SSDT以及DSDT注入亮度补丁-实现笔记本电脑的亮度调节滑动条

之前我也出过笔记本电脑亮度调节教程,就是这个两步实现笔记本电脑屏幕亮度调节方法但是部分的朋友按照操作后还是无法调节亮度,应群友的要求。本次给大家补充一下DSDT注入的方式去调节亮度,顺便提一下通过Clover提取DSDT/SSDT,之前在讲解通过Windows提取dsdt与ssdt修复电池电量,《笔记本电脑电池显示》很多人提取后,不知道是操作原因,还是什么问题,无法反编译,可以考虑通过Clover提取DSDT/SSDT在试一下。下面就开始吧。

所需软件下载

MaciASL.app

下载地址: https://pan.baidu.com/s/1nZCJlNiMUofTiaEyNtZkpA

提取件码:h2q1

iasl

下载地址: https://pan.baidu.com/s/1ww9lLXcu06VrY3ZJ56Wfnw

提取件码:wi71

本教程有视频教程请移步

Clover提取DSDT/SSDT

在四叶草Clover引导界面按F4(部分电脑需要按fn+F4),按完之后不会有任何的提示,如果硬盘慢的话会出现短暂的卡死状态,如果好点的硬盘是感觉不出来的,之后直接进入苹果系统,打开EFI引导分区,路径为:EFI/CLOVER/ACPI/origin.提取的dsdt与ssdt都在里面!把ssdt改名称为SSDT.aml、SSDT-1.aml、SSDT-2.aml……

反编译除错

1.桌面新建一个acpi文件,把DSDT/SSDT拷贝进去。

2.新建“访达”窗口——前往——前往文件夹——/usr/bin/,把iasl编译器拷贝进去

3.反编译,打开终端输入:cd Desktop/acpi回车

再输入iasl -da -dl *.aml回车

反编译成功得到文件的dsl文件

4.用MaciASL.app打开DSDT.aml,编译时注意用5.0以上编译器编译!

5.DSDT.aml打开后第一件事情不是直接修改,而是排除错误

6.点击编译,红色的是错误,要把它排除,黄色的是警告,警告请忽略!

我的DSDT打开后有两个错误(每个人的可能错误不一样,其他的自己百度找解决方案吧!如果有编程功底,这个除错应该不是难事情)

错误一 syntax error, unexpected PARSEOP_INTEGER

错误解决方案

找到错误上方 0x1F,在0x1F前面//注释就好

注释前0x1F

注释后// 0x1F

错误二syntax error, unexpected PARSEOP_ARG0

错误解决方案

找到错误行上方如下代码并注释

注释前

Arg0

Arg1

Arg2

Arg3

注释后如下

/*Arg0

Arg1

Arg2

Arg3*/

注入亮度补丁

我这里提供了4个补丁,大家可以按照你的机型配置去选择补丁,使用其中一个就好,如果你都不知道怎么选择,那就一个一个的试试吧,反正就4个也不多。其实这4个补丁都来源于一个叫“RehabMan Laptop”的补丁源。链接是http://raw.github.com/RehabMan/Laptop-DSDT-Patch/master,在这里我还是把它提取出来放了,因为怕你们打不开!你也可以直接把这个链接添加到补丁源里面!如下图

那下面我们就开始打补丁吧!

除错完成后,按照如图所示打补丁就好,打好之后点击close关闭,保存为DSDT.aml文件放到EFI/CLOVER/ACPI/patched。重新启动就好。

《补丁源》

___________________________________________________

【igpu】Brightness fix(亮度调节补丁)

#Maintained by: RehabMan for: Laptop Patches

#graphics_PNLF.txt

# This patch enables the brightness slider in SysPrefs->Displays

# and will also enable activation of sleep mode by closing

# the laptop lid.

# This patch is a "basic" PNLF patch and doesn't attempt

# to fix various common problems with the backlight control.

#

# For advanced patches, see:

# graphics_PNLF_ivy_sandy.txt

# graphics_PNLF_haswell.txt

#

into_all device label PNLF remove_entry;

into definitionblock code_regex . insert

begin

Scope (_SB)\n

{\n

Device (PNLF)\n

{\n

Name (_ADR, Zero)\n

Name (_HID, EisaId ("APP0002"))\n

Name (_CID, "backlight")\n

Name (_UID, 10)\n

Name (_STA, 0x0B)\n

}\n

}\n

end;

# to avoid conflict with root scope PNLF

into_all method code_regex Store\s+\(PNLF,\s+(.*)\) replaceall_matched begin Store(\\PNLF, %1) end;

___________________________________________________

【igpu】Brightness fix(ACPI 100)(亮度调节补丁)

#Maintained by: RehabMan for: Laptop Patches

#graphics_PNLF-ACPI100.txt

# This patch enables the brightness slider in SysPrefs->Displays

# and will also enable activation of sleep mode by closing

# the laptop lid.

#

# This patch works well for laptops that have working

# ACPI methods with 64-or more levels (100 is common)

# for good support for Windows 2012 (Windows 8)

#

# Based on information from the normal laptop DSDT methods,

# optimized for use with ACPIBacklight.kext

#

# Note: This patch should be applied to the DSDT or SSDT that defines

# your integrated graphics device (always at _ADR 0x00020000)

# applied to one of the SSDTs, not DSDT.

#

# Note: Intended to be used with Windows 2012, so this should be done...

# if you previously patched for Windows 2006, undo that patch!

# sometimes in Scope (_SB.PCI0)

into method label _INI parent_label _SB.PCI0 code_regex If\s+\(_OSI\s+\(\"Windows\s2012\"\)\) replace_matched

begin If(LOr(_OSI("Darwin"),_OSI("Windows 2012"))) end;

# sometimes in Scope (_SB)

into method label _INI parent_label _SB code_regex If\s+\(_OSI\s+\(\"Windows\s2012\"\)\) replace_matched

begin If(LOr(_OSI("Darwin"),_OSI("Windows 2012"))) end;

into_all device label PNLF remove_entry;

into device name_adr 0x00020000 insert

begin

Device (PNLF)\n

{\n

// normal PNLF declares (note some of this probably not necessary)\n

Name (_ADR, Zero)\n

Name (_HID, EisaId ("APP0002"))\n

Name (_CID, "backlight")\n

Name (_UID, 10)\n

Name (_STA, 0x0B)\n

// _BCM/_BQC: set/get for brightness level\n

Method (_BCM, 1, NotSerialized)\n

{\n

// Update backlight via existing DSDT methods\n

^^DD02._BCM(Arg0)\n

}\n

Method (_BQC, 0, NotSerialized)\n

{\n

Return(^^DD02._BQC())\n

}\n

Method (_BCL, 0, NotSerialized)\n

{\n

Return(^^DD02._BCL())\n

}\n

Method (_DOS, 1, NotSerialized)\n

{\n

^^_DOS(Arg0)\n

}\n

// extended _BCM/_BQC for setting "in between" levels\n

Method (XBCM, 1, NotSerialized)\n

{\n

// Update backlight via existing DSDT methods\n

^^DD02._BCM(Arg0)\n

}\n

Method (XBQC, 0, NotSerialized)\n

{\n

Return(^^DD02._BQC())\n

}\n

// Use XOPT=1 to disable smooth transitions\n

Name (XOPT, Zero)\n

// XRGL/XRGH: defines the valid range\n

Method (XRGL, 0, NotSerialized)\n

{\n

Store(_BCL(), Local0)\n

Store(DerefOf(Index(Local0, 2)), Local0)\n

Return(Local0)\n

}\n

Method (XRGH, 0, NotSerialized)\n

{\n

Store(_BCL(), Local0)\n

Store(DerefOf(Index(Local0, Subtract(SizeOf(Local0), 1))), Local0)\n

Return(Local0)\n

}\n

}\n

end;

___________________________________________________

【igpu】Brightness fix(Haswell/Broadwell)(亮度调节补丁)

#Maintained by: RehabMan for: Laptop Patches

#graphics_PNLF_haswell.txt

# This patch enables the brightness slider in SysPrefs->Displays

# and will also enable activation of sleep mode by closing

# the laptop lid.

#

# This particular version is intended to be used with ACPIBacklight.kext

# although it can also be used with AppleBacklight.kext,

# provided AppleBacklight.kext is patched to recognize your

# display or an injector is used to set brightness levels.

#

# See this thread for more information:

# http://www.tonymacx86.com/hp-probook-mavericks/121031-native-brightness-working-without-blinkscreen-using-patched-applebacklight-kext.html

# (also read any linked threads)

#

# Note: This patch should be applied to the DSDT or SSDT that defines

# your integrated graphics device (always at _ADR 0x00020000)

#

# This patch works for both Haswell and Broadwell graphics

#

into_all device label PNLF remove_entry;

into_all device name_adr 0x00020000 code_regex (OperationRegion\s\(RMPC,\sPCI_Config[^\}]*\}) remove_matched;

into device name_adr 0x00020000 insert

begin

OperationRegion (RMPC, PCI_Config, 0x10, 4)\n

Field (RMPC, AnyAcc, NoLock, Preserve)\n

{\n

BAR1,32,\n

}\n

Device (PNLF)\n

{\n

// normal PNLF declares (note some of this probably not necessary)\n

Name (_ADR, Zero)\n

Name (_HID, EisaId ("APP0002"))\n

Name (_CID, "backlight")\n

Name (_UID, 15)\n

Name (_STA, 0x0B)\n

//define hardware register access for brightness\n

// lower nibble of BAR1 is status bits and not part of the address\n

OperationRegion (BRIT, SystemMemory, And(^BAR1, Not(0xF)), 0xe1184)\n

Field (BRIT, AnyAcc, Lock, Preserve)\n

{\n

Offset(0x48250),\n

LEV2, 32,\n

LEVL, 32,\n

Offset(0x70040),\n

P0BL, 32,\n

Offset(0xc8250),\n

LEVW, 32,\n

LEVX, 32,\n

Offset(0xe1180),\n

PCHL, 32,\n

}\n

// LMAX: use 0xad9/0x56c/0x5db to force OS X value\n

// or use any arbitrary value\n

// or use 0 to capture BISO setting\n

Name (LMAX, 0xad9)\n

// KMAX: defines the unscaled range in the _BCL table below\n

Name (KMAX, 0xad9)\n

// _INI deals with differences between native setting and desired\n

Method (_INI, 0, NotSerialized)\n

{\n

// This 0xC value comes from looking what OS X initializes this\n

// register to after display sleep (using ACPIDebug/ACPIPoller)\n

Store(0xC0000000, LEVW)\n

// determine LMAX to use\n

If (LNot(LMAX)) { Store(ShiftRight(LEVX,16), LMAX) }\n

If (LNot(LMAX)) { Store(KMAX, LMAX) }\n

If (LNotEqual(LMAX, KMAX))\n

{\n

// Scale all the values in _BCL to the PWM max in use\n

Store(0, Local0)\n

While (LLess(Local0, SizeOf(_BCL)))\n

{\n

Store(DerefOf(Index(_BCL,Local0)), Local1)\n

Divide(Multiply(Local1,LMAX), KMAX,, Local1)\n

Store(Local1, Index(_BCL,Local0))\n

Increment(Local0)\n

}\n

// Also scale XRGL and XRGH values\n

Divide(Multiply(XRGL,LMAX), KMAX,, XRGL)\n

Divide(Multiply(XRGH,LMAX), KMAX,, XRGH)\n

}\n

// adjust values to desired LMAX\n

Store(ShiftRight(LEVX,16), Local1)\n

If (LNotEqual(Local1, LMAX))\n

{\n

Store(And(LEVX,0xFFFF), Local0)\n

If (LOr(LNot(Local0),LNot(Local1))) { Store(LMAX, Local0) Store(LMAX, Local1) }\n

Divide(Multiply(Local0,LMAX), Local1,, Local0)\n

//REVIEW: wait for vblank before setting new PWM config\n

//Store(P0BL, Local7)\n

//While (LEqual (P0BL, Local7)) {}\n

Store(Or(Local0,ShiftLeft(LMAX,16)), LEVX)\n

}\n

}\n

// _BCM/_BQC: set/get for brightness level\n

Method (_BCM, 1, NotSerialized)\n

{\n

// store new backlight level\n

Store(Match(_BCL, MGE, Arg0, MTR, 0, 2), Local0)\n

If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }\n

Store(Or(DerefOf(Index(_BCL,Local0)),ShiftLeft(LMAX,16)), LEVX)\n

}\n

Method (_BQC, 0, NotSerialized)\n

{\n

Store(Match(_BCL, MGE, And(LEVX, 0xFFFF), MTR, 0, 2), Local0)\n

If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }\n

Return(DerefOf(Index(_BCL, Local0)))\n

}\n

Method (_DOS, 1, NotSerialized)\n

{\n

// Note: Some systems have this defined in DSDT, so uncomment\n

// the next line if that is the case.\n

//External(^^_DOS, MethodObj)\n

^^_DOS(Arg0)\n

}\n

// extended _BCM/_BQC for setting "in between" levels\n

Method (XBCM, 1, NotSerialized)\n

{\n

// store new backlight level\n

If (LGreater(Arg0, XRGH)) { Store(XRGH, Arg0) }\n

If (LAnd(Arg0, LLess(Arg0, XRGL))) { Store(XRGL, Arg0) }\n

Store(Or(Arg0,ShiftLeft(LMAX,16)), LEVX)\n

}\n

Method (XBQC, 0, NotSerialized)\n

{\n

Store(And(LEVX,0xFFFF), Local0)\n

If (LGreater(Local0, XRGH)) { Store(XRGH, Local0) }\n

If (LAnd(Local0, LLess(Local0, XRGL))) { Store(XRGL, Local0) }\n

Return(Local0)\n

}\n

// Set XOPT bit 0 to disable smooth transitions\n

// Set XOPT bit 1 to wait for native BacklightHandler\n

// Set XOPT bit 2 to force use of native BacklightHandler\n

Name (XOPT, 0x02)\n

// XRGL/XRGH: defines the valid range\n

Name (XRGL, 25)\n

Name (XRGH, 2777)\n

// _BCL: returns list of valid brightness levels\n

// first two entries describe ac/battery power levels\n

Name (_BCL, Package()\n

{\n

2777,\n

748,\n

0,\n

35, 39, 44, 50,\n

58, 67, 77, 88,\n

101, 115, 130, 147,\n

165, 184, 204, 226,\n

249, 273, 299, 326,\n

354, 383, 414, 446,\n

479, 514, 549, 587,\n

625, 665, 706, 748,\n

791, 836, 882, 930,\n

978, 1028, 1079, 1132,\n

1186, 1241, 1297, 1355,\n

1414, 1474, 1535, 1598,\n

1662, 1728, 1794, 1862,\n

1931, 2002, 2074, 2147,\n

2221, 2296, 2373, 2452,\n

2531, 2612, 2694, 2777,\n

})\n

}\n

end;

___________________________________________________

【igpu】Brightness fix(HD3000/HD4000)(亮度调节补丁)

#Maintained by: RehabMan for: Laptop Patches

#graphics_PNLF_ivy_sandy.txt

# This patch enables the brightness slider in SysPrefs->Displays

# and will also enable activation of sleep mode by closing

# the laptop lid.

#

# This particular version is intended to be used with ACPIBacklight.kext

# although it can also be used with AppleBacklight.kext,

# provided AppleBacklight.kext is patched to recognize your

# display or an injector is used to set brightness levels.

#

# See this thread for more information:

# http://www.tonymacx86.com/hp-probook-mavericks/121031-native-brightness-working-without-blinkscreen-using-patched-applebacklight-kext.html

# (also read any linked threads)

#

# Note: This patch should be applied to the DSDT or SSDT that defines

# your integrated graphics device (always at _ADR 0x00020000)

#

# This patch works for both Sandy Bridge and Ivy Bridge graphics.

# also reported to work with graphics prior to Sandy Bridge (eg. Arrandale)

#

into_all device label PNLF remove_entry;

into_all device name_adr 0x00020000 code_regex (OperationRegion\s\(RMPC,\sPCI_Config[^\}]*\}) remove_matched;

into device name_adr 0x00020000 insert

begin

OperationRegion (RMPC, PCI_Config, 0x10, 4)\n

Field (RMPC, AnyAcc, NoLock, Preserve)\n

{\n

BAR1,32,\n

}\n

Device (PNLF)\n

{\n

// normal PNLF declares (note some of this probably not necessary)\n

Name (_ADR, Zero)\n

Name (_HID, EisaId ("APP0002"))\n

Name (_CID, "backlight")\n

Name (_UID, 10)\n

Name (_STA, 0x0B)\n

//define hardware register access for brightness\n

// lower nibble of BAR1 is status bits and not part of the address\n

OperationRegion (BRIT, SystemMemory, And(^BAR1, Not(0xF)), 0xe1184)\n

Field (BRIT, AnyAcc, Lock, Preserve)\n

{\n

Offset(0x48250),\n

LEV2, 32,\n

LEVL, 32,\n

Offset(0x70040),\n

P0BL, 32,\n

Offset(0xc8250),\n

LEVW, 32,\n

LEVX, 32,\n

Offset(0xe1180),\n

PCHL, 32,\n

}\n

// DEB1 special for setting KLVX at runtime...\n

//Method (DEB1, 1, NotSerialized)\n

//{\n

// Store(Arg0, KLVX)\n

//}\n

// LMAX: use 0x710 to force OS X value\n

// or use any arbitrary value\n

// or use 0 to capture BISO setting\n

Name (LMAX, 0x710)\n

// KMAX: defines the unscaled range in the _BCL table below\n

Name (KMAX, 0x710)\n

// KPCH: saved value for PCHL\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

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

Store(ShiftLeft(LMAX,16), KLVX)\n

If (LNotEqual(LMAX, KMAX))\n

{\n

// Scale all the values in _BCL to the PWM max in use\n

Store(0, Local0)\n

While (LLess(Local0, SizeOf(_BCL)))\n

{\n

Store(DerefOf(Index(_BCL,Local0)), Local1)\n

Divide(Multiply(Local1,LMAX), KMAX,, Local1)\n

Store(Local1, Index(_BCL,Local0))\n

Increment(Local0)\n

}\n

// Also scale XRGL and XRGH values\n

Divide(Multiply(XRGL,LMAX), KMAX,, XRGL)\n

Divide(Multiply(XRGH,LMAX), KMAX,, XRGH)\n

}\n

// adjust values to desired LMAX\n

Store(ShiftRight(LEVX,16), Local1)\n

If (LNotEqual(Local1, LMAX))\n

{\n

Store(LEVL, Local0)\n

If (LOr(LNot(Local0),LNot(Local1))) { Store(LMAX, Local0) Store(LMAX, Local1) }\n

Divide(Multiply(Local0,LMAX), Local1,, Local0)\n

//REVIEW: wait for vblank before setting new PWM config\n

//Store(P0BL, Local7)\n

//While (LEqual (P0BL, Local7)) {}\n

If (LGreater(LEVL, LMAX))\n

{ Store(KLVX, LEVX) Store(Local0, LEVL) }\n

Else\n

{ Store(Local0, LEVL) Store(KLVX, LEVX) }\n

}\n

}\n

// _BCM/_BQC: set/get for brightness level\n

Method (_BCM, 1, NotSerialized)\n

{\n

// initialize for consistent backlight level before/after sleep\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

Store(Match(_BCL, MGE, Arg0, MTR, 0, 2), Local0)\n

If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }\n

If (LNotEqual(LEV2, 0x80000000)) { Store(0x80000000, LEV2) }\n

Store(DerefOf(Index(_BCL, Local0)), LEVL)\n

}\n

Method (_BQC, 0, NotSerialized)\n

{\n

Store(Match(_BCL, MGE, LEVL, MTR, 0, 2), Local0)\n

If (LEqual(Local0, Ones)) { Subtract(SizeOf(_BCL), 1, Local0) }\n

Return(DerefOf(Index(_BCL, Local0)))\n

}\n

Method (_DOS, 1, NotSerialized)\n

{\n

// Note: Some systems have this defined in DSDT, so uncomment\n

// the next line if that is the case.\n

//External(^^_DOS, MethodObj)\n

^^_DOS(Arg0)\n

}\n

// extended _BCM/_BQC for setting "in between" levels\n

Method (XBCM, 1, NotSerialized)\n

{\n

// initialize for consistent backlight level before/after sleep\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

If (LGreater(Arg0, XRGH)) { Store(XRGH, Arg0) }\n

If (LAnd(Arg0, LLess(Arg0, XRGL))) { Store(XRGL, Arg0) }\n

If (LNotEqual(LEV2, 0x80000000)) { Store(0x80000000, LEV2) } \n

Store(Arg0, LEVL)\n

}\n

Method (XBQC, 0, NotSerialized)\n

{\n

Store(LEVL, Local0)\n

If (LGreater(Local0, XRGH)) { Store(XRGH, Local0) }\n

If (LAnd(Local0, LLess(Local0, XRGL))) { Store(XRGL, Local0) }\n

Return(Local0)\n

}\n

// Set XOPT bit 0 to disable smooth transitions\n

// Set XOPT bit 1 to wait for native BacklightHandler\n

// Set XOPT bit 2 to force use of native BacklightHandler\n

Name (XOPT, 0x02)\n

// XRGL/XRGH: defines the valid range\n

Name (XRGL, 40)\n

Name (XRGH, 1808)\n

// KLVX is initialization value for LEVX\n

Name (KLVX, 0x7100000)\n

// _BCL: returns list of valid brightness levels\n

// first two entries describe ac/battery power levels\n

Name (_BCL, Package()\n

{\n

1808,\n

479,\n

0,\n

53, 55, 57, 59,\n

62, 66, 71, 77,\n

83, 91, 99, 108,\n

119, 130, 142, 154,\n

168, 183, 198, 214,\n

232, 250, 269, 289,\n

309, 331, 354, 377,\n

401, 426, 453, 479,\n

507, 536, 566, 596,\n

627, 660, 693, 727,\n

762, 797, 834, 872,\n

910, 949, 990, 1031,\n

1073, 1115, 1159, 1204,\n

1249, 1296, 1343, 1391,\n

1440, 1490, 1541, 1592,\n

1645, 1698, 1753, 1808,\n

})\n

}\n

end;

___________________________________________________

原文链接:https://imacos.top/2019/08/09/0958/,转载请注明出处。