kosakgroove Posted October 18, 2016 Share Posted October 18, 2016 Hi guys, I am an experienced user in DSDT paching and Hackintosh in general, and in my Hack everything is running perfect. The only thing remaining to do in this Lenovo Thinkpad L420 is to fix the battery stats in order to use ACPIBatteryManager from RehabMan, but I have tried all the similar model patches to the DSDT and none makes it work. Most of them cause a kernel panic, I can do almost everything on a Hackintosh except patch an AppleHDA from scratch and writing a patch for battery stats in DSDT.. Could anyone kindly help with this? ACPI Lenovo L420.zip Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/ Share on other sites More sharing options...
artur_pt Posted October 18, 2016 Share Posted October 18, 2016 hello only bat patch applied DSDT.aml.zip good hack Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2301997 Share on other sites More sharing options...
kosakgroove Posted October 18, 2016 Author Share Posted October 18, 2016 This caused instant reboot when booting, then I tried to revert to original DSDT and issue persists... I will try to do a fresh install... Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2302123 Share on other sites More sharing options...
artur_pt Posted October 18, 2016 Share Posted October 18, 2016 hello sure is not the patch .. maybe other problems .. but bat is not one of them .. or it works or not .. no reboot .. sure of that .. good hack Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2302170 Share on other sites More sharing options...
kosakgroove Posted November 26, 2016 Author Share Posted November 26, 2016 Hi artur, I would really appreciate if you could try to get the percentage working again, I believe the crash with the other install was due to having installed and then removed VoodooBattery. I made a new install, Mac OS X is the only OS in this Lenovo now, and it just runs purely beautiful, much better than Windows. I would love if you got this working, since my mum is a recent computer user, I tried to teach her Windows at first, she didnt even know how to turn on a computer hahah then I decided maybe Ubuntu would be better for her, because she was really scared from errors and programs crashing, Linux did the trick hehe but she sees my Asus running Mavericks too and said she liked the interface and speed more, so then I decided to make the Lenovo hack as close to perfection as I can. Now this Lenovo will be used by her and by my brother who like me wants to use it basically for Logic Pro X It would be awesome to have the battery percentage, since everything is currently working including DisplayPort audio, Attached is my Clover folder, Thanks once again mate and now I will try it with a USB clover hahahah CLOVER.zip Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2324999 Share on other sites More sharing options...
artur_pt Posted November 26, 2016 Share Posted November 26, 2016 hello try this one .. is good idea .. upload also ioreg DSDT.aml.zip good hack 1 Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325033 Share on other sites More sharing options...
kosakgroove Posted November 26, 2016 Author Share Posted November 26, 2016 It doesnt give me percentage, only time remaining, weird hahah Can you kindly try again? Here goes ioreg Thinkpad.zip Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325065 Share on other sites More sharing options...
artur_pt Posted November 26, 2016 Share Posted November 26, 2016 hello new test DSDT.aml.zip that thing only have 1 bat ? good hack 1 Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325113 Share on other sites More sharing options...
kosakgroove Posted November 27, 2016 Author Share Posted November 27, 2016 I have opened it up completely and only 1 battery. With this second test results are worse >.< Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325122 Share on other sites More sharing options...
SavageAUS Posted November 27, 2016 Share Posted November 27, 2016 try this. only battery patch. DSDT.aml.zip 1 Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325138 Share on other sites More sharing options...
kosakgroove Posted November 27, 2016 Author Share Posted November 27, 2016 Still no luck friends... with SavageAUS patch battery icon doesnt show in menubar... worst results so far... I wonder if there will be a way to get this working Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325204 Share on other sites More sharing options...
artur_pt Posted November 27, 2016 Share Posted November 27, 2016 hello maybe need to convert some more variables how to do it http://www.insanelymac.com/forum/topic/272459-appleacpibatterymanagerapplesmartbatterymanager-for-lion/ and need the notebook to test .. use the best patched dsdt .. and see , test to convert all 16/32/64.. to 8 bit good hack 1 Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325239 Share on other sites More sharing options...
kosakgroove Posted November 27, 2016 Author Share Posted November 27, 2016 It seems quite complicated I managed to patch some nvidia cards off optimus by myself but this seems like a difficult challenge, i would really like some help with it The best result was with the post #6 dsdt Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325243 Share on other sites More sharing options...
artur_pt Posted November 27, 2016 Share Posted November 27, 2016 hello hack os x is not easy .. must read and try .. last test i change some more variables .. DSDT.aml.zip good hack 1 Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325258 Share on other sites More sharing options...
kosakgroove Posted November 27, 2016 Author Share Posted November 27, 2016 Hi artur, I know hacking OSX is only for who really wants to. I just thought maybe an experienced user like you could help with a laptop that has no community support for OSX but it runs like butter. This is by far the best result, it even detects time remaining and charging or not, but still no battery percentage.. super strange... Here is the ioreg with your latest attempt Thinkpad.zip It seems to me that the usage of the method B1B2 either was not correctly implemented or it just doesnt work on this hack... What other way should I try? Convert the 16/bits to 8 bit in the embeedded controller, but what about the 32, 64, 128 and 192 fields... How to deal with those? Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325290 Share on other sites More sharing options...
artur_pt Posted November 27, 2016 Share Posted November 27, 2016 hello b1b2 method is to divide the variable 32 :8 =4 and so on should become ex: abc0, abc1, abc2, abc3 try to talk with rehabman .. about this issue good hack 1 Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325366 Share on other sites More sharing options...
kosakgroove Posted November 27, 2016 Author Share Posted November 27, 2016 I have been trying and getting some problems with applying his methods, due to how different this DSDT is..... so I tried to change manually every field by renaming everywhere and converting all to 8 bit, but something is not working.. i get the percentage on boot for example now 88% but it refuses to update the battery percentage anymore... stays stuck at 88% and doesnt show time remaining... weird, This is my approach to the problem DSDT.zip Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325446 Share on other sites More sharing options...
artur_pt Posted November 27, 2016 Share Posted November 27, 2016 hello i think the problem is unknown bat .. look at mine like i say before this need edit dsdt boot and test the basis i use is this ones battery_Lenovo-T430u.txt battery_Lenovo-T440p.txt good hack Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325525 Share on other sites More sharing options...
kosakgroove Posted November 27, 2016 Author Share Posted November 27, 2016 So you suggest i edit those patches to match my laptop... it is basically what I did, but if the serial number of the battery is not present in DSDT it will never be recognized right? Or you think it might be fixable with thecorrect modification of one of those patches? Thanks again Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325534 Share on other sites More sharing options...
kosakgroove Posted November 27, 2016 Author Share Posted November 27, 2016 I have made some modifications to the patch, but it still doesnt work properly, results in syntax errors........ specially in those parts with .sb.lpcb.ec.xx i would love some help with this, here is my attempt number 1 ATTEMPT1.zip Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325596 Share on other sites More sharing options...
styrian Posted November 28, 2016 Share Posted November 28, 2016 Hallo! Have you compared the bat part of your DSDT.aml with the one of the T420 of the Tluck package? http://www.insanelymac.com/forum/topic/285678-lenovo-thinkpad-t420-with-uefi-only/?p=1952283 Have fun. Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325656 Share on other sites More sharing options...
kosakgroove Posted November 28, 2016 Author Share Posted November 28, 2016 It is very similar model but not the same.. It might appear like a big resemblance on the outside, but analysing the DSDT it seems very very different from one model to another. I would like someone to check my patch attempt and my DSDT, and give me some info about what is right and what is not. Thanks Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325698 Share on other sites More sharing options...
kosakgroove Posted November 28, 2016 Author Share Posted November 28, 2016 This is my second attempt in patching for battery stats in this laptop with zero community support. I based myself on all the Lenovo patches I have been finding, and adapting them, and also looking at many DSDTs from Lenovos and so far I get a weird nameseg error... I wonder if someone expert on this matter could revise my patch, and hopefully correct me... This is what I have got. # LENOVO L420 - KosakGroove Note: This DSDT requires "Fix Mutex with non-zero SyncLevel" into method label B1B2 remove_entry; into definitionblock code_regex . insert begin Method (B1B2, 2, NotSerialized) { Return(Or(Arg0, ShiftLeft(Arg1, 8))) }\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; into device label EC code_regex BATD,\s+16, replace_matched begin ATD0,8,ATD1,8, end; into method label SELE code_regex \(\^PCI0\.LPCB\.BATD, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.ATD0, ^PCI0.LPCB.EC.ATD1), end; into device label EC code_regex SMW0,\s+16, replace_matched begin MW00,8,MW01,8, end; into method label SMRD code_regex \(\^^PCI0.LPCB.EC.SMW0, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.MW00, ^PCI0.LPCB.EC.MW01), end; into method label SMWR code_regex \(SMW0, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.MW00, ^PCI0.LPCB.EC.MW01), end; into device label EC code_regex SBRC,\s+16, replace_matched begin BR00,8,BR01,8, end; into method label GBST code_regex \(\^PCI0\.LPCB\.EC\.SBRC, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.BR00,^PCI0.LPCB.EC.BR01), end; into device label EC code_regex SBFC,\s+16, replace_matched begin BF00,8,BF01,8, end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBFC, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.BF00, ^PCI0.LPCB.EC.BF01), end; into device label EC code_regex SBVO,\s+16, replace_matched begin BV00,8,BV01,8, end; into method label GBST code_regex \(\^PCI0\.LPCB\.EC\.SBVO, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.BV00, ^PCI0.LPCB.EC.BV01), end; into device label EC code_regex SBSN,\s+16, replace_matched begin SN00,8,SN01,8 end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBSN, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.SN00, ^PCI0.LPCB.EC.SN01), end; into device label EC code_regex SBDC,\s+16, replace_matched begin DC00,8,DC01,8 end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBDC, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.DC00, ^PCI0.LPCB.EC.DC01), end; into device label EC code_regex SBDV,\s+16, replace_matched begin DV00,8,DV01,8 end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBDC, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.DV00, ^PCI0.LPCB.EC.DV01), end; into device label EC code_regex SBAE,\s+16, replace_matched begin BA00,8,BA01,8, end; into device label EC code_regex SBAF,\s+16, replace_matched begin BB00,8,BB01,8, end; into device label EC code_regex SBBS,\s+16, replace_matched begin BD00,8,BD01,8, end; into device label EC code_regex SBMD,\s+16, replace_matched begin SB00,8,SB01,8, end; into device label EC code_regex SBCC,\s+16, replace_matched begin CC00,8,CC01,8 end; into device label EC code_regex SBOM,\s+16, replace_matched begin OM00,8,OM01,8 end; into device label EC code_regex SBSI,\s+16, replace_matched begin SI00,8,SI01,8 end; into device label EC code_regex SBDT,\s+16, replace_matched begin DT00,8,DT01,8 end; into device label EC code_regex SBCH,\s+32 replace_matched begin SH00,8,SH01,8,SH02,8,SH03,8 end; into_all method label GBIF code_regex \(\^PCI0\.LPCB\.EC\SBCH, replaceall_matched begin (B1B4(^PCI0.LPCB.EC.SH00, ^PCI0.LPCB.EC.SH01, ^PCI0.LPCB.EC.SH02, ^PCI0.LPCB.EC.SH03), end; into method label RE1B parent_label EC remove_entry; into method label RECB parent_label EC remove_entry; into device label EC insert begin Method (RE1B, 1, NotSerialized)\n // Arg0 - offset in bytes from zero-based EC\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 device label EC code_regex (SBMN,)\s+(128) replace_matched begin BMNX,%2,//%1%2 end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBMN, replaceall_matched begin (^PCI0.LPCB.EC.RECB(0xA0,128), end; into device label EC code_regex (SBDN,)\s+(128) replace_matched begin BDNX,%2,//%1%2 end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBDN, replaceall_matched begin (^PCI0.LPCB.EC.RECB(0xA0,128), end; VERSION 2 OF THE PATCH WITH SOME OPTIMIZATIONS AND CORRECTIONS, BUT STILL SAME PROBLEM # LENOVO L420 - KosakGroove Note: This DSDT requires "Fix Mutex with non-zero SyncLevel" into method label B1B2 remove_entry; into definitionblock code_regex . insert begin Method (B1B2, 2, NotSerialized) { Return(Or(Arg0, ShiftLeft(Arg1, 8))) }\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; into device label EC code_regex BATD,\s+16, replace_matched begin ATD0,8,ATD1,8, end; into method label SELE code_regex \(\^PCI0\.LPCB\.EC\.BATD, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.ATD0, ^PCI0.LPCB.EC.ATD1), end; into device label EC code_regex SMW0,\s+16, replace_matched begin MW00,8,MW01,8, end; into method label SMRD code_regex \(\^PCI0\.LPCB\.EC\.SMW0, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.MW00, ^PCI0.LPCB.EC.MW01), end; into method label SMWR code_regex \(\^PCI0\.LPCB\.EC\.SMW0, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.MW00, ^PCI0.LPCB.EC.MW01), end; into device label EC code_regex SBRC,\s+16, replace_matched begin BR00,8,BR01,8, end; into method label GBST code_regex \(\^PCI0\.LPCB\.EC\.SBRC, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.BR00,^PCI0.LPCB.EC.BR01), end; into device label EC code_regex SBFC,\s+16, replace_matched begin BF00,8,BF01,8, end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBFC, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.BF00, ^PCI0.LPCB.EC.BF01), end; into device label EC code_regex SBVO,\s+16, replace_matched begin BV00,8,BV01,8, end; into method label GBST code_regex \(\^PCI0\.LPCB\.EC\.SBVO, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.BV00, ^PCI0.LPCB.EC.BV01), end; into device label EC code_regex SBSN,\s+16, replace_matched begin SN00,8,SN01,8 end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBSN, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.SN00, ^PCI0.LPCB.EC.SN01), end; into device label EC code_regex SBDC,\s+16, replace_matched begin DC00,8,DC01,8 end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBDC, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.DC00, ^PCI0.LPCB.EC.DC01), end; into device label EC code_regex SBDV,\s+16, replace_matched begin DV00,8,DV01,8 end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBDV, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.DV00, ^PCI0.LPCB.EC.DV01), end; into device label EC code_regex SBAE,\s+16, replace_matched begin BA00,8,BA01,8, end; into device label EC code_regex SBAF,\s+16, replace_matched begin BB00,8,BB01,8, end; into device label EC code_regex SBBS,\s+16, replace_matched begin BD00,8,BD01,8, end; into device label EC code_regex SBMD,\s+16, replace_matched begin SB00,8,SB01,8, end; into device label EC code_regex SBCC,\s+16, replace_matched begin CC00,8,CC01,8 end; into device label EC code_regex SBOM,\s+16, replace_matched begin OM00,8,OM01,8 end; into device label EC code_regex SBSI,\s+16, replace_matched begin SI00,8,SI01,8 end; into device label EC code_regex SBDT,\s+16, replace_matched begin DT00,8,DT01,8 end; into device label EC code_regex SBCH,\s+32 replace_matched begin SH00,8,SH01,8,SH02,8,SH03,8 end; into_all method label GBIF code_regex \(\^PCI0\.LPCB\.EC\SBCH, replaceall_matched begin (B1B4(^PCI0.LPCB.EC.SH00, ^PCI0.LPCB.EC.SH01, ^PCI0.LPCB.EC.SH02, ^PCI0.LPCB.EC.SH03), end; into method label RE1B parent_label EC remove_entry; into method label RECB parent_label EC remove_entry; into device label EC insert begin Method (RE1B, 1, NotSerialized)\n // Arg0 - offset in bytes from zero-based EC\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 device label EC code_regex (SBMN,)\s+(128) replace_matched begin BMNX,%2,//%1%2 end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBMN, replaceall_matched begin (^PCI0.LPCB.EC.RECB(0xA0,128), end; into device label EC code_regex (SBDN,)\s+(128) replace_matched begin BDNX,%2,//%1%2 end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBDN, replaceall_matched begin (^PCI0.LPCB.EC.RECB(0xA0,128), end; Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325711 Share on other sites More sharing options...
artur_pt Posted November 28, 2016 Share Posted November 28, 2016 hello really for now .. no more ideas .. like i say this issue is try and test .. apply the patches correct by hand what is wrong in the dsdt .. compile and try .. good hack 1 Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325785 Share on other sites More sharing options...
kosakgroove Posted November 28, 2016 Author Share Posted November 28, 2016 This is the 3rd attempt at constructing the patch and now it is including some more devices, it is a complete patch, although it still seems to give me some object not found errors, check it out please: # LENOVO L420 - KosakGroove Note: This DSDT requires "Fix Mutex with non-zero SyncLevel" into method label B1B2 remove_entry; into definitionblock code_regex . insert begin Method (B1B2, 2, NotSerialized) { Return(Or(Arg0, ShiftLeft(Arg1, 8))) }\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; into device label EC code_regex BATD,\s+16, replace_matched begin ATD0,8,ATD1,8, end; into device label EC code_regex SMW0,\s+16, replace_matched begin MW00,8,MW01,8, end; into device label EC code_regex SBRC,\s+16, replace_matched begin BR00,8,BR01,8, end; into device label EC code_regex SBFC,\s+16, replace_matched begin BF00,8,BF01,8, end; into device label EC code_regex SBVO,\s+16, replace_matched begin BV00,8,BV01,8, end; into device label EC code_regex SBSN,\s+16, replace_matched begin SN00,8,SN01,8, end; into device label EC code_regex SBDC,\s+16, replace_matched begin DC00,8,DC01,8, end; into device label EC code_regex SBDV,\s+16, replace_matched begin DV00,8,DV01,8, end; into device label EC code_regex SBAE,\s+16, replace_matched begin BA00,8,BA01,8, end; into device label EC code_regex SBAF,\s+16, replace_matched begin BB00,8,BB01,8, end; into device label EC code_regex SBBS,\s+16, replace_matched begin BD00,8,BD01,8, end; into device label EC code_regex SBMD,\s+16, replace_matched begin SB00,8,SB01,8, end; into device label EC code_regex SBCC,\s+16, replace_matched begin CC00,8,CC01,8, end; into device label EC code_regex SBOM,\s+16, replace_matched begin OM00,8,OM01,8, end; into device label EC code_regex SBSI,\s+16, replace_matched begin SI00,8,SI01,8, end; into device label EC code_regex SBDT,\s+16, replace_matched begin DT00,8,DT01,8, end; into_all method label SELE code_regex \(\^PCI0\.LPCB\.EC\.BATD, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.ATD0, ^PCI0.LPCB.EC.ATD1), end; into method label SMRD code_regex \(\^PCI0\.LPCB\.EC\.SMW0, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.MW00, ^PCI0.LPCB.EC.MW01), end; into method label SMWR code_regex \(\^PCI0\.LPCB\.EC\.SMW0, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.MW00, ^PCI0.LPCB.EC.MW01), end; into method label GBST code_regex \(\^PCI0\.LPCB\.EC\.SBRC, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.BR00,^PCI0.LPCB.EC.BR01), end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBFC, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.BF00, ^PCI0.LPCB.EC.BF01), end; into method label GBST code_regex \(\^PCI0\.LPCB\.EC\.SBVO, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.BV00, ^PCI0.LPCB.EC.BV01), end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBSN, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.SN00, ^PCI0.LPCB.EC.SN01), end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBDC, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.DC00, ^PCI0.LPCB.EC.DC01), end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBDV, replaceall_matched begin (B1B2(^PCI0.LPCB.EC.DV00, ^PCI0.LPCB.EC.DV01), end; into device label EC code_regex SBCH,\s+32 replace_matched begin SH00,8,SH01,8,SH02,8,SH03,8, end; into_all method label GBIF code_regex \(\^PCI0\.LPCB\.EC\SBCH, replaceall_matched begin (B1B4(^PCI0.LPCB.EC.SH00, ^PCI0.LPCB.EC.SH01, ^PCI0.LPCB.EC.SH02, ^PCI0.LPCB.EC.SH03), end; into method label RE1B parent_label EC remove_entry; into method label RECB parent_label EC remove_entry; into device label EC insert begin Method (RE1B, 1, NotSerialized)\n // Arg0 - offset in bytes from zero-based EC\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 device label EC code_regex (SBMN,)\s+(128) replace_matched begin BMNX,%2,//%1%2 end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBMN, replaceall_matched begin (^PCI0.LPCB.EC.RECB(0xA0,128), end; into device label EC code_regex (SBDN,)\s+(128) replace_matched begin BDNX,%2,//%1%2 end; into method label GBIF code_regex \(\^PCI0\.LPCB\.EC\.SBDN, replaceall_matched begin (^PCI0.LPCB.EC.RECB(0xA0,128), end; into device label EC code_regex (FLD1)\s+(128) replace_matched begin D101,%2,//%1%2 end; into method label SMRD code_regex \(\^PCI0\.LPCB\.EC\.FLD1, replaceall_matched begin (^PCI0.LPCB.EC.RECB(0xA0,128), end; into device label EC code_regex (FLD2,)\s+(192) replace_matched begin D201,%2,//%1%2 end; into method label SMRD code_regex \(\^PCI0\.LPCB\.EC\.FLD2, replaceall_matched begin (^PCI0.LPCB.EC.RECB(0xA0,192), end; into device label EC code_regex (FLD3,)\s+(256) replace_matched begin D301,%2,//%1%2 end; into method label SMRD code_regex \(\^PCI0\.LPCB\.EC\.FLD3, replaceall_matched begin (^PCI0.LPCB.EC.RECB(0xA0,256), end; DSDT AND PATCH.zip Link to comment https://www.insanelymac.com/forum/topic/316950-help-fix-battery-percentage-in-dsdt-lenovo-l420/#findComment-2325813 Share on other sites More sharing options...
Recommended Posts