Difference between revisions of "Installing Gentoo on a ThinkPad T410"

From ThinkWiki
Jump to: navigation, search
(camera / sd reader)
(xmodmap)
Line 482: Line 482:
 
<pre>
 
<pre>
  
 +
! additional arrow keys
  
! additional Arrow keys
+
keycode 167 = XF86Forward
 +
keycode 166 = XF86Back
  
keycode 233 = XF86Forward
+
! Fn+Fx Keys: F2,F3,F4,F5,F7,F8,F9
keycode 234 = XF86Back
 
  
! Fn+arrow keys
+
keycode 160 = F22
 +
keycode 244 = F13
 +
keycode 150 = F24
 +
keycode 200 = F25
 +
keycode 235 = F27
 +
keycode 156 = F28
 +
keycode 213 = F29
  
keycode 144 = XF86AudioPrev
+
! Brightness (Fn+Pg* keys)
keycode 162 = XF86AudioPlay
 
keycode 153 = XF86AudioNext
 
keycode 164 = XF86AudioStop
 
  
 +
keycode 101 = SunVideoRaiseBrightness
 +
keycode 212 = SunVideoLowerBrightness
  
! Fn+Fx keys F2, F3, F4, F5, F7, F8, F9, F12  in this order
+
! Fn+Arrow keys (Multimedia keys)
  
keycode 146 = XF86ScreenSaver
+
keycode 173 = XF86AudioPrev
keycode 241 = XF86Display
+
keycode 172 = XF86AudioPlay
keycode 223 = XF86Sleep
+
keycode 171 = XF86AudioNext
keycode 243 = XF86Send
+
keycode 174 = XF86AudioStop
keycode 214 = XF86Video
 
keycode 196 = XF86iTouch
 
keycode 197 = XF86Eject
 
keycode 165 = XF86Standby
 
  
 +
! Volume control
  
! Space bar
+
keycode 121 = XF86AudioMute
 
+
keycode 122 = XF86AudioLowerVolume
keycode 148 = XF86ZoomIn
+
keycode 123 = XF86AudioRaiseVolume
 
 
 
! volume control
 
 
 
keycode 174 = XF86AudioLowerVolume
 
keycode 176 = XF86AudioRaiseVolume
 
  
  
 
</pre>
 
</pre>
 
  
 
=== Kernel configuration ===
 
=== Kernel configuration ===
  
 
Follows soon
 
Follows soon

Revision as of 15:36, 25 October 2010

Model

Lenovo Thinkpad T410

General

This installation instruction describes the steps after a Gentoo base installation. Please read the gentoo handbook for installation instructions

Working:

  • Keyboard, UltraNav input (Touchpad and NavPoint)
  • Drives
  • X11 with nVidia including acceleration
  • Network, wireless network and bluetooth
  • Sound
  • Suspend to RAM
  • Suspend to Disk (Hibernate)
  • ThinkLight
  • ACPI (Battery, CPU Frequency, Fan, Temperature, ...)
  • Webcam
  • Fn Key combinations
  • Hot swapping of optical drive (UltraBay)
  • HDD Acceleration Meter (can be used as an input device)
  • Harddisk protection
  • Card reader: SD Card

Not tested:

  • Firewire (should work as it is recognized, no devices for testing)
  • E-Sata (should work, no devices for testing)
  • Express Card Slot (should work, no devices for testing)
  • Docking Station (should work according to several sources, no devices for testing)
  • Card Reader: Memory Stick

Graphics: NVIDIA Quadro NVS 3100M (GT218)

To install and configure the nVidia driver, just emerge nvidia-driver.

Framebuffer works fine with vga=0x361. hwinfo --framebuffer displays all supported resolutions.

The brightness control needs a workaround. Add

Option "RegistryDwords" "EnableBrightnessControl=1"

to your xorg.conf

Performance of the card depends heavy on powermizer and some nvidia settings.

In recent nvidia drivers, powermizer can be configured via `nvidia-settings`

#!/bin/sh
if [ -z "$1" ]
then
        echo "Powermizer control script."
        echo "2010 by Christian \"Fuchs\" Loosli."
        echo ""
        echo "usage: powermizer on | off"

