Support Tahoe SMC keys with existing smc binary#388
Support Tahoe SMC keys with existing smc binary#388actuallymentor merged 10 commits intoactuallymentor:mainfrom
Conversation
base47
left a comment
There was a problem hiding this comment.
Thank you!
Testing it on 15.7, so far so good.
| } | ||
|
|
||
| ## ################# | ||
| ## SMC Manipulation |
There was a problem hiding this comment.
EDIT: Hiding this proposal, because it requires refactoring and we don't have time for that.
don't read
Just an idea. Does it make sense to use this whole block of functions in a polymorphic manner?
We could move this whole block of functions to a separate file, let's say, "battery_smc_api_legacy.sh" and implement these functions using tahoe smc keys in a separate file like "battery_smc_api_tahoe.sh". When the battery.sh script starts we could inject the appropriate function implementations into the script, like
if tahoe; then
source battery_smc_api_tahoe.sh
else
source battery_smc_api_legacy.sh
fi
This way we could guaranty that battery works as before for previous macos versions, simplify the code review and the number of macos versions to test with.
Details
|
~/.battery/battery.log tailThat can happen because you forgot to update "visudoconfig" variable in the battery script. Also, in the log we can see that writing CHIE key fails: But the same command works when I execute it in terminal and enter my password. macOS 15.7 (24G222) |
|
Maybe I'm missing something, but it seems like battery update from a command line using |
|
EDIT: The problem I described earlier below in this message was likely due to a different output format of smc tool in your system. which breaks your smc_read_hex() and get_smc_charging_status() functions. Doesn't work even with fixed sudo. Battery starts charging back to 100% after forced discharge is completed. ~/.battery/battery.log tailmacOS 15.7 (24G222) |
…eturn status string
…ct_smc_capabilities() func
|
detect_smc_capabilities() function does not work as expected because |
…ere with status_csv command
|
@duetocode I added a few commits on top of your PR: duetocode#1 !!! For anyone who wants to test this: Do not forget to run |
Minor fixes to Tahoe SMC keys support
|
@base47 Thanks for the work! I have merged your pull request with some minor modifications, and I have tested the |
|
I've been running |
|
This fix works for me on macOS 26.0.1 with "Optimised Battery Charging" in 'Battery Health' enabled. But I get the following error in battery.log: |
Most probably, that's because your macbook doesn't have a MagSafe LED. It's an old and easily fixable bug, we have a separate issue for it. |
|
Any idea when there will be a new release to make it easier for everyone to install this? |
|
@rhatguy You can ask @actuallymentor on Twitter. According to contributing guidlines, Twitter (@actuallymentor) is a main channel for communication. I don't have an account. |
|
@rhatguy and @base47, While we’re waiting on maintainer feedback I have built a preview build so that anyone blocked by this PR can move ahead. You can find it here: https://github.com/duetocode/battery/releases/tag/v1.3.0-preview.1 It isn’t signed (I’m not on the Apple Developer Program), so Gatekeeper will complain the first run. |
|
@duetocode thank you! Wish it also included a patch to add “disable telemetry” option #362 |
|
@agsola There's already a preview build available for testing, which includes this fix only. You can find it here: https://github.com/duetocode/battery/releases/tag/v1.3.0-preview.1 Let me know if you encounter any issues with that version. |
|
Thank you all for your excellent work on this! I will merge this now and ask you kindly to tag me if the new build causes any problems. I do not have access to a newer macbook at this time so cannot test these things myself I'm afraid. Note that I will end up merging this, and then incrementing the version number manually as you haven't yet. Thanks again for doing the legwork on this! |
I think if you solve it on m1 it'll work on the rest. I'm currently using m1 and m3 and have this not working on both. |
|
@anarchy89 what do you run into specifically? We're in a classic "it works in my machine" situation (both for my M1 and the M3 of the pull request creator) |
I have not tried the latest fix you have put I only have the one that is compiled currently on your releases tab. I'm using M1 Max and m3 air. |
|
The latest version was a CLI upgrade and is done in the background whenever you open the GUI. You can check if it works by opening the terminal and running |
I just did battery charging off, it works on my M1 Max and m3 air with the latest Tahoe. thanks!! |
|
v1.3.0-preview.1 works well for me on a M4 MacBook Air with Tahoe 26.0.1 installed. both with the Magsafe cable and USB C Thanks for updating the app :) |
Thanks a lot! I am a huge noob, but I was able to get this done, and now it works fine! :) |
Support Tahoe SMC keys with existing smc binary

Hi! As issues #382 and #384 reports, the app stopped working after the firmware update by macOS 26 and 15.7.1. This pull requests added new logic to the
battery.shthat detects whether the machine supports the new smc keys, then it uses the existing smc binary to read/write the value.I only verified the
battery.shon my macOS 15.7.1. The charging stops around the target percentageand resumes once it drops below.