惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - Edward Xie

(转)听微软大牛们谈怎样成为优秀的工程师 - Edward Xie 深入探讨数据库可用性分组 google的搜索 4 fun 从‘和少妇成功上床’学习‘金融学’(转) osi tcpip (转)Google Wave从入门到进阶 google wave Nehalem thinkpad bios - Edward Xie good - Edward Xie 冒泡 .net 关于DotNET的整理 幽默 思考 想整这么一套 找个地放哈备忘 - Edward Xie UBUNTU游戏集合 mount 中文man(转) - Edward Xie 个人收集的一些ubuntu资料 (转)aptitude
APS in Linux for Lenovo R61i
Edward Xie · 2008-11-01 · via 博客园 - Edward Xie

原文删除

问题已解决,下载编译一个内核模块即可。

hdaps   +    tp_smapi-(0.3x我使用0.39)

tp smapi下载
http://sourceforge.net/project/showfiles.php?group_id=1212&package_id=171579

以下转载自ThinkWiki 

Installation on older Ubuntu/Debian

Installation on Ubuntu or Debian is quite easy, but there are a few things to look after:

To get your system ready for compiling code, install the build-essentials (as root, of course, as all of the following comands; Ubuntu users have to prepend 'sudo' to every line and enter their own password when prompted):

apt-get install build-essential

To get tp_smapi to work, obtain the latest source as mentioned above and unpack it. If you want to use HDAPS, you need to install the kernel source matching te kernel you are running. To do so, issue this:

uname -r

This will give you the version of your current kernel. Debian users execute the following:

apt-get install linux-source-`uname -r`

Ubuntu users execute the following using the kernel-version only (exclude -XX-generic; e.g. 'linux-source-2.6.20'):

apt-get install linux-source-`uname -r`

Be sure to unpack the source file. The easiest way is to open Nautilus as root:

sudo nautilus

Then browse to /usr/src/ and extract the source file to that directory.

Now change to the tp_smapi dir:

cd tp_smapi-X.YY
(X.YY being the version-number of tp_smapi)

and make and install tp_smapi as instructed above.

If you get an error that the kernel version isn't matching (or that you need to set KSRC/KBUILD), please check that there is a symlink from the modules dir to the kernel source:

root@localhost:~#ls -l /lib/modules/2.6.20-16-generic
lrwxrwxrwx 1 root root 28 2007-02-02 08:39 source -> /usr/src/linux-source-2.6.20

Create the link if the line above is not existent:

root@localhost:~#ln -s /usr/src/linux-source-2.6.20 /lib/modules/2.6.20-16-generic/source

Now the following will build and install the correct modules to their locations:

make install HDAPS=1

To make sure your system loads the modules at boot time, do this:

echo "tp_smapi" >> /etc/modules
echo "hdaps" >> /etc/modules

and update your initramfs:

update-initramfs -u

To get tp_smapi running now, just load the modules:

modprobe -a tp_smapi hdaps

This description was tested on Kubuntu 'Feisty Fawn' and should work on all Debian-based distros with minor tweaks.

EDIT: Works on Kubuntu 7.10 ("Gutsy Gibbon"), too

Battery charge control features

To set the thresholds for starting and stopping battery charging (in percent of current full charge capacity):

# 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

Hint:

Battery charging thresholds can be used to keep Li-Ion ad Li-Polymer batteries partially charged, in order to increase their lifetime.

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

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

Hint:

Charge inhibiting can be used to reduce the power draw of the laptop, in order to use an under-spec power supply that can't handle the combined power draw of running and charging. It can also be used to control which battery is charged when using an Ultrabay battery.

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

Hint:

To cancel forced discharge:

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

Installation from source

You will need the kernel headers and makefiles corresponding to your current kernel version. 

On Fedora Core, this means# yum install kernel-devel-$(uname -r) .

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


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

Ubuntu 8.04.1 comes with tp_smapi and hdaps_ec (the renamed hdaps), 

so we do not need to install these modules. However, to enable the active protection system (hard disk parking), 

we need to do something more.


Installing daemon and utilities:

$ sudo apt-get install hdapsd hdaps-utils

Adjust the configuration daemon for your hard disk device:


$ sudo vim /etc/default/hdapsd

For IDE:
DISK="hda"
For SATA:
DISK="sda"

Add the necessary modules in the list that is loaded after boot:


$ echo tp_smapi | sudo tee -a /etc/modules
$ echo hdaps_ec | sudo tee -a /etc/modules

Preparation
Installation of tools for compiling and creating a working 'thinkpad' components:


$ sudo apt-get install linux-kernel-devel fakeroot build-essential
mkdir ~/thinkpad

Obtaining resources for compiling the kernel and modules:


$ cd ~/thinkpad
$ sudo apt-get build-dep linux-image-$(uname -r)
$ apt-get source linux-image-$(uname -r)
$ sudo apt-get build-dep linux-ubuntu-modules-$(uname -r)
$ apt-get source linux-ubuntu-modules-$(uname -r)
$ sudo apt-get build-dep linux-restricted-modules-common
$ apt-get source linux-restricted-modules-common

Compile kernel
Getting the two patches for the 2.6.24 kernel:


