Bonjour à tous,
Voici quelques conseils pour l’installation de debian pour un portable lenovo X220. Comme je n’ai pas trouvé beaucoup d’informations sur internet, la suite sera en anglais.
I begin to install my X220 with the stable net-installer for amd64 (64 bit version).
As wireless connexion was not working (due to an “old” kernel version), I upgraded my debian to the unstable version in order to get the latest kernel (i.e. 3.0.0-2-amd64).
To install the wireless, you have to edit your source.list to let apt access the non-free repository and then :
# apt-get install firmware-iwlwifi wireless-tools
# modprobe -r iwlagn
# modprobe iwlagn
# iwconfig
It should work but if not, just check “dmesg”.
To install the fingerprint:
# apt-get install libpam-fprint libfprint0 fprint-demo
fprint-demo will let you set your own fingerprint to authentificate on your system. I encountered some issues (error -22) with pam_fprint_enroll to set my fingerprint where fprint-demo works just well.
In order to authentificate with fingerprints just edit /etc/pam.d/common-auth. This file should contains:
auth sufficient pam_fprint.so
auth [success=1 default=ignore] pam_unix.so nullok_secure
auth requisite pam_deny.so
auth required pam_permit.so
If you use xscreensaver, edit /etc/pam.d/xscreensaver. This file should contains:
@include common-auth
@include common-account
auth sufficient pam_fprint.so
auth required pam_unix.so nullok_secure
And in order to make it work properly you must let the fingerprint reader be accessible from non root user. You can do it this way:
# usermod -a -G plugdev $USER
# chgrp -R plugdev /dev/bus/usb/
In order to make the special key works with an OSD, I wrote some scripts that are inspired from this website.
It is basically the configuration and use of xbindkeys.
Here is my ~/.xbindkeysrc:
#brightness up
"brightness.sh"
m:0x0 + c:233
XF86MonBrightnessUp
#brightness down
"brightness.sh"
m:0x0 + c:232
XF86MonBrightnessDown
#toggle touchpad
"toggletouchpad.sh"
m:0x0 + c:199
NoSymbol
#Volume Up
"volume.sh +"
m:0x0 + c:123
XF86AudioRaiseVolume
#Volume Down
"volume.sh -"
m:0x0 + c:122
XF86AudioLowerVolume
#Volume (Un)Mute
"volume.sh m"
m:0x0 + c:121
XF86AudioMute
#Lock Screen
"xscreensaver-command -lock"
m:0x0 + c:160
XF86ScreenSaver
#Battery Status
"batteryinfo.sh"
m:0x0 + c:244
XF86Battery
The associated scripts must be placed in /usr/local/bin.
/usr/local/bin/batteryinfo.sh:
#!/bin/bash
# path to your battery. make sure it's correct
BAT_PATH="/sys/class/power_supply/BAT0"
if [ -n "$XAUTHORITY" ]; then
# kill other osd_cat processes to prevent overlapping
if [ $(ps -A | grep osd_cat | wc -l) -gt 0 ]; then
killall osd_cat
fi
BAT_FULL=$(cat $BAT_PATH/charge_full)
BAT_NOW=$(cat $BAT_PATH/charge_now)
STATUS=$(cat $BAT_PATH/status)
let perc=(100*$BAT_NOW)/$BAT_FULL
osd_cat -d 2 -A center -p bottom -o 50 -c yellow -s 1 \
-f -adobe-courier-bold-r-normal--*-240-*-*-m-*-iso8859-1 \
-b percentage -P $perc -T "Battery $perc % loaded, $STATUS"
fi
/usr/local/bin/brightness.sh:
[code]#!/bin/bash
if [ -n “$XAUTHORITY” ]; then
# kill other osd_cat processes to prevent overlapping
if [ $(ps -A | grep osd_cat | wc -l) -gt 0 ]; then
killall osd_cat
fi
i=$(cat /sys/class/backlight/acpi_video0/brightness)
let i_perc=(100*$i)/15
osd_cat -d 1 -A center -p bottom -o 50 -c yellow -s 1
-f -adobe-courier-bold-r-normal–-240---m--iso8859-1
-b percentage -P $i_perc -T "Brightness: $i / 15"
fi
[/code]
/usr/local/bin/toogletouchpad.sh:
[code]#!/bin/bash
adapted from http://forums.gentoo.org/viewtopic-p-6241953.html?sid=815e3e5f2bb9ccfbef0c8ff6cb37914b#6241953
if synclient -l | grep -q TouchpadOff[^[:alnum:]]*0 ; then
synclient TouchpadOff=1
status="TouchPad OFF"
else
synclient TouchpadOff=0
status="TouchPad ON"
fi
kill other osd_cat processes to prevent overlapping
if [ $(ps -A | grep osd_cat | wc -l) -gt 0 ]; then
killall osd_cat
fi
if [ -n “$XAUTHORITY” ]; then
echo $status | osd_cat -d 3 -p bottom -A center -o -50 -s 1 -c green
-f -adobe-courier-bold-r-normal–-240---m--iso8859-1
fi
[/code]
/usr/local/bin/volume.sh:
[code]#!/usr/bin/env bash
adapted from http://ztatlock.blogspot.com/2009/01/volume-control-with-amixer-and-osdcat.html
CHANNEL=Master
if [ “$1” = “-h” ] || [ “$1” = “–help” ] ; then
p=$(basename $0)
cat <<HERE
Usage: $p
where option is in {+, -, m, u} or is a percent
e.g. $p 50 # sets $CHANNEL to 50%
$p Front m # toggles the mute of the channel Front
HERE
exit 0
fi
if [ $# -eq 2 ] ; then
CHANNEL=$1
shift
fi
function vol_level {
amixer get $CHANNEL |
grep ‘Front Left:’ |
cut -d " " -f 7 |
sed ‘s/[^0-9]//g’
}
function osd {
killall osd_cat &> /dev/null
echo $* |
osd_cat -d 2 -l 1 -p bottom -c green -s 1 -A center -o 50
-f ‘-adobe-courier-bold-r-normal–-240---m--iso8859-1’ &
}
function mute_osd {
if [ $(amixer get $CHANNEL | grep Playback | grep “[on]” | wc -l) -gt 0 ]
then
osd $CHANNEL Unmuted
else
osd $CHANNEL Muted
fi
}
function vol_osd {
killall osd_cat &> /dev/null
osd_cat -d 2 -l 2 -p bottom -c green -s 1 -A center -o 50
-f ‘-adobe-courier-bold-r-normal–-240---m--iso8859-1’
-T “Volume ($CHANNEL) : $(vol_level) %” -b percentage -P $(vol_level) &
}
case “$1” in
"+")
amixer -q set $CHANNEL 5%+
vol_osd
;;
"-")
amixer -q set $CHANNEL 5%-
vol_osd
;;
“m”)
amixer -q set $CHANNEL toggle
mute_osd
;;
*)
amixer -q set $CHANNEL $1%
;;
esac
[/code]
All those scripts must be executable, i.e. you have to chmod 755 those files.
You have to launch xbindkeys every time you start a session. I suggest you put a command like “xbindkeys&” in your xinitrc file. If you are running xfce4, this file can be find there: ~/.config/xfce4/xinitrc.
If you don’t want to use gnome-power-manager or other equivalent softwares, just install laptop-mode-tools, pm-utils and the acpi packages.
pm is a the tool that will handle suspend (pm-suspend), hibernate (pm-hibernate) and so on in replacement of the “old” acpi package. acpi is just used to read information and is no longer used for power management.
If you want to suspend your computer when you close the lid, just modify the /etc/acpi/actions/lm_lid.sh and replace it with the following lines of code:
#! /bin/sh
/usr/sbin/pm-suspend
/etc/acpi/actions/lm_battery.sh is the script that will execute when the battery is at a critical level. You could replace this file with:
#! /bin/sh
/usr/sbin/pm-hibernate
Everything else (webcams, mics, sound card, …) worked out of the box so I don’t think it’s useful to give more details on these topics.
Just a quick remark: if you want to shut down bluetooth on the X220, just execute the following command: echo 0 > /sys/devices/platform/thinkpad_acpi/bluetooth_enable
As I don’t use bluetooth, I desactivate bluetooth, WAN, … on the BIOS in order to save power. I think it’s a good trick to reduce your electrical consumption.
If you want to add something, do not hesistate to send a message and I will be more than please to enhance this post.
If you have a question, just ask but don’t ask silly questions (i.e. questions that can be solved by googling a question).
See ya !
Louis.