Linux · 2012-04-25

thinkpad在 Ubuntu 安装APS和电源管理

原文: http://www.thinkwiki.org/wiki/Installing_Ubuntu_11.10_(Oineric_Ocelot)_on_a_ThinkPad_T410 This article describes the installation of Ubuntu 11.10 (64 bit) on a Thinkpad T410 type 2537-9UG (NVIDIA NVS 3100M). This guide assumes that NVIDIA Optimus is disabled in BIOS (Graphics set to “discrete”)!

Contents

[hide]

Hardware Support Details

Works out-of-the-box

  • Ethernet
  • Audio
  • DVD burner
  • Card reader
  • Webcam
  • WLAN
  • Bluetooth
  • DisplayPort (tested with HDMI-TV)

Works with additional configuration

  • Display brightness with NVIDIA
  • HDAPS
  • Docking station (Details soon)

 

Untested

  • FireWire
  • Fingerprint
  • NVIDIA Optimus

The remaining devices are currently not tested.

Display brightness with NVIDIA

Use the following parameter in the “Device”-section of /etc/X11/xorg.conf:

Option "RegistryDwords" "EnableBrightnessControl=1"

HDAPS (Hard Drive Active Protection System)

You need the ThinkPad SMAPI and the hdaps-daemon, install them by following command:

sudo apt-get install tp-smapi-dkms hdapsd

Edit /etc/default/hdapsd with root privileges:

START=yes         # hdaps should be started automatically
DISK=sda          # normally sda should fit
SENSITIVITY=15    # higher values mean lesser sensitivity
FORCEENABLE="no"  # force hdaps, not needed
OPTIONS=""        # additional options, not needed

Restart the daemon:

sudo /etc/init.d/hdapsd restart

Testing (stop daemon and start in foreground):

sudo /etc/init.d/hdapsd stop
sudo hdapsd -d sda -s 15

If you shake your T410 gently the output should look like:

sven@T410:~$ sudo hdapsd -d sda -s 15
Tue Nov 15 13:25:25 2011: Starting hdapsd
Tue Nov 15 13:25:25 2011: Selected interface: HDAPS
Tue Nov 15 13:25:25 2011: Selected HDAPS input device: /dev/input/event9
Tue Nov 15 13:25:28 2011: parking
Tue Nov 15 13:25:29 2011: un-parking

If test was succesful start daemon again:

sudo /etc/init.d/hdapsd start

Docking station (tested with Lenovo Mini Dock Series 3)

  • Per hardware design the DisplayPort and DVI connector of the Mini Dock Series 3 are only usable with NVIDIA NVS 3100M
  • If you want your boot screen on an external display in T410 BIOS set Graphics to “discrete” and boot screen to what you desire
  • My T410 always showed the login screen on the internal LCD, for a workaround see “Workarounds” section
  • To avoid conflicts with Unity I suggest using two different xorg.conf (see “Workarounds” section)

Workarounds

For setting various boot-time options I use Ubuntu’s /etc/rc.local file (paste them before “exit 0” line!):

# T410 Workarounds

# choose xorg.conf
DOCKED="`lsusb | grep "Lenovo ThinkPad Mini Dock Plus Series 3" | wc -l`"
if [ $DOCKED -eq "1" ]
        then
                cp /etc/X11/xorg.conf-docking /etc/X11/xorg.conf
        else
                cp /etc/X11/xorg.conf-nodocking /etc/X11/xorg.conf
fi

# enable/disable bluetooth at startup
echo 0 > /sys/devices/platform/thinkpad_acpi/bluetooth_enable

# enable/disable wwan at startup
echo 0 > /sys/devices/platform/thinkpad_acpi/wwan_enable

The above file allows you to specify a xorg.conf for docked-state of your T410 and for undocked state. If you have trouble creating them use the “NVIDIA X Server Settings Tool” shipped with the NVIDIA driver. You can disable or enable bluetooth and wwan by echoing 0/1 to the interfaces. Technical explanation:

  • For unknown reasons in 11.10 neither /sys/devices/platform/dock.0/ nor /sys/devices/platform/dock.1/ refers to the attached “Lenovo Mini Dock Series 3”, so I had to use the lsusb-approach to check for presence of the docking station. Worked fine for me.

 

电源部分:

Thinkpad的电源保护和硬盘保护功能相当不错,能保证电脑商务应用的稳定性,Ubuntu下同样可以安装这个功能,只不过比Windows下的傻瓜安装方式要繁琐一些,但依然相当傻瓜

按顺序执行以下命令

$ sudo aptitude install tp-smapi-source

$ sudo module-assistant get tp-smapi-source

$ sudo module-assistant build tp-smapi-source

$ sudo module-assistant install tp-smapi-source

编辑文件:

sudo gedit /etc/modules

添加以下内容:

thinkpad_ec

tp_smapi

hdaps

在/etc/rc.local下内容:

# Make battery live longer

echo 40 > /sys/devices/platform/smapi/BAT0/start_charge_thresh

echo 99 > /sys/devices/platform/smapi/BAT0/stop_charge_thresh

如果以上两条指令出现错误请尝试使用root身份执行,如果还是不行,请手动安装 sysfsutils,然后修改 /etc/sysfs.conf 里面的配置.

搞定!