ubuntu 下安装thinkpad硬盘保护APS、电池阀控制详解
?
《簡易流程》
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-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/
*************************************
當安裝了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
----------------------------------------
當安裝好后,grub中就應該有新的選項了。
## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false
## ## End Default Options #
如果沒有,請在此處手動添加如下代碼:
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
--------------------------------------------
并且執行以下代碼
sudo rmmod hdaps
sudo modprobe -a tp_smapi hdaps
sudo udevtrigger
--------------------------------------------
修改文件
sudo vim /etc/default/hdapsd
將hda改成sda。
--------------------------------------------
重啟電腦,這個時候,硬盤保護系統就應該裝好了
檢測如下:
dmesg | grep hdaps
你應該看到的信息是:
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.
這里可能會有些不同,但一定要看到第一行和最后一行。
--------------------------------------------
另外一個是雖然和hdapsd重復,但是我建議你還是做了的好:
gcc -o hdapsd hdapsd-*.c
sudo cp hdapsd /usr/local/sbin/
通過輸入hdapsd -d sda -s 15 來看看是否運行。
-------------------------------------------
重啟電腦
然后輸入:
dmesg | grep protect
如果你能看到parked的詞語,說明硬盤防震已經開始工作了。恭喜你安裝成功。
------------------------------------------
再來看gnome-hdaps-applet,這是一個桌面顯示時時狀態的。
安裝如下:
$ 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是錯誤的)
這樣你就算安裝成功了,在面板上添加附件能看到hdapsd的圖標。
-------------------------------------------
tp_smapi里面帶了給電池充電的閥門軟件,所以你只需要作很小的配置即可:
這個模塊主要是電池相關功能的設置
需要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中, 每次開機就ok了
-------------------------------------------
下面再增加在屏幕上顯示音量變化和亮度變化,和win一致。用到的軟件是tpb
直接apt-get就可以了
然后配置tbprc
------------------------
配置~/.tpbrc或/etc/tpbrc,以下設置僅作參考 代碼:
# 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
?
?
?
總結
以上是生活随笔為你收集整理的ubuntu 下安装thinkpad硬盘保护APS、电池阀控制详解的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 当IE浏览器设置了代理,改变不了的时候,
- 下一篇: ubuntu18.04安装pycharm