ubuntu 下安装thinkpad硬盘保护APS、电池阀控制详解
?
《簡(jiǎn)易流程》
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
在這一步的時(shí)候可能會(huì)報(bào)錯(cuò),提示需要最新內(nèi)核之類的(即使你的已經(jīng)是最新的內(nèi)核),需要手動(dòng)修改 makefile文件,將
“KSRC ?=XXX”
的XXX部分設(shè)置成你當(dāng)前內(nèi)核的路徑 比如我自己的修改成了
“KSRC ?= /usr/src/linux-headers-2.6.28-11-generic/”,
然后就可以編譯了。
3. 添加到啟動(dòng)模塊
$echo "tp_smapi" >> /etc/modules
$echo "hdaps" >> /etc/modules
4. 更新initramfs
$update-initramfs -u
5. 模塊加載測(cè)試
$modprobe -a tp_smapi hdaps
這一步可能不能通過(guò),提示找不到“/lib/modules/XXXXX/kernel/drivers/hwmon”下的hdaps.ko,這時(shí)需要把 tp_smapi下的hdaps.ko拷貝到“/lib/modules/XXXXX/kernel/drivers/hwmon”下,然后再執(zhí)行?
“$modprobe -a tp_smapi hdaps”就可以了
6. 重新啟動(dòng)后安裝“hdaps-utils”和“hdapsd”,然后運(yùn)行“hdaps-gl”,晃動(dòng)你的小黑,應(yīng)該就能看到效果了。
7. 一定要使用tp_smapi自帶的hdaps.ko,內(nèi)核自帶的有問(wèn)題,無(wú)法識(shí)別T42的APS硬件模塊,需要把tp_smapi的hdaps.ko復(fù)制到/lib/modules/.../drivers/hwmon下。切記。
8. hdaps守護(hù)進(jìn)程hdapsd,用apt-get安裝的版本會(huì)有問(wèn)題,跑不起來(lái),因此需要下載源碼包重新編譯并安裝,即hdapsd-20090401.tar.gz
9. 監(jiān)控demo方面,建議使用thindhdaps-0.2,圖標(biāo)好看,而且很綠色,gnome-hdaps-applet那款安裝太麻煩,而且圖表不好看,自啟動(dòng)的話可以放在/etc/profile或/home/root/.profile里啟動(dòng)
10. 切記不要讓hdapsd以服務(wù)的方式加載,那樣x-window根本跑不起來(lái),將被堵在hdapsd的啟動(dòng)處,可以放在/etc/profile或/home/root/.profile里啟動(dòng)
下面相關(guān)資源需要下載并重新安裝:
??? * 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[硬盤(pán)防震]及電池閥門(mén)的全部過(guò)程[詳細(xì)] 2008年07月09日 星期三 下午 09:48 這次從新裝了8。04, 所以aps又要從新作一遍,不過(guò)因?yàn)槲野言撚玫降臇|西都保存了,所以比較簡(jiǎn)單,但是這里還是記錄一下全部信息,因?yàn)榭隙ㄒ灿泻推渌『谟脩粝M约旱臋C(jī)器能用上硬盤(pán)保護(hù)和電池充電閥門(mén)。
------------------------
首先,你所需要的是linux-headers-2.6.22-14的安裝,在8。04中,已經(jīng)沒(méi)有2。6。22了所以你需要在/etc/apt/source.list 中加入7。10的cn99的源,然后使用
sudo apt-get install linux-headers-2.6.22-14
接著,你將用到的所有的包如下:
在這里我說(shuō)明一下:你所需要的所有的包均可以到ftp.ubuntu.org.cn/home/casio1374633/linux_on_thinkpad/下載。用戶名是ubuntu 密碼是 ubuntuftp
為了方便,我建議你在/home/your_name/下建立APS/文件夾,然后把東西一次性都放進(jìn)去。
*************************************
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-image-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/
*************************************
當(dāng)安裝了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
----------------------------
接著輸入:
---------------------------------------
sudo dpkg -i /
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 /
linux-image-2.6.22-14-thinkpad_2.6.22-14.47_i386.deb
----------------------------------------
當(dāng)安裝好后,grub中就應(yīng)該有新的選項(xiàng)了。
## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false
## ## End Default Options #
如果沒(méi)有,請(qǐng)?jiān)诖颂幨謩?dòng)添加如下代碼:
title Thinkpad_8.04, kernel 2.6.22-14-thinkpad
root (hd0,7)
kernel /boot/vmlinuz-2.6.22-14-thinkpad root=UUID=230b9faf-4d2f-40bc-9ee0-0902ce63b191 ro quiet splash
initrd /boot/initrd.img-2.6.22-14-thinkpad
------------------------------------
從起以后,安裝tp_smapi模塊
--------------------------------------------
sudo dpkg -i tp-smapi-modules-2.6.22-14-thinkpad_0.34-1+2.6.22-14.47_i386.deb
sudo dpkg -i hdapsd_0.0.20070803-1_i386.deb
--------------------------------------------
并且執(zhí)行以下代碼
sudo rmmod hdaps
sudo modprobe -a tp_smapi hdaps
sudo udevtrigger
--------------------------------------------
修改文件
sudo vim /etc/default/hdapsd
將hda改成sda。
--------------------------------------------
重啟電腦,這個(gè)時(shí)候,硬盤(pán)保護(hù)系統(tǒng)就應(yīng)該裝好了
檢測(cè)如下:
dmesg | grep hdaps
你應(yīng)該看到的信息是:
hdaps: IBM ThinkPad T43 detected.
hdaps: initial latch check good (0x01).
hdaps: device successfully initialized.
input: hdaps as /class/input/input4
hdaps: driver successfully loaded.
這里可能會(huì)有些不同,但一定要看到第一行和最后一行。
--------------------------------------------
另外一個(gè)是雖然和hdapsd重復(fù),但是我建議你還是做了的好:
gcc -o hdapsd hdapsd-*.c
sudo cp hdapsd /usr/local/sbin/
通過(guò)輸入hdapsd -d sda -s 15 來(lái)看看是否運(yùn)行。
-------------------------------------------
重啟電腦
然后輸入:
dmesg | grep protect
如果你能看到parked的詞語(yǔ),說(shuō)明硬盤(pán)防震已經(jīng)開(kāi)始工作了。恭喜你安裝成功。
------------------------------------------
再來(lái)看gnome-hdaps-applet,這是一個(gè)桌面顯示時(shí)時(shí)狀態(tài)的。
安裝如下:
$ sudo install 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(注意:wiki上面只到bonobo是錯(cuò)誤的)
這樣你就算安裝成功了,在面板上添加附件能看到hdapsd的圖標(biāo)。
-------------------------------------------
tp_smapi里面帶了給電池充電的閥門(mén)軟件,所以你只需要作很小的配置即可:
這個(gè)模塊主要是電池相關(guān)功能的設(shè)置
需要root:
# 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
可以把頭兩行加入/etc/rc.local中, 每次開(kāi)機(jī)就ok了
-------------------------------------------
下面再增加在屏幕上顯示音量變化和亮度變化,和win一致。用到的軟件是tpb
直接apt-get就可以了
然后配置tbprc
------------------------
配置~/.tpbrc或/etc/tpbrc,以下設(shè)置僅作參考 代碼:
# 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、注意事項(xiàng)
i、如果使用gnome,需取消gnome快捷鍵的設(shè)置,否則會(huì)出現(xiàn)休眠待機(jī)兩次的情況,具體處理如下:
在你使用的用戶下執(zhí)行g(shù)conf-editor,將如下兩項(xiàng)的鍵值設(shè)為nothing
代碼:
/apps/gnome-power-manager/button/hibernate
/apps/gnome-power-manager/button/suspend
9、Shift+NumLk:數(shù)字鍵盤(pán)切換
建立~/.xmodmaprc文件
代碼:
clear mod2
keycode 77 = Num_Lock
add mod2 = Num_Lock
執(zhí)行# xmodmap ~/.xmodmaprc,然后按Shift+NumLk數(shù)字燈會(huì)亮,實(shí)現(xiàn)小數(shù)字鍵盤(pán)功能
要實(shí)現(xiàn)每次重啟后自動(dòng)生效,在~/.xintirc中添加:
代碼:
xmodmap ~/.xmodmaprc
?
?
?
總結(jié)
以上是生活随笔為你收集整理的ubuntu 下安装thinkpad硬盘保护APS、电池阀控制详解的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 当IE浏览器设置了代理,改变不了的时候,
- 下一篇: 信息安全保障人员CISAW--- 开班啦