else
        if [ $1 = "on" ]
        then
                nvidia-settings -a [gpu:0]/GPUPowerMizerMode=0
        fi
        if [ $1 = "off" ]
        then
                nvidia-settings -a [gpu:0]/GPUPowerMizerMode=1
        fi
fi
exit 0

This script turns powermizer on or off. You can use it together with acpi events or your power management to turn powermizer off as soon as your notebook is powered via AC.

Sound: AD1984

Works out of the box. The microphone might has to be unmuted via alsamixer. If you are using pulse audio, check pavucontrol as well.

The mute button and the volume up and volume down buttons work as well but you need to configure them first. You can use xmodmap to bind a key to them and then either bind a amixer command to them, or set them as hotkeys in your mixer application (kmix, gnome-mixer, ...) Please note that some mixer applications take the wrong mixer (the hdmi output) as the default, so you have to change the default / primary mixer.


Network: Intel E1000 NIC, WiFi Link 6000 Series WNIC, Bluetooth

The integrated e1000 LAN NIC works out of the box.

For wireless you have to emerge the net-wireless/iwl6000-ucode package. You have to enable iwlwifi / iwlagn in your kernel configuration.

Don't forget that the interface (wlan0) has to be set as up (ifconfig wlan0 up) before scanning and associating works.

Bluetooth works out of the box with blueZ. You can disable / enable bluetooth via proc, with a script similar to this one:

<bash>

  1. !/bin/sh

bluetooth=`head -n 1 /proc/acpi/ibm/bluetooth | awk '{print $2}'` case "$bluetooth" in

   disabled)
       echo "enable" > /proc/acpi/ibm/bluetooth

;;

   enabled)
       echo "disable" > /proc/acpi/ibm/bluetooth
       ;;

esac exit 0 </bash>

or directly with the proc interface. This script helps you to bind it to a key combination.

Note that the hardware killswitch on the front works as well, but disables both bluetooth and WLAN


Ports: USB, HDMI, IEEE 1394 Firewire

USB works out of the box.

Firewire is untested but should work, as the port is recognized and the module loaded.

HDMI is untested, but as it is recognized (including the alsa audio device) it should work.

Drives

The optical drive and hard drive work out of the box, with AHCI disabled or enabled in the BIOS.

If you run a dualboot system with windows <= 5.1 (XP) you probably want to disable AHCI anyway, at least until you have installed the ahci driver for Windows.

Input

TouchPad

Works out of the box here, with scrolling.

TouchPads are, as all the other input devices, not configured via xorg.conf anymore in xorg >= 1.6. You can either use the xorg.conf.d directory, udev rules or synclient on a per user base.

I use

synclient HorizEdgeScroll=1 VertEdgeScroll=1 MinSpeed=0.25 MaxSpeed=0.42 AccelFactor=0.0010 VertTwoFingerScroll=1 HorizTwoFingerScroll=1 TapButton2=2 TapButton3=3 PalmDetect=1 PalmMinWidth=5 RTCornerButton=2 RBCornerButton=3

in my autostart, which activates two finger scrolling, multifinger tab and edge buttons.

The touchpad can be disabled via synclient when using the synaptics driver, a possible solution is this script:

<bash>

  1. !/bin/sh

touchpad=`synclient -l | grep TouchpadOff | awk '{print $3}'` case "$touchpad" in

   1)
       synclient TouchpadOff=0;

echo "Touchpad Enabled" | osd_cat -d 1 -c cyan --font="-*-times-bold-r-*--34-240-*-*-p-*-*-*" -A center -p bottom ;;

   0)
       synclient TouchpadOff=1;

echo "Touchpad Disabled" | osd_cat -d 1 -c cyan --font="-*-times-bold-r-*--34-240-*-*-p-*-*-*" -A center -p bottom

   ;;

esac exit 0 </bash>

which needs xosd to display the current state. You can remove the "echo" line if you don't want the status being displayed or if you don't have xosd. You can make the script executable and map it to the fn+f8 button.


Trackpoint

Works out of the box as well, with no scrolling however. Can be configured via xorg.conf, I prefer using the middle button as mouse3.

Keyboard

Works out of the box, most of the Fn Keys work.

Hardwired: Thinklight, Brightness

Generates a keycode and can be configured: Volume Down, Volume Up, Fn+F2, Fn+F3, Fn+F4, Fn+F5, Fn+F7, Fn+F8, Fn+Arrows

