《简易流程》


1. 首先可以去新利得里安装tp-smapi-source,也可以去http://packages.debian.org/zh-cn/sid/all/tp-smapi-source/download下载最新的0.40-3的DEB,然后安装,

2. 编译tp-smapi
$make HDAPS=1
$make install

在这一步的时候可能会报错,提示需要最新内核之类的(即使你的已经是最新的内核),需要手动修改 makefile文件,将
“KSRC ?=XXX”
的XXX部分设置成你当前内核的路径 比如我自己的修改成了
“KSRC ?= /usr/src/linux-headers-2.6.28-11-generic/”,
然后就可以编译了。

3. 添加到启动模块
$echo "tp_smapi" >> /etc/modules
$echo "hdaps" >> /etc/modules

4. 更新initramfs
$update-initramfs -u

5. 模块加载测试
$modprobe -a tp_smapi hdaps

这一步可能不能通过,提示找不到“/lib/modules/XXXXX/kernel/drivers/hwmon”下的hdaps.ko,这时需要把 tp_smapi下的hdaps.ko拷贝到“/lib/modules/XXXXX/kernel/drivers/hwmon”下,然后再执行

“$modprobe -a tp_smapi hdaps”就可以了

6. 重新启动后安装“hdaps-utils”和“hdapsd”,然后运行“hdaps-gl”,晃动你的小黑,应该就能看到效果了。

7. 一定要使用tp_smapi自带的hdaps.ko,内核自带的有问题,无法识别T42的APS硬件模块,需要把tp_smapi的hdaps.ko复制到/lib/modules/.../drivers/hwmon下。切记。

8. hdaps守护进程hdapsd,用apt-get安装的版本会有问题,跑不起来,因此需要下载源码包重新编译并安装,即hdapsd-20090401.tar.gz

9. 监控demo方面,建议使用thindhdaps-0.2,图标好看,而且很绿色,gnome-hdaps-applet那款安装太麻烦,而且图表不好看,自启动的话可以放在/etc/profile或/home/root/.profile里启动

10. 切记不要让hdapsd以服务的方式加载,那样x-window根本跑不起来,将被堵在hdapsd的启动处,可以放在/etc/profile或/home/root/.profile里启动

下面相关资源需要下载并重新安装:
    * tp_smapi-0.4 from here: http://sourceforge.net/project/showfiles.php?group_id=1212&package_id=171579
    * hdapsd-20090401.tar.gz from here: http://sourceforge.net/project/showfiles.php?group_id=138242&package_id=308030
    * thinkhdaps-0.2.tar.gz from here: http://web.student.tuwien.ac.at/~e0726415/thinkhdaps.html


《另一篇相关文献》

ubuntu8.04下为thinkpad 安装 APS[硬盘防震]及电池阀门的全部过程[详细]
2008年07月09日 星期三 下午 09:48
这次从新装了8。04, 所以aps又要从新作一遍,不过因为我把该用到的东西都保存了,所以比较简单,但是这里还是记录一下全部信息,因为肯定也有和其他小黑用户希望自己的机器能用上硬盘保护和电池充电阀门。

------------------------

首先,你所需要的是linux-headers-2.6.22-14的安装,在8。04中,已经没有2。6。22了所以你需要在/etc/apt/source.list 中加入7。10的cn99的源,然后使用

sudo apt-get install linux-headers-2.6.22-14


接着,你将用到的所有的包如下:

在这里我说明一下:你所需要的所有的包均可以到ftp.ubuntu.org.cn/home/casio1374633/linux_on_thinkpad/下载。用户名是ubuntu 密码是 ubuntuftp
为了方便,我建议你在/home/your_name/下建立APS/文件夹,然后把东西一次性都放进去。
*************************************
hdapsd_0.0.20070803-1_i386.deb
hdapsd-20070524.c
linux-headers-2.6.22-14-thinkpad_2.6.22-14.47_i386.deb
linux-p_w_picpath-2.6.22-14-thinkpad_2.6.22-14.47_i386.deb
linux-restricted-modules-2.6.22-14-thinkpad_2.6.22.4-14.10_i386.deb
linux-ubuntu-modules-2.6.22-14-thinkpad_2.6.22-14.37_i386.deb

tp_smapi
tp-smapi-modules-2.6.22-14-thinkpad_0.34-1+2.6.22-14.47_i386.deb
tp-smapi-source_0.34-1_all.deb
gnome-hdaps-applet/
*************************************
当安装了headers-2.6.22-14以后,你就可以安装linux-headers-2.6.22-14-thinkpad_2.6.22-14.47_i386.deb了。

----------------------------
sudo dpkg -i linux-headers-2.6.22-14-thinkpad_2.6.22-14.47_i386.deb
----------------------------

接着输入:

---------------------------------------
 
   
 
代码:

# Use OSS mixer to change volume and for mute/unmute. This should be use on
# models with no hardware mixer (volume and mute buttons show no effect). R31
# is reported to have no hardware mixer. To use this you must enable write
# access to the NVRAM device (possibly dangerous). Possible values are on and
# off. Default is off.
#
MIXER ON

## MIXERSTEPS
# Defines how much steps should be available when using the OSS mixer. Default
# is 14. If an other number of steps is used, tpb needs write access to the
# nvram device.
#
#MIXERSTEPS 14

## MIXERDEVICE
# Defines the mixer device to use for OSS mixer support. Default is /dev/mixer.
#
#MIXERDEVICE /dev/mixer


