Closed tylernguyen closed 3 years ago
@tylernguyen seen this bug. Please remove (disable) SMC Battery Manager kext. Doesn't seem to be needed.
However some data seems to be off on 20KH
@velaar I don't think so. OSX reads the Battery from SMC which is attached via SBS (https://en.wikipedia.org/wiki/Smart_Battery_System) on genuine macs. OSX doesn't use batteries via ACPI. I would suspect you have the kext in the cache (check with kextstat).
@benbender my bad. It is indeed loaded. Data still looks unusual but I have correct running times most of the time.
@velaar Yeah, it doesn't happen on every boot. Just once in a while, and it doesn't normalize after some time and needs reboots.
Notes to myself:
@velaar @tylernguyen Please test the latest commit https://github.com/benbender/x1c6-hackintosh/commit/e3159d1f94178fda4a0aac596bf01f430771bd31 and report back. Thanks!
Tried the new revision, did a ton of reboots just to make sure and remaining time seems to be calculated correctly now. It does take a while to do so, but that's just a matter of playing with the sleep time until we find the sweet spot.
@tylernguyen It never happened to me, but first order of business would be to find out if the root-cause is the mutex or the EC. If you're having time and fun, remove the sleep()-call from BATX and try again. If the bug doesn't reappear, it is the mutex and we'll have to think :)
@benbender
I'm still on Catalina. At first I thought it was an iStats menu issue, but after trying CoconutBattery, BatteryHealth, and the old battery patch again, I was able to isolate it.
I'll remove sleep and check if it's the mutex.
@tylernguyen @velaar Small update in https://github.com/benbender/x1c6-hackintosh/commit/7be933100c96137a5019c46b32f897179982e507. I moved EC-access into the scope of the BATX-device after having strange race-conditions (which didn't produce any errors but simply stopped the SSDT from loading/running). Please update before doing further tests.
Besides that, its the start of dual-batt-support even if it doesnt implement much yet.
Testing the current version got this: I don't think it is failing.
Also got a couple times "Low power" when unplug the laptop with full charge
@velaar I think I know the causes for both issues. will update in the next days with - hopefully - all bigger challenges sorted out.
Hey @tylernguyen, @velaar - here it is! Revision 5 should fix all known issues, is complete self-contained, handles dual-batteries completely transparent, is further optimized and should (hopefully) be great for everybody :)
Get it while it's hot: https://github.com/benbender/x1c6-hackintosh/blob/experimental/EFI/OC/dsl/SSDT-BATX.dsl
@benbender can this also work with T460? Might take a look if dsdt naming is the same.
@Charlyo It should, yes. The only thing it needs is following EC-layout:
Field (ECOR, ByteAcc, NoLock, Preserve)
{
Offset (0xA0),
SBRC, 16,
SBFC, 16,
SBAE, 16,
SBRS, 16,
SBAC, 16,
SBVO, 16,
SBAF, 16,
SBBS, 16
}
Field (ECOR, ByteAcc, NoLock, Preserve)
{
Offset (0xA0),
SBBM, 16,
SBMD, 16,
SBCC, 16
}
Field (ECOR, ByteAcc, NoLock, Preserve)
{
Offset (0xA0),
SBDC, 16,
SBDV, 16,
SBOM, 16,
SBSI, 16,
SBDT, 16,
SBSN, 16
}
Field (ECOR, ByteAcc, NoLock, Preserve)
{
Offset (0xA0),
SBCH, 32
}
Field (ECOR, ByteAcc, NoLock, Preserve)
{
Offset (0xA0),
SBMN, 128
}
Field (ECOR, ByteAcc, NoLock, Preserve)
{
Offset (0xA0),
SBDN, 128
}
To my knowledge it should be the same (at least) down to T/X440 models. You can check for yourself in your DSDT.
Perfect! Thank you @benbender !
@Charlyo Please report back - Would like to add a compatibility-section to the abstract of the SSDT if some data arrives :)
Sure!! I'll try it tomorrow / monday once I get access to the computer!
Just to be 100% sure, we don't need the SMC Battery Manager kext anymore, right?
Thank you anyways!
No, you need SMCBatteryManager. It is the "bridge" between the BATX-ACPI-device and the SMC-keys which OSX reads.
Background: Genuine apple hardware doesn't use the ACPI-Battery-interface but SBS (smart battery system) directly instead.
@benbender
Awesome! Thanks again for your work.
I think I'm ready to push these changes to the main repo after the new Acidanethera releases comes out.
Hello again @benbender !
I already applied the changes. EC layout matches T460's one. Removed BATT / BATC + NTFY SSDT's and added BATX one. Latest versions VirtualSMC/ SMCBatteryManager (1.1.7) are loaded. However I do not have any battery icon.
I'm sure I'm doing something wrong. I share my ACPI + config.plist in case you want to check and spot something wrong.
Again, Thank you for your invaluable time and effort developing all this and helping us at the same time.
@Charlyo Your LPC Controller has a different path. Please change every occurrence of SB.PCI0.LPCB
into SB.PCI0.LPC
(note the missing b
at the end.)
Never thought of that but there is nothing I can do without doubling the file-size. Will add a note though.
(https://github.com/benbender/x1c6-hackintosh/blob/experimental/EFI/OC/dsl/SSDT-BATX.dsl#L45 Line 45 - 62, 7 occurrences)
Dammit! I had multiple SSDT's with that mistake! Thank you for noticing that. Now seems to work correctly!!
At the moment the only thing that might be off are battery characteristics (Displaying 2342):
Battery Information:
Model Information: Serial Number: 16436 / 228 Manufacturer: SONY / SANYO Device Name: 45N1111 / 45N1775 Pack Lot Code: 2342 PCB Lot Code: 2342 Firmware Version: 2342 Hardware Revision: 2342 Cell Revision: 2342 Charge Information: Charge Remaining (mAh): 2059 Fully Charged: No Charging: Yes Full Charge Capacity (mAh): 3604 Health Information: Cycle Count: 453 Condition: Normal Battery Installed: Yes Amperage (mA): 1842 Voltage (mV): 12064
Those "2342"-values and the battery-temperature are "faked" as those values aren't available from the EC (or I couldn't find them ^^). So its expected.
No worries then! Thank you for the clarification!
@benbender I wonder if I'm missing something now. The % battery is correct. The discharge rate seems reasonable. And yet 20h estimate is there for the last hour or so.
@velaar x1c6 single-battery? If you are on catalina, could you get me a screenshot of the system information tab for power? Is it consistent or a one time problem?
@benbender a number can be different and is somehow related to sleep/wake cycle.
@benbender
Can confirm the same issue started appearing again, though not often.
@velaar Is there an issue with your charging status as well? When I plug in my charger:
However, the status would say not charging.
@tylernguyen @velaar Please do the following things to help me to fix those issues:
add the following args to your bootargs: (it only produces some more log output, especially from acpi)
batman=0xff debug=0x12a acpi_layer=0x8 acpi_level=0x2
add DebugEnhancer.kext
to your kexts: (will increase the msgbuf of the kernel to see more data)
https://github.com/acidanthera/DebugEnhancer
Ensure BDBG
is set to One
in the SSDT: (So debugging is enabled in the SSDT)
https://github.com/benbender/x1c6-hackintosh/blob/experimental/EFI/OC/dsl/SSDT-BATX.dsl#L76
If you've done the steps above and an error appears, please run the following command and attach the log here:
sudo dmesg | egrep -i "ACPI Debug|battery" > batx.log
@benbender
Hasn't been able to replicate the time remaining issue, but here is the logs for the battery status not charging issue:
@tylernguyen Please attach the logfile instead of a screenshot :) (Use sudo dmesg | egrep -i "ACPI Debug|battery" > batx.log
). Thx!
@benbender Here you go :) Same issue, charger plugged in but status says not charging
Could you please test that fix: SSDT-BATX-fixed.dsl.zip
@benbender
Same issue:
If it let it sit long enough, the status will eventually switch to charging. But it takes a while to do so, seems the EC is out of whack
If it let it sit long enough, the status will eventually switch to charging. But it takes a while to do so, seems the EC is out of whack
@tylernguyen Hmm, can you quantify "long enough"? Is it 1min, 5min, 1hour? Big Sur or Catalina? Could you add another file: log show --last boot|egrep -i "AppleACPIPlatform|AppleSmartBatteryManager|acpib|pmrd" > batx-syslog.log
@tylernguyen Big Sur or Catalina? Do you have AppleACPIACAdapter attached to the AC-Device in IOReg?
Background: It doesn't seem to be a direct problem in BATX anymore. It seems like the ACPI-notification of the plug-event doesn't seem to trigger the refresh of SMCBatteryManager as it does for me. So the battery don't update update until the next poll which is only every few minutes (depending on the state before) because of disabled QuickPoll.
@tylernguyen Catalina 10.15.7
Can't seem to find AppleACPIACAdapter
, where exactly is it located? and was there a reason to disable QuickPoll?
@tylernguyen See
Edit: Opened an issue on your repo with a suggested fix: https://github.com/tylernguyen/x1c6-hackintosh/issues/90
and was there a reason to disable QuickPoll?
Lower load and more native. I'm trying to get as native as possible. But that also means that breaks are more likely if some parts are broken ^^
@tylernguyen Did the ACAdapter fix the issue for you?
@tylernguyen Did the ACAdapter fix the issue for you?
Unfortunately no, it's still there.
Can you enable Line 1339 (https://github.com/benbender/x1c6-hackintosh/blob/7e69d7f632c6c06b1a41ee7a1b13ad41cfe8d880/EFI/OC/dsl/SSDT-BATX.dsl#L1339) and disable Line 1341 and see if the behaviour changes?
I have the same issue. Battery remaining time showing 20 hours.
Can you enable Line 1339 (
) and disable Line 1341 and see if the behaviour changes?
This seems to fix the issue.
Yes, it seem to "mask" it. This switch makes SMCBatteryManager poll the battery more often. The underlying problem seems to be some race-condition/EC-not-ready-thing. So if quick-poll is disabled, Virtual-SMC does not update the static infos of the battery once it got (in this case: wrong) data and the 20h remain visible. If its enabled, virtualsmc polls the ec frequently and fetches correct data as soon as the EC is available. Couldn't pin down the exact problem yet though.
PS: same problem should exist in nearly every other implementation... ;)
@benbender Find another issue. I set the charging upper limit in Windows to be 95%. When I charge in Mac, it works fine and charge to 95%. However on the next reboot, the battery level is shown as 99%. The same battery is shown as 94% in Windows.
@buyddy did you notice this behaviour only with BATX or also with the legacy battery-patches?
@buyddy did you notice this behaviour only with BATX or also with the legacy battery-patches?
Actually no idea. Because I never tested it the charging limit in the past. But pretty sure it was an issue back then too because my battery percentage never matched Windows. My guess is there are more than 2 capacities in EC? There is design capacity, full charge capacity, and maybe another setup capacity?
Per our discussion, with the new battery patch: energy and info readings are correct. However, remaining time seems to be absurdly off.
EDIT: Machine: X1C6 20KH*