Linux下安装tpacpi-bat 控制thinkpad 充电阈值

简介: thinkpad 使用tp_smapi (http://www.thinkwiki.org/wiki/Tp_smapi) 设置电池充电阈值, 此外tp_smapi 还附带了HDAPS(类似win下的硬盘保护).

但是 2013新出的几款Ivy Bridge 平台的thinkpad(X230,T430,T530), 已经无法使用tp_smapi了. 

tp_smapi 项目也有两年多没有更新 : https://github.com/evgeni/tp_smapi


虽然tp_smapi已经无法支持T430, 但是我们还有tpacpi-bat可以使用. 

安装过程:


(1) sudo yum install pmtools iasl

安装acpidump , iasl工具


(2) sudo acpidump -b -t DSDT -o /tmp/dsdt.aml

可能会返回Wrong checksum for FADT!错误, 忽略.

iasl -d /tmp/dsdt.aml

cat /tmp/dsdt.dsl | grep \\\\_SB\.PCI.*HKEY -o | uniq

记住输出的  T430上输出是"\_SB.PCI0.LPC.EC.HKEY"


(3) 下载acpi_call 代码并编译: https://github.com/mkottman/acpi_call
sudo make
sudo make install
sudo depmod -a
sudo modprobe acpi_call

载入acpi_call.ko之后,会多出一个 /proc/acpi/call "文件", 通过写入参数到这个文件, 实现与acpi_call的交互.   tpacpi-bat就是通过这种方式控制电池阈值. 当然也可以通过acpi_call控制独立显卡的关闭(双显卡的机型).


(4) 下载tpacpi_call解压: https://github.com/teleshoes/tpacpi-bat
需要编辑一下 vim  tpacpi-bat

修改 "my $aslBases = ..." 改为自己的, 例如:

my $aslBases = {
  'default'              => '\_SB.PCI0.LPC.EC.HKEY',
  'ThinkPad W520'        => '\_SB.PCI0.LPC.EC.HKEY',
  'ThinkPad T430'        => '\_SB.PCI0.LPC.EC.HKEY',
  'ThinkPad T430u'       => '\_SB.PCI0.LPCB.EC.HKEY',
};
然后把tpacpi-bat 移动到/usr/local/bin .



(5) 添加如下到开机脚本中, 比如/etc/rc.local

 
 
/usr/local/bin/tpacpi-bat -s ST 0 70
/usr/local/bin/tpacpi-bat -s SP 0 90

开机会通过tpacpi_call 向/proc/acpi/call 写入参数, 实现充电阈值的控制.






参考:

http://ubuntuforums.org/showthread.php?t=2148044
http://smitran.com/centos-6-thinkpad-t530-prolong-battery-life-with-tpacpi-bat/

http://blog.thekondor.net/2012/09/make-new-thinkpads-charge-thresholds.html

Linux下 Thinkpad 笔记本电池管理软件。 电池充电控制   设置开始与停止充电的阀值(百分比) # 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
笔记本的风扇控制 ---------------------------------------- 09 November 2006. Summary of changes for version 20061109: 1) ACPI CA Core Subsystem: Optimized the Load ASL operator in the case where the source operand is an operation region. Simply map the operation region memory, instead of performing a bytewise read. (Region must be of type SystemMemory, see below.) Fixed the Load ASL operator for the case where the source operand is a region field. A buffer object is also allowed as the source operand. BZ 480 Fixed a problem where the Load ASL operator allowed the source operand to be an operation region of any type. It is now restricted to regions of type SystemMemory, as per the ACPI specification. BZ 481 Additional cleanup and optimizations for the new Table Manager code. AcpiEnable will now fail if all of the required ACPI tables are not loaded (FADT, FACS, DSDT). BZ 477 Added #pragma pack(8/4) to acobject.h to ensure that the structures in this header are always compiled as aligned. The ACPI_OPERAND_OBJECT has been manually optimized to be aligned and will not work if it is byte-packed. Example Code and Data Size: These are the sizes for the OS- independent acpica.lib produced by the Microsoft Visual C++ 6.0 32- bit compiler. The debug version of the code includes the debug output trace mechanism and has a much larger code and data size. Previous Release: Non-Debug Version: 78.1K Code, 17.1K Data, 95.2K Total Debug Version: 155.4K Code, 63.1K Data, 218.5K Total Current Release: Non-Debug Version: 77.9K Code, 17.0K Data, 94.9K Total Debug Version: 155.2K Code, 63.1K Data, 218.3K Total 2) iASL Compiler/Disassembler and Tools: Fixed a problem where the presence of the _OSI predefined control method within complex expressions could cause an internal compiler error. AcpiExec: Implemented full region support for multiple address spaces. SpaceId is now part of the REGION object. BZ 429 ---------------------------------------- 11 Oc
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值