Code Monkey home page Code Monkey logo

Comments (16)

kbios avatar kbios commented on July 24, 2024 1

Wow that's so cool! Manufacturers sure know how to make things interesting 😂

from acc.

kbios avatar kbios commented on July 24, 2024 1

Just to make things more fun I found out that if current_cmd is toggled on while the device is not plugged in, the battery will report "charging". Yes really -_-

from acc.

VR-25 avatar VR-25 commented on July 24, 2024

A while ago, I came across /proc/mtk_battery_cmd/current_cmd "0 0" "0 1". Is that your switch as well?

ACC is undergoing major changes. As part of these, several config variables are now arrays (e.g., chargingSwitch=(/proc/mtk_battery_cmd/current_cmd "0 0" "0 1")).

If you want to try experimental builds, message me on https://t.me/vr25xda (preferred), https://fb.me/vr25xda or https://m.me/vr25xda .

Thanks!

from acc.

kbios avatar kbios commented on July 24, 2024

Yep, that's the switch (btw it's a Blackview 9600 Pro).
One unrelated thing I've noticed is that toggling it stops charging but keeps the battery at that level, while to make it actually discharge I need to toggle en_power_path as well.
As for trying the experimental builds, thanks a lot for the offer, but unfortunately I cannot tinker much with this device as it is the primary phone of a friend :(

from acc.

VR-25 avatar VR-25 commented on July 24, 2024

I can't get enough of Mediatek's "nice" surprises. Holly nuts!

Could you elaborate more on en_power_path? I can make acc toggle it.

from acc.

kbios avatar kbios commented on July 24, 2024

So /proc/mtk_battery_cmd/en_power_path is normally 1, when set to 0 it stops charging and also begins discharging but there is a catch: the battery status always remains "charging" , so acc doesn't work.
To get the complete behaviour (battery stops charging, starts discharging and reports the correct status) one has to toggle both en_power_path and current_cmd.

from acc.

VR-25 avatar VR-25 commented on July 24, 2024

Interesting and Intriguing!
This will give birth to a new feature: toggling multiple switches at once.

from acc.

VR-25 avatar VR-25 commented on July 24, 2024

Terrible Design!

Lets say the device is plugged in and charging. After charging is disabled (i.e., through toggling the 2 switches), is it enabled automatically on replug, without toggling the switches back?

Were you able to find any file that reports the correct external power supply status (i.e., plugged/unplugged)?
Still on this question, does su -c acpi -a do that?

from acc.

kbios avatar kbios commented on July 24, 2024

Sorry for the delay, I managed to get some time with the phone to run the tests. The results are braindead haha

  • Once one touches current_cmd it becomes fully manual, ie the phone won't charge when plugged in unless the switch is toggled
  • acpi -a reports two adapters, "Adapter 0" seems to reliably indicate whether the phone is plugged in while "Adapter 1" is always "Off-line"

from acc.

VR-25 avatar VR-25 commented on July 24, 2024

Finally, at least one pleasant surprise... hopefully! 😁

If acpi -a really reports the correct external power supply status (plugged/unplugged), regardless of whether switches were toggled, we have a winner.

From acpi -a and battery/status's data combination, we have three basic battery statuses:

  • Plugged in and charging (at least one adapter online AND battery/status == "charging")
  • Plugged in, but not charging (at least one adapter online AND battery/status == "discharging|not charging")
  • Unplugged and discharging (all adapters offline)

I just finished implementing and testing the "multiple switches toggling" feature. It's ready for third-party testing. I'm in touch with another MTK user - who will be testing the real deal.

from acc.

kbios avatar kbios commented on July 24, 2024

That's great! So to ensure that the braindead status "unplugged but charging" never happens I guess acc will have to toggle the switches when it detects an unplug haha

from acc.

VR-25 avatar VR-25 commented on July 24, 2024

Thou Shalt Go Mad.
MediaTek Inc.

from acc.

VR-25 avatar VR-25 commented on July 24, 2024

I implemented everything we discussed so far.
Even though this is a pre-release, the daemon is pretty much stable at this point.

https://www.dropbox.com/s/cdfok5fek2g5z5f/acc-202001180.zip?dl=0

Notes

  • Don't use acc -s|--set for editing the config. It's not ready yet. Use acc -c|--config EDITOR OPTS instead (e.g., acc -c vim). If you run just acc -c, the fallback editors are nano -l > vim > vi. You can always edit /data/adb/acc-data/config.txt with any other means.

  • Apparently, MTK requires a [slightly] longer delay after toggling the switches - for changes to take effect. ACC has the config variable switchDelay (default: 1 second). You may want to increase that before performing any testing - and play with it along the way. This is because, in auto mode (chargingSwitch unset), switch_cycle() is in charge. After switchDelay, it resets switches which don't work. That's where the default delay can be an issue. switchDelay=10 is a good starting point.

  • If you don't want to play with switchDelay right now, set chargingSwitch=(/proc/mtk_battery_cmd/current_cmd "0 0" "0 1" /proc/mtk_battery_cmd/en_power_path 1 0) and test whether acc -d disables charging - and acc -e re-enables it. This is the manual/daemon-less mode.

  • The documentation is not fully updated yet. At this point, besides switchDelay and chargingSwitch[@], the only other values you have to care about are capacity[2] (resume, default: 75) and capacity[3] (stop, default: 80).

from acc.

kbios avatar kbios commented on July 24, 2024

Wow that's great! I can't wait to try it, as soon as I see my friend I'll try and report back

from acc.

kbios avatar kbios commented on July 24, 2024

So I finally got the chance to test (sorry for the delay!), but I'm running into a weird problem: I flashed the zip with magisk but apparently it gets installed into /sbin/.magisk/modules/acc/ but not into /sbin/.acc/, and this prevents it from starting... if i try manually I get like

Blackview:/ # /sbin/.magisk/modules/acc/acc.sh                                                                                                                   

/sbin/.magisk/modules/acc/acc.sh[466]: .: /sbin/.acc/acc/setup-busybox.sh: No such file or directory

I'm probably missing something obvious sorry

from acc.

VR-25 avatar VR-25 commented on July 24, 2024

@kbios, the repo is up-to-date.
Dowload the latest version: https://GitHub.com/VR-25/ACC/archive/dev.zip .
Extract the zip and run the following to install:
$ su
# sh /path/to/extracted/install-current.sh

from acc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.