### POWERMANAGEMENT SETTINGS

## APM
# Some ThinkPads generate mouse and keyboard events or have a high CPU load when
# polling /proc/apm. You may enable this, if you want the AC connected/AC
# disconnected messages. Default is off.
#
#APM OFF

## POWERMGT
# The program apmiser (part of tpctl package) switches the power management
# mode according to the needs of the user. This results in lots of changes
# displayed in OSD. To avoid this, the power management messages can be turned
# off. Default is auto.
#
#POWERMGT AUTO


### X11 SETTINGS

## XEVENTS
# Some of the special keys generate X11 events instead of changing the nvram. TPB
# is able to grab those keys and run an application. However some people like to
# use the X11 events through xmodmap or the like. This option turns off the
# grabbing of the events. Affected keys are HOME, SEARCH, MAIL, FAVORITES,
# RELOAD, ABORT, BACKWARD, FORWARD and FN. Default is on.
#
#XEVENTS OFF


### ON-SCREEN DISPLAY SETTINGS

## OSD
# Global switch for showing on-screen display for volume, mute and brightness.
# Possible values are on and off. Default is on.
#
#OSD ON

## OSDZOOM
# Specific switch for showing on-screen display for zoom button.
# Possible values are on and off. Default is unset, follows the OSD option.
#
#OSDZOOM OFF

## OSDTHINKLIGHT
# Specific switch for showing on-screen display for thinklight button.
# Possible values are on and off. Default is unset, follows the OSD option.
#
#OSDTHINKLIGHT OFF

## OSDDISPLAY
# Specific switch for showing on-screen display for display output button.
# Possible values are on and off. Default is unset, follows the OSD option.
#
#OSDDISPLAY OFF

## OSDHVEXPANSIOFF
# Specific switch for showing on-screen display for HV expansion button.
# Possible values are on and off. Default is unset, follows the OSD option.
#
#OSDHVEXPANSION OFF

## OSDBRIGHTNESS
# Specific switch for showing on-screen display for brightness buttons.
# Possible values are on and off. Default is unset, follows the OSD option.
#
#OSDBRIGHTNESS OFF

## OSDVOLUME
# Specific switch for showing on-screen display for ivolume and mute buttons.
# Possible values are on and off. Default is unset, follows the OSD option.
#
#OSDVOLUME OFF

## OSDPOWERMGT
# Specific switch for showing on-screen display for ipower management changes.
# Possible values are on and off. Default is unset, follows the OSD option.
#
#OSDPOWERMGT OFF

## OSDFONT
# Defines the font for the on-screen display. You may use "xfontsel" to choose
# one. Default is the default font of the xosd library.
#
#OSDFONT -*-lucidatypewriter-*-*-*-*-*-240-*-*-*-*-*-*
OSDFONT -adobe-helvetica-*-r-*-*-12-*-*-*-*-*-iso10646-1


## OSDCOLOR
# Defines the color of the on-screen display. You may use "xcolors" to choose
# one. Default is BLUE.
#
OSDCOLOR Blue

## OSDTIMEOUT
# Defines how long (in seconds) the on-screen display is shown after the last
# keys was pressed. Default is 3.
#
#OSDTIMEOUT 3

## OSDOFFSET
# For backward compatibility. Same as OSDVERTICAL.
#
OSDOFFSET 25

## OSDSHADOW
# Defines the offset of the font shadow in pixels. Default is 2.
#
OSDSHADOW 0

## OSDSHADOWCOLOR
# Defines the color of the shadow of the on-screen display. You may use
# "xcolors" to choose one. Default is BLACK.
#
#OSDSHADOWCOLOR BLACK

## OSDOUTLINE
# Defines the width of the font outline in pixels. Default is 1.
#
OSDOUTLINE 0

## OSDOUTLINECOLOR
# Defines the color of the outline of the on-screen display. You may use
# "xcolors" to choose one. Default is BLACK.
#
#OSDOUTLINECOLOR BLACK

## OSDVERTICAL
# Defines the offset from the top or bottom of the screen in pixels. Default is 25.
#
OSDVERTICAL 50

## OSDHORIZONTAL
# Defines the offset from the left or right of the screen in pixels. Only
# supported by xosd 2.0.0 and above. Default is 25.
#
OSDHORIZONTAL 100

## OSDPOS
# Defines where the osd is shown. Possible values are top, middle and bottom.
# The value middle is only supported by xosd 2.0.0 and above. Default is bottom.
#
OSDPOS bottom

## OSDALIGN
# Defines the alignment of the osd. Possible values are left, center and right.
# Default is left.
#
#OSDALIGN LEFT
7、注意事项
i、如果使用gnome,需取消gnome快捷键的设置,否则会出现休眠待机两次的情况,具体处理如下:

在你使用的用户下执行gconf-editor,将如下两项的键值设为nothing
代码:

/apps/gnome-power-manager/button/hibernate
/apps/gnome-power-manager/button/suspend

9、Shift+NumLk:数字键盘切换
建立~/.xmodmaprc文件
代码:

clear mod2
keycode 77 = Num_Lock
add mod2 = Num_Lock
执行# xmodmap ~/.xmodmaprc,然后按Shift+NumLk数字灯会亮,实现小数字键盘功能
要实现每次重启后自动生效,在~/.xintirc中添加:
代码:

xmodmap ~/.xmodmaprc