通过代码更改电池充电状况 [英] Change battery charge condition through code

查看:96
本文介绍了通过代码更改电池充电状况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法只使用C#中的代码更改电池充电状态。

我在android中找到了一种方法,通过使用su命令,我想要在Windows中做同样的事情,但一直无法找到方法。

任何帮助都将不胜感激。

谢谢。



我尝试过:



I want to know if there is any way to change the battery charge condition only using code in C#.
I found a way to do this in android, by using a su command, and I want to do the same in windows, but haven't been able to find a way.
Any help will be greatly appreciated.
Thanks.

What I have tried:

public static PowerStatus power = SystemInformation.PowerStatus;



但这只给我收费百分比,并且不允许我改变收费状态。


But this only give me the charge percent, and doesn't allow me to change the charge status.

推荐答案

电池充电条件是什么意思?



系统报告的充电状态值是只读状态值。



如果您参考充电器使用的充电算法:

这需要访问充电器IC。系统具有使用驱动程序读取状态的访问权限。



因此您必须识别该驱动程序并检查它是否提供更改计费算法的功能。如果未提供此类功能,则可以使用低级总线接口(通常为I2C或SPI)来访问充电器IC(必须知道哪种类型)。对于某些充电器IC,充电算法不能通过命令选择,而是在输入引脚上硬编码。



最后a 警告

选择错误的充电参数可能会损坏电池甚至导致火灾或爆炸!
What do you mean by "battery charge condition"?

The charge status values reported by the system are read only status values.

If you refer to the charging algorithm used by the charger:
That requires access to the charger IC. The system has this access to read the status using a driver.

So you have to identify that driver and check if it provides functions to change the charging algorithm. If such functions are not provided, it might be possible to use the low level bus interface (usually I2C or SPI) to access the charger IC (which type must be know then). With some charger ICs the charging algorithm is not selectable by commands but hard coded on input pins.

Finally a WARNING:
Choosing the wrong charging parameters can damage the battery or even lead to fire or explosion!


这篇关于通过代码更改电池充电状况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