拯救者电池电量显示补丁
本帖最后由 shiy05 于 2016-11-14 12:42 编辑今天花了好几个小时,终于从头到尾把SSDT里的电池电量补丁写好了。
之前用的@hello_ok修改的SSDT,后来发现偶尔开机电量会是一个X。
经过楼主不懈努力,终于发现了问题所在,原来@hello_ok兄弟把一个读取函数替换错了。
在正确拆分了所有大于8的字段后,现在再也不用担心电量会是个叉了。
PS: 如果想要自己写补丁拆分字段的朋友,可以先把所有大于8的字段声明挑出来,然后用正则表达一次性找出所有的相关语句,再用批量替换的办法修改语句(之前没有想到这个办法,浪费了很多时间)。
大家的电脑如果是拯救者(14-ISK和15-ISK应该通用),可以试试。先找出电池电量的SSDT,再打楼主写好的补丁。懒人直接下载楼主的SSDT吧(见附件)。
补丁如下(话说怎么加到Rehabman的补丁源里去?):#this is the battery patch for lenovo rescue 14-isk, make by sandy
#all 16 bit variables:
#(B1MO|B2MO|B1SN|B2SN|B1DT|B2DT|B1CY|B2TM|B2RS|B2CV|RTEP|BET2|B1TM|BAPV|B1CV|BARC|BADC|BADV|BDCW|BDCL|BAFC|BAPR|B1CR|B1AR|F1SP|F2SP|BCG1|BCG2)
#all variables larger than 8:
#(SMD0|B1CH|B2CH|B1MO|B2MO|B1SN|B2SN|B1DT|B2DT|B1CY|B2TM|B2RS|B1MA|B2MA|B2CV|RTEP|BET2|B1TM|BAPV|B1CV|BARC|BADC|BADV|BDCW|BDCL|BAFC|BAPR|B1CR|B1AR|F1SP|F2SP|BCG1|BCG2)
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1MO,\s+16, replace_matched begin BMO0,8,BMO1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B2MO,\s+16, replace_matched begin BMO2,8,BMO3,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1SN,\s+16, replace_matched begin BSN0,8,BSN1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B2SN,\s+16, replace_matched begin BSN2,8,BSN3,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1DT,\s+16, replace_matched begin BDT0,8,BDT1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B2DT,\s+16, replace_matched begin BDT2,8,BDT3,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1CY,\s+16, replace_matched begin BCY0,8,BCY1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B2TM,\s+16, replace_matched begin BTM2,8,BTM3,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B2RS,\s+16, replace_matched begin BRS2,8,BRS3,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B2CV,\s+16, replace_matched begin BCV2,8,BCV3,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex RTEP,\s+16, replace_matched begin RTP0,8,PTP1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex BET2,\s+16, replace_matched begin B0ET,8,B1ET,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1TM,\s+16, replace_matched begin BTM0,8,BTM1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex BAPV,\s+16, replace_matched begin B0PV,8,B1PV,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1CV,\s+16, replace_matched begin BCV0,8,BCV1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex BARC,\s+16, replace_matched begin BAC0,8,BAC1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex BADC,\s+16, replace_matched begin BDC0,8,BDC1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex BADV,\s+16, replace_matched begin BDV0,8,BDV1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex BDCW,\s+16, replace_matched begin BDW0,8,BDW1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex BDCL,\s+16, replace_matched begin BDL0,8,BDL1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex BAFC,\s+16, replace_matched begin BFC0,8,BFC1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex BAPR,\s+16, replace_matched begin BAP0,8,BAP1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1CR,\s+16, replace_matched begin BCR0,8,BCR1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1AR,\s+16, replace_matched begin BAR0,8,BAR1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex F1SP,\s+16, replace_matched begin FSP0,8,FSP1,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex F2SP,\s+16, replace_matched begin FSP2,8,FSP3,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex BCG1,\s+16, replace_matched begin B0CG,8,B1CG,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex BCG2,\s+16 replace_matched begin B2CG,8,B3CG,8 end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B1CH,\s+32, replace_matched begin BC0H,8,BC1H,8,BC2H,8,BC3H,8, end;
into Scope label \_SB.PCI0.LPCB.H_EC code_regex B2CH,\s+32, replace_matched begin BC4H,8,BC5H,8,BC6H,8,BC7H,8, end;
into method label _BIF code_regex BAFC replaceall_matched begin B1B2(BFC0,BFC1) end;
into method label _BIF code_regex BADC replaceall_matched begin B1B2(BDC0,BDC1) end;
into method label _BIF code_regex BADV replaceall_matched begin B1B2(BDV0,BDV1) end;
into method label _BST code_regex B1CR replaceall_matched begin B1B2(BCR0,BCR1) end;
into method label _BST code_regex BAPV replaceall_matched begin B1B2(B0PV,B1PV) end;
into method label _BST code_regex BARC replaceall_matched begin B1B2(BAC0,BAC1) end;
into method label SMTF code_regex BET2 replaceall_matched begin B1B2(B0ET,B1ET) end;
into method label GSBI code_regex BADC replaceall_matched begin B1B2(BDC0,BDC1) end;
into method label GSBI code_regex BAFC replaceall_matched begin B1B2(BFC0,BFC1) end;
into method label GSBI code_regex BARC replaceall_matched begin B1B2(BAC0,BAC1) end;
into method label GSBI code_regex RTEP replaceall_matched begin B1B2(RTP0,PTP1) end;
into method label GSBI code_regex BET2 replaceall_matched begin B1B2(B0ET,B1ET) end;
into method label GSBI code_regex BAPV replaceall_matched begin B1B2(B0PV,B1PV) end;
into method label GSBI code_regex B1CR replaceall_matched begin B1B2(BCR0,BCR1) end;
into method label GSBI code_regex B1TM replaceall_matched begin B1B2(BTM0,BTM1) end;
into method label GSBI code_regex B1DT replaceall_matched begin B1B2(BDT0,BDT1) end;
into method label GSBI code_regex BADV replaceall_matched begin B1B2(BDV0,BDV1) end;
into method label GBID code_regex B1CY replaceall_matched begin B1B2(BCY0,BCY1) end;
into method label _BIF code_regex B1CH replaceall_matched begin B1B4(BC0H,BC1H,BC2H,BC3H) end;
into method label MHPF code_regex Store\s\(FB4,\sSMD0\) replaceall_matched begin WECB(0x1C,256,FB4) end;
into method label MHPF code_regex SMD0 replaceall_matched begin RECB(0x1C, 256) end; #this line must not ahead the last line
into method label GSBI code_regex B1CH replaceall_matched begin B1B4(BC0H,BC1H,BC2H,BC3H) end;
into method label GSBI code_regex B2MA replaceall_matched begin RECB(0x98, 64) end;
into method label GSBI code_regex B1MA replaceall_matched begin RECB(0x8F, 64) end;
into method label B1B2 remove_entry;
into definitionblock code_regex . insert
begin
Method (B1B2, 2, NotSerialized)\n
{\n
Return(Or(Arg0, ShiftLeft(Arg1, 8)))\n
}\n
end;
into method label B1B4 remove_entry;
into definitionblock code_regex . insert
begin
Method (B1B4, 4, NotSerialized)\n
{\n
Store(Arg3, Local0)\n
Or(Arg2, ShiftLeft(Local0, 8), Local0)\n
Or(Arg1, ShiftLeft(Local0, 8), Local0)\n
Or(Arg0, ShiftLeft(Local0, 8), Local0)\n
Return(Local0)\n
}\n
end;
# utility methods to read/write buffers from/to EC
into method label RE1B parent_label EC0 remove_entry;
into method label RECB parent_label EC0 remove_entry;
into Scope label \_SB.PCI0.LPCB.H_EC insert
begin
Method (RE1B, 1, NotSerialized)\n
{\n
OperationRegion(ERAM, EmbeddedControl, Arg0, 1)\n
Field(ERAM, ByteAcc, NoLock, Preserve) { BYTE, 8 }\n
Return(BYTE)\n
}\n
Method (RECB, 2, Serialized)\n
// Arg0 - offset in bytes from zero-based EC\n
// Arg1 - size of buffer in bits\n
{\n
ShiftRight(Arg1, 3, Arg1)\n
Name(TEMP, Buffer(Arg1) { })\n
Add(Arg0, Arg1, Arg1)\n
Store(0, Local0)\n
While (LLess(Arg0, Arg1))\n
{\n
Store(RE1B(Arg0), Index(TEMP, Local0))\n
Increment(Arg0)\n
Increment(Local0)\n
}\n
Return(TEMP)\n
}\n
end;
into method label WE1B parent_label EC0 remove_entry;
into method label WECB parent_label EC0 remove_entry;
into Scope label \_SB.PCI0.LPCB.H_EC insert
begin
Method (WE1B, 2, NotSerialized)\n
{\n
OperationRegion(ERAM, EmbeddedControl, Arg0, 1)\n
Field(ERAM, ByteAcc, NoLock, Preserve) { BYTE, 8 }\n
Store(Arg1, BYTE)\n
}\n
Method (WECB, 3, Serialized)\n
// Arg0 - offset in bytes from zero-based EC\n
// Arg1 - size of buffer in bits\n
// Arg2 - value to write\n
{\n
ShiftRight(Arg1, 3, Arg1)\n
Name(TEMP, Buffer(Arg1) { })\n
Store(Arg2, TEMP)\n
Add(Arg0, Arg1, Arg1)\n
Store(0, Local0)\n
While (LLess(Arg0, Arg1))\n
{\n
WE1B(Arg0, DerefOf(Index(TEMP, Local0)))\n
Increment(Arg0)\n
Increment(Local0)\n
}\n
}\n
end; 请问怎么找出电池电量的SSDT?函数名称是什么?谢谢大神 本帖最后由 shiy05 于 2017-6-29 08:54 编辑
busui 发表于 2016-11-17 20:07
请问怎么找出电池电量的SSDT?函数名称是什么?谢谢大神
搜索到embeddedcontrol就是电池,具体看帖子https://bbs.pcbeta.com/viewthread-1595139-1-1.html最新进展:已经更新代码,电量不再为X,详情请看:
https://bbs.pcbeta.com/viewthread-1747831-1-1.html
谢谢分享教程 xiexeifenxaing 试试 找了好久 试试 试试为什么花了pb后还要花。。。 晕死 下载失败,,,, 谢谢楼主分享 多谢楼主无私奉献啊 楼主 有安装 10.12吗, zzn88 发表于 2017-2-23 19:44 https://www.pcbeta.com/static/image/common/back.gif
楼主 有安装 10.12吗,
把吗去掉,哈哈 谢谢老大的分享,老大辛苦了!!! shiy05 发表于 2017-6-10 16:34 https://www.pcbeta.com/static/image/common/back.gif
把吗去掉,哈哈
哈哈。。。老大也幽默啊 好烦,又没币了 爱在1394 发表于 2017-6-29 00:26
好烦,又没币了
这个帖子过时了,请看我最新的帖子,在审核中 shiy05 发表于 2017-6-29 00:59 https://www.pcbeta.com/static/image/common/back.gif
这个帖子过时了,请看我最新的帖子,在审核中
谢谢兄弟非常感谢 into Scope label \_SB.PCI0.LPCB.H_EC code_regex (B1MA,)\s+(64) replace_matched begin BXMA,%2,//%1%2 end;
楼主,我想问一个问题,“%2,//%1%2”代表什么?请赐教!
谢谢分享!!!!!
谢谢兄弟非常感谢
页:
[1]