APS in Linux for Lenovo R61i
原文刪除
問題已解決,下載編譯一個內核模塊即可。
hdaps ? + ? ?tp_smapi-(0.3x我使用0.39)
tp smapi下載
http://sourceforge.net/project/showfiles.php?group_id=1212&package_id=171579
以下轉載自ThinkWiki?
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-essentialTo 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 -rThis 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 nautilusThen 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-genericlrwxrwxrwx 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/sourceNow the following will build and install the correct modules to their locations:
make install HDAPS=1To make sure your system loads the modules at boot time, do this:
echo "tp_smapi" >> /etc/modulesecho "hdaps" >> /etc/modules
and update your initramfs:
update-initramfs -uTo get tp_smapi running now, just load the modules:
modprobe -a tp_smapi hdapsThis 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):
To prevent charging for 17 minutes (regardless of thresholds):
To cancel charging preventation:
To force battery discharging (even if connected to AC):
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):
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=1OR install into the kernel's module path:
# make install HDAPS=1Ubuntu 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/
轉載于:https://www.cnblogs.com/nniixl/archive/2008/11/01/1324208.html
總結
以上是生活随笔為你收集整理的APS in Linux for Lenovo R61i的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 自动生成二维码
- 下一篇: linux 其他常用命令