$ cd ~/thinkpad
$ wget -c 'http://sourceforge.net/mailarchive/attachment.php?list_name=hdaps-devel&message_id=87hcjjedbn.fsf%40denkblock.local&counter=2' -O disk-protect.patch
$ wget -c 'http://sourceforge.net/mailarchive/attachment.php?list_name=hdaps-devel&message_id=87bq6l2ihm.fsf%40denkblock.local&counter=2' -O adjust-blocked-counters.patch

Applications patch, the change of name from generic to thinkpad, compiling and installing the kernel (CONCURRENCY_LEVEL parameter = 2 is only for the Core Duo processor):


$ cd ~/thinkpad/$(ls -1p ~/thinkpad | grep ^linux-2".6"..*/$)
$ patch -p1 -l < ../disk-protect.patch
$ patch -p1 -l < ../adjust-blocked-counters.patch
$ mv debian/config/i386/config.generic debian/config/i386/config.thinkpad && mv debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)i386/generic debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)i386/thinkpad && mv debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)i386/generic.modules debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)i386/thinkpad.modules && mv debian/config/amd64/config.generic debian/config/amd64/config.thinkpad && mv debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)amd64/generic debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)amd64/thinkpad && mv debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)amd64/generic.modules debian/abi/$(ls -1p debian/abi | grep ^2".6"..*/$)amd64/thinkpad.modules && mv debian/control debian/control.orig && sed s/-$(uname -r | sed 's/thinkpad/generic/')/-$(uname -r | sed 's/generic/thinkpad/')/ debian/control.orig > debian/control
CONCURRENCY_LEVEL=2 AUTOBUILD=1 NOEXTRAS=1 fakeroot debian/rules binary-debs flavours=thinkpad
$ sudo dpkg -i ~/thinkpad/$(ls -1 ~/thinkpad | grep ^linux-image-2".6"..*thinkpad.*".deb$)
$ sudo dpkg -i ~/thinkpad/$(ls -1 ~/thinkpad | grep ^linux-headers-2".6"..*thinkpad.*".deb$)

Modules
Change of name from generic to thinkpad, compiling and installing the modules (CONCURRENCY_LEVEL parameter = 2 is only for the Core Duo processor):


$ cd ~/thinkpad/$(ls -1p ~/thinkpad | grep ^linux-ubuntu-modules-2".6"..*/$)
$ mv debian/control debian/control.orig && sed s/-$(uname -r | sed 's/thinkpad/generic/')/-$(uname -r | sed 's/generic/thinkpad/')/ debian/control.orig > debian/control
CONCURRENCY_LEVEL=2 AUTOBUILD=1 fakeroot debian/rules binary-debs flavours=thinkpad
$ cd ~/thinkpad/$(ls -1p ~/thinkpad | grep ^linux-restricted-modules-2".6"..*/$)
$ mv debian/control.stub.in debian/control.stub.in.orig && sed s/-@@ABIVER@@-generic/-@@ABIVER@@-thinkpad/ debian/control.stub.in.orig > debian/control.stub.in && debian/rules debian/control
CONCURRENCY_LEVEL=2 AUTOBUILD=1 fakeroot debian/rules binary-debs flavours=$(uname -r | sed 's/generic/thinkpad/') ati_flavours=$(uname -r | sed 's/generic/thinkpad/') nv_flavours=$(uname -r | sed 's/generic/thinkpad/')
$ sudo dpkg -i ~/thinkpad/$(ls -1 ~/thinkpad | grep ^linux-ubuntu-modules-2".6"..*thinkpad.*".deb$)
$ sudo dpkg -i ~/thinkpad/$(ls -1 ~/thinkpad | grep ^linux-restricted-modules-2".6"..*thinkpad.*".deb$)

If you are using additional drivers under the Restricted (FGLRX, NVIDIA, etc.), the analogy is to install (as in the ~/thinkpad). In my case, I did not install these Restricted modules (my system do not need):


$ cd ~/thinkpad
$ ls -1 | grep ".deb$
$ sudo dpkg -i
.deb

Then, reboot with new kernel, '2.6.xx kernel-xx-thinkpad'

Test an accelerometer


$ hdaps-gl

If the detection of movement inverse, we need to put a parameter for hdaps_ec, e.g. 'hdaps_ec parameter invert = 1', in '/etc/modules'. More information and parameters are provied at

http://www.thinkwiki.org/wiki/Tp_smapi#HDAPS_axis_orientation

Install GNOME applet
This will show a status icon on a panel to indicate the active protection status:


$ sudo apt-get install libpanel-applet2-dev
$ mkdir -p ~/thinkpad/gnome-hdaps-applet
$ cd ~/thinkpad/gnome-hdaps-applet
$ wget -c http://www.zen24593.zen.co.uk/hdaps/gnome-hdaps-applet-20060120.tar.gz
$ tar -xzvf gnome-hdaps-applet-20060120.tar.gz
$ gcc $(pkg-config --cflags --libs libpanelapplet-2.0) -o gnome-hdaps-applet gnome-hdaps-applet.c
$ sudo cp gnome-hdaps-applet /usr/bin
$ sudo mkdir /usr/share/pixmaps/gnome-hdaps-applet/
$ sudo cp *.png /usr/share/pixmaps/gnome-hdaps-applet/
$ sudo cp GNOME_HDAPS_StatusApplet.server /usr/lib/bonobo/servers/

posted @ 2008-11-01 12:55  Edward Xie  阅读(943)  评论()    收藏  举报