Closed tunglamvghy closed 4 years ago
No need to do that, it's default feature in last version of OSX...
I found that there is an option in battery setting but my laptop still charge until reach 100%
I found in a linux forum Most newer Zenbooks supports specifying a charge stop threshold (see ASUS Battery Health Charging for more information).
The battery charge stop threshold can be set by modifying the EC registers, which can be done with acpi_call. Finding the correct EC register to modify, is the tricky part.
You can check the current threshold and battery percent, with the following commands:
$ read () { echo "${1}" > /proc/acpi/call; printf "%d\n" $(sed 's/\x0.*//g' /proc/acpi/call); } $ read "_SB.PCI0.LPCB.EC0.RRAM 0x3af" 100 # Percent at which the battery will stop charging (default is 100) $ read "_SB.PCI0.LPCB.EC0.RRAM 0x3b0" 80 # current battery percent, should match: cat /sys/class/power_supply/BAT0/capacity
Warning: Do not proceed if the commands do not return the expected values!
The threshold can be changed with the following command (the threshold is reset when the computer is power cycled):
$ echo "_SB.PCI0.LPCB.EC0.WRAM 0x3af <battery percent in hex, ex: 0x50 for 80%>" > /proc/acpi/call
The hex value can be found with printf "0x%x\n" 80.
To change the threshold at boot it is possible to use systemd-tmpfiles.
/etc/tmpfiles.d/battery.confw /proc/acpi/call - - - - \_SB.PCI0.LPCB.EC0.WRAM 0x3af 0x50 # 80%
I'll add support for this.
@tunglamvghy When the threshold is set to 80% and the battery is charged to 80%, does Windows report battery level as 100% or 80%?
@tunglamvghy When the threshold is set to 80% and the battery is charged to 80%, does Windows report battery level as 100% or 80%?
Trong Windows vẫn hiển thị là 80% và ngừng sạc. Trong MyAsus có 3 option là sạc đến 100%, 80% hoặc 60% là ngưng sạc.
In Windows still shows 80% and not charging. In MyASUS app, there are 3 options: charge until 100%, 80% or 60%.
Em biết anh là người Việt rồi mà do trên GitHub chủ yếu dùng tiếng Anh nên em vẫn ưu tiên tiếng Anh hơn để người nước ngoài đọc được :v Mà thôi anh đã dùng tiếng Việt nên em cũng thế luôn :v
Tạm thời em set cố định là 80% thì ngừng sạc. Anh có thể bật/tắt nó trong Battery Health. Version này em cũng thêm support fan speed. Anh check giúp xem nó có hoạt động ko (iStats).
Do em dùng API mới của VirtualSMC (chưa release) nên anh phải update luôn VirtualSMC.
Lilu-1.4.7-RELEASE.zip VirtualSMC-1.1.6-RELEASE.zip AsusSMC-1.4.0-DEBUG.zip AsusSMC-1.4.0-RELEASE.zip
Test ok với bản Debug nhé bác. Chạy ổn định 😁. Mặc dù pin còn hơn 80% cắm sạc là ngừng không sạc nữa. Đèn báo từ đỏ chuyển thành trắng luôn. Khi tắt trong Battery Health thì máy lại tiếp tục sạc, đèn báo chuyển thành đỏ. Dưới là ảnh lúc máy mới khởi động.
"This kext (debug version) ran successfully on my Hackintosh. Despite the battery was over 80%, my laptop stoped charging when I plugged it in. The battery indicator changed from red to white. If I turned off the option you told me in Battery Health, the battery indicator intermediately changed to red. My laptop continued charging. Here are some screenshots."
After changing from Debug to Release version, the kext doesn't work (still charging until full and not show fan speed). And I changed back to debug version, the battery threshold worked but fan speed doesn't work anymore. Update: Working again after reset NVRAM. 😅
Hi.
I use your new kext since you release it and no issue on my side (UX430 UAR). Battery level stop at 83%.
I hope you can port the feature to limit the percentage of charging at 80% like My Asus app in Windows.