今天收到国美寄来的E430,进行充电,充到27.6%就再也充不进去了,linux系统的

今天收到国美寄来的E430,进行充电,充到27.6%就再也充不进去了,linux系统的,第1张

尊敬的用户您好:此现象为Thinkpad在linux(ubuntu)的电池充电阈值问题,与笔记本电脑无关。下面处理方法仅供参考,建议您使用windows系统。

安装tp-smapi:

# aptitude install tp-smapi-dkms

# modprobe tp_smapi

更改充电阈值:

设置开始充电阈值,如从“60%”开始充电:

# echo 60 >/sys/devices/platform/smapi/BAT0/start_charge_thresh

设置停止充电阈值,如到“100%”停止充电:

# echo 100 >/sys/devices/platform/smapi/BAT0/stop_charge_thresh

查看充电阈值:

# cat /sys/devices/platform/smapi/BAT0/*_charge_thresh

其他:

To prevent charging for 17 minutes (regardless of thresholds):

# echo 17 >/sys/devices/platform/smapi/BAT0/inhibit_charge_minutes

To cancel charging preventation:

# echo 0 >/sys/devices/platform/smapi/BAT0/inhibit_charge_minutes

To force battery discharging (even if connected to AC):

# echo 1 >/sys/devices/platform/smapi/BAT0/force_discharge

To cancel forced discharge:

# echo 0 >/sys/devices/platform/smapi/BAT0/force_discharge

让设置在启动时生效(只用同一块电池):

It is not necessary to create your own init.d script or modify /etc/rc.local - you just need the package sysfsutils:

# apt-get install sysfsutils

# sudo gedit /etc/sysfs.conf

把下面的放在文件 /etc/sysfs.conf后面:

# cat >>/etc/sysfs.conf <<EOF

# For a LiIon battery in a Thinkpad

devices/platform/smapi/BAT0/start_charge_thresh = 50

devices/platform/smapi/BAT0/stop_charge_thresh = 80

EOF

The init script supplied by sysfsutils will load these settings on each boot.

其他电池状态信息:

To view extended battery status such as charging state, voltage, current, capacity, cycle count and model information:

# cat /sys/devices/platform/smapi/BAT0/installed

# cat /sys/devices/platform/smapi/BAT0/state # idle/charging/discharging

# cat /sys/devices/platform/smapi/BAT0/cycle_count

# cat /sys/devices/platform/smapi/BAT0/current_now # instantaneous current

# cat /sys/devices/platform/smapi/BAT0/current_avg # last minute average

# cat /sys/devices/platform/smapi/BAT0/power_now # instantaneous power

# cat /sys/devices/platform/smapi/BAT0/power_avg # last minute average

# cat /sys/devices/platform/smapi/BAT0/last_full_capacity

# cat /sys/devices/platform/smapi/BAT0/remaining_percent

# cat /sys/devices/platform/smapi/BAT0/remaining_running_time

# cat /sys/devices/platform/smapi/BAT0/remaining_charging_time

# cat /sys/devices/platform/smapi/BAT0/remaining_capacity

# cat /sys/devices/platform/smapi/BAT0/design_capacity

# cat /sys/devices/platform/smapi/BAT0/voltage

# cat /sys/devices/platform/smapi/BAT0/design_voltage

# cat /sys/devices/platform/smapi/BAT0/manufacturer

# cat /sys/devices/platform/smapi/BAT0/model

# cat /sys/devices/platform/smapi/BAT0/barcoding

# cat /sys/devices/platform/smapi/BAT0/chemistry

# cat /sys/devices/platform/smapi/BAT0/serial

# cat /sys/devices/platform/smapi/BAT0/manufacture_date

# cat /sys/devices/platform/smapi/BAT0/first_use_date

# cat /sys/devices/platform/smapi/BAT0/temperature # in milli-Celsius

# cat /sys/devices/platform/smapi/ac_connected

The raw status data is also available, including some fields not listed above (in case you can figure them out):

# cat /sys/devices/platform/smapi/BAT0/dump

这个问题我解决过哦。

用P/Invoke调 API:kernel32.dll中的GetSystemPowerStatus函数。函数返回系统的电源状态。状态指数系统是在直流电源还是交流电源下运作,电池是否在充电,电池的剩余电量。

先定义结构体:

[StructLayout(LayoutKind.Sequential)]

public struct SYSTEM_POWER_STATUS

{

public byte ACLineStatus

public byte BatteryFlag

public byte BatteryLifePercent

public byte Reserved1

public int BatteryLifeTime

public int BatteryFullLifeTime

}

然后导入外部函数:

[DllImport("kernel32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]

public static extern bool GetSystemPowerStatus(ref SYSTEM_POWER_STATUS systemPowerStatus)

如果调用成功,返回 true,然后分析systemPowerStatus的数据就行。

ACLineStatus为1时,表示正在使用交流电源,为0使用直流电源。

希望能够帮到你。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/7321679.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-04
下一篇 2023-04-04

发表评论

登录后才能评论

评论列表(0条)

保存