Sep
22
2010

Linux下ThinkPad电池管理软件tp_smapi

tp_smapi用于控制电池充电和提供额外的电池信 息。

参考页面:http://www.thinkwiki.org/wiki/Tp_smapi

Ubuntu集成这个软件自从Hardy以后的版本, 可以直接使用,无需安装。

Features

  • tp_smapi driver
    • Battery charge/discharge control
    • Battery status information
  • hdaps driver (compared with the standard hdaps driver)
    • Improved stability
    • Improved model support
    • Improved functionality

Project Homepage / Availability

Installation

Installation from source

You will need the kernel headers and makefiles corresponding to your current kernel version. On Fedora, this means # yum install kernel-devel-$(uname -r) .

# tar xzvf tp_smapi-0.40.tgz
# cd tp_smapi-0.40

Then, either compile and load the driver within the current working directory (for testing):

# make load

OR compile and install into the kernel’s module path:

# make install

If you use the HDAPS driver, add HDAPS=1 to also patch the hdaps for compatibility with tp_smapi (this requires a kernel source tree matching the current kernel). Again, either load the driver within the current working directory:

# make load HDAPS=1

OR install into the kernel’s module path:

# make install HDAPS=1

To prepare a stand-alone patch against the current kernel tree (including a patch against hdaps and new Kconfig entries):

# make patch

To delete all autogenerated files:

# make clean

The original kernel tree is never modified by any these commands. The /lib/modules directory is modified only by # make install.

电池充电控制

设置开始与停止充电的阀值(百分比)

# echo 40 > /sys/devices/platform/smapi/BAT0/start_charge_thresh
# echo 70 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh
# cat /sys/devices/platform/smapi/BAT0/*_charge_thresh

(表示低于40%时开始充电,高于70%就停止)

设置禁止充电时间

17分内防止充电到BAT0(首选电池):

# echo 17 > /sys/devices/platform/smapi/BAT0/inhibit_charge_minutes
Hint:
用于控制给那个电池充电当使用多个电池 Ultrabay battery.

取消禁止充电:

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

强制禁止充电(即使接AC):

# echo 1 > /sys/devices/platform/smapi/BAT0/force_discharge
Hint:
用于控制给那个电池充电当使用多个电池 Ultrabay battery.

取消强制禁止充电:

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

显示电 池状态信息

显示额外的电池状态,比如充电情况、电压、电流、容量、充电次数和型号信息:

# 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

Written by liuhongdan in: Linux | Tags: , ,

No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a comment

*

Theme: TheBuckmaker.com Wordpress Themes | Hosting Serendipity/a>, SqueezeCenter 7.3.3