Does not generate a key event: Fn+Space Those keys do produce an acpi event, so you can modifiy your acpi configuration to bind them to commands.

It is also possible to translate the acpi events to keyevents, have a look at the following configuration file:

My example default.sh file for the missing keys is here and there is a good, more complete howto here: Gentoo Wiki

Suspend

Suspend to RAM worked out of the box here, echo 3 > /proc/acpi/sleep puts the machine in suspend mode, opening it or pressing the power button wakes it up. Worked with nvidia driver and in X11. All devices came back without problems, wlan might have disconnected, but by using networkmanager, wicd or a good configuration it should reconnect after waking up. Works here with wicd.

Suspend to Disk works out of the box as well.


Integrated Fingerprint Reader

Not tested yet

Integrated Webcam

The Camera seems to be a Chicony Electronics Co., Ltd. device, with

Vendor ID: 0x17ef Product ID: 0x480f

You have to enable: Video capture adapters ---> V4L USB devices ---> USB Video Class (UVC) in the kernel, then the camera will work out of the box (tested with Kopete)


Integrated Card reader

The card reader is a

SD Host controller: Ricoh Co Ltd Device e822 (rev 01)

You can enable the sd/sdhci drivers in the Kernel in order to get it to work.

Hard Drive Active Protection

The integrated harddrive active protection acceleration meter can be used as a joystick or to get information about movements of your thinkpad.

Emerge the hdapsd and app-laptop/tp_smapi with the hdaps USE-Flag enabled, which will generate a joystick and an event device.

It can be used for protecting your harddisk as well. Make sure to diable the kernel internal hdaps module, emerge hdapsd and tp_smapi with the hdaps flag enabled, rc-update add hdapsd boot and then reboot.

Heads will only be parked with this method. However, in some situations and with some disk there will be a full spindown, which should be avoided as this might damage your harddisk when used too much.

On newer versions of xorg it might be possible that the accelerometer is seen as a mouse, which makes your pointer hop to the middle of the screen all the time. In order to solve this, you can create a udev rule:

/etc/udev/rules.d/99-hdaps.rules

SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="ThinkPad HDAPS accelerometer data", ENV{x11_driver}=""
SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="ThinkPad HDAPS joystick emulation", ENV{x11_driver}=""

which solves this problem.

Thinklight

The thinklight works out of the box with the Fn+PgUp key, but it can be controlled as well via the proc interface.

So you can write a nice script, which you can bind to events, such as incoming emails, to let the light flash.

A possible solution is this small script:

<bash>

  1. !/bin/sh

if [ -z "$1" ] then echo "IBM ThinkLight Control script." echo "2007 by Christian \"Fuchs\" Loosli." echo "" echo "usage: lightctl on | off | toggle | blink" echo "blink takes two arguments: times and time" echo "defaults (5 times, 0.5 seconds) are used if not specified"

else if [ $1 = "on" ] then

   	       echo on > /proc/acpi/ibm/light

fi if [ $1 = "off" ] then

  	       echo off > /proc/acpi/ibm/light

fi

       if [ $1 = "toggle" ]

then status=`cat /proc/acpi/ibm/light | grep status | awk '{print $2}'`

if [ $status = "on" ] then echo off > /proc/acpi/ibm/light else echo on > /proc/acpi/ibm/light fi fi

if [ $1 = "blink" ] then

times=$2 time=$3

if [ -z "$2" ] then times=4 fi

if [ -z "$3" ] then time=0.5 fi

   	        for i in `seq 1 $times`;
   	        do
   		        $0 toggle;
                       sleep $time;
                       $0 toggle;
                       sleep $time
   	        done    

fi fi exit 0

</bash> which can be called to let the light blink or switch it off or on. The blink part is nice for setting to events such as incoming messages or emails.

(note: the thinklight is a LED, so it should not care on how fast and often you let it blink. But I am not responsible if this script damages your thinklight. Use at own risk.

Power saving

First of all, turn off all things you are not using, most of all bluetooth and W-LAN. You can use the killswitch on the front, it works out of the box.

You can use the application powertop by Intel to look for processes which prevent the CPU from longer sleep states.

It also gives you some recommendations on services to turn off. Do _not_ turn off the optical drive polling by HAL.

Dimming the display also saves lots of power.

You can achieve about 4 - 6 hours of working time (no compiling or other heavy CPU / GPU usage applications) with the standard battery like this.

ibm-acpi

I have ibm-acpi configured as a module in my kernel, as I load it with

options thinkpad_acpi brightness_enable=1 fan_control=1

to enable brightness controll via /proc/acpi/ibm on newer kernels and fan control. The hotkey=enable,<mask> option is used instead of writing to /proc/acpi/ibm/hotkey.

The default file permissions in /proc/acpi/ibm/* do not grant write access for users. I created the group "ibm", added my users to it and now I chown root:ibm and chmod 0774 the files in /proc/acpi/ibm/ on startup. If you don't want to do this you might use sudo sh -c "echo "foo" > /proc/acpi/ibm/whatever", but you need to install sudo and modify your sudoers file.

Configuration Files

xorg.conf


##
## Server layout for the built in monitor, an external mouse and the touchpad
##
Section "ServerLayout"
    Identifier     "single head configuration"
    Screen      0  "Screen0" 0 0
EndSection

##
##  Server Flags
##
Section "ServerFlags"
EndSection



##
## FontPath for the x font server xfs
##
Section "Files"
    FontPath    "/usr/share/fonts/local"
    FontPath    "/usr/share/fonts/misc"
    FontPath    "/usr/share/fonts/Type1"
    FontPath    "/usr/share/fonts/TTF"
    FontPath    "/usr/share/fonts/75dpi"
    FontPath    "/usr/share/fonts/100dpi"
EndSection

##
## Module Section, load default modues
##
Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "glx"
    Load           "freetype"
    Load           "type1"
EndSection

##
## Built in Monitor 
##
Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Lenovo"
    ModelName      "LEN"
EndSection

##
## Videocard section. Some of the following options are now default
## and only kept for compatibility reasons with older drivers
## Read the Appendix B of the nvidia README for explanations 
##
Section "Device"
    Identifier     "Videocard0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "Quadro NVS 3100M"

    # power savings
    Option         "OnDemandVBlankInterrupts" "true"
    
    # allow underclocking
    Option         "Coolbits" "1"
    
    # enable the X Resize and Rotation extension
    Option         "RandRRotation" "true"
    
    # backlight fix
    Option "RegistryDwords" "EnableBrightnessControl=1"

EndSection


##
## Screen Section
##
Section "Screen"
        Identifier   "Screen0"
        Device       "Videocard0"
        Monitor      "Monitor0"
        DefaultDepth  24
        SubSection "Display"
                Viewport  0 0
                Depth     24
                Modes    "1440x900" "1024x768" "800x600" 
        EndSubSection
        SubSection "Display"
                Viewport 0 0
                Depth 16
                Modes   "1440x900" "1024x768" "800x600" 
        EndSubSection
                SubSection "Display"
                Viewport 0 0
                Depth 8
                Modes   "1440x900" "1024x768" "800x600" 
        EndSubSection
EndSection

##
## Extensions, load compisite for compiz
##
Section "Extensions"
    Option         "Composite" "Enable"
EndSection

xmodmap

Note: you have to xmodmap /path/to/file this file in your autostart. You might have different keycodes, use the application xev to display them. It is highly recommended to use the XF86foobar buttons, as some applications will be preconfigured to them. If you want to map them by yourself use Fxx, while xx > 12.


! additional arrow keys

keycode 167 = XF86Forward
keycode 166 = XF86Back

! Fn+Fx Keys: F2,F3,F4,F5,F7,F8,F9

keycode 160 = F22
keycode 244 = F13
keycode 150 = F24
keycode 200 = F25
keycode 235 = F27
keycode 156 = F28
keycode 213 = F29

! Brightness (Fn+Pg* keys)

keycode 101 = SunVideoRaiseBrightness
keycode 212 = SunVideoLowerBrightness

! Fn+Arrow keys (Multimedia keys)

keycode 173 = XF86AudioPrev
keycode 172 = XF86AudioPlay
keycode 171 = XF86AudioNext
keycode 174 = XF86AudioStop

! Volume control

keycode 121 = XF86AudioMute
keycode 122 = XF86AudioLowerVolume
keycode 123 = XF86AudioRaiseVolume


Kernel configuration

Follows soon