Difference between revisions of "IBM ThinkPad T43p"

From ArchWiki
Jump to: navigation, search
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:IBM (English)]]
+
[[Category:IBM]]
 
The Thinkpad laptops are known for their durability and build quality. However, one must tweak a bit his linux to unleash the real potential of this square box hardware. This one will not be a guide to get a fancy eyecandy-full machine, but fast (considering the hardware) geeky machine, which does the job efficiently.
 
The Thinkpad laptops are known for their durability and build quality. However, one must tweak a bit his linux to unleash the real potential of this square box hardware. This one will not be a guide to get a fancy eyecandy-full machine, but fast (considering the hardware) geeky machine, which does the job efficiently.
  
Line 35: Line 35:
 
===Config Files (found int /etc/ dir)===
 
===Config Files (found int /etc/ dir)===
  
The contents of /etc/rc.local:
+
The contents of /etc/rc.local can be found here.
#!/bin/bash
+
#
+
# /etc/rc.local: Local multi-user startup script.
+
#
+
+
#Laptop related stuff
+
/usr/bin/hal-disable-polling --device /dev/scd0
+
/usr/sbin/iwpriv your_wireless_interface set_power 5
+
hdparm -B 254 /dev/sda
+
cpufreq-set -g powersave
+
+
  #Setting battery thresholds:
+
set_bat_thresh 0 40 80
+
+
  #HDAPS
+
insmod /lib/modules/$(uname -r)/extra/hdaps.ko invert=1
+
/etc/rc.d/hdapsd start
+
+
#Restarting acpid in case the handler.sh is not loaded properly
+
/etc/rc.d/acpid restart
+
  
 
==Powersaving and ACPI==
 
==Powersaving and ACPI==
  
My handler.sh
+
My handler.sh can be found here.
  
 +
==Programs that ease CLI life==
  
#!/bin/sh
+
The list of programs which I usually use for my everyday life:
#
+
* VTE - [[urxvt]]{c,d}
# ACPI handler script default.sh
+
* Shell - [[zsh]]
# Optimized for Thinkpad T43p
+
* Editor - [[vim]] (used together with latexsuite)
#
+
* RSS Reader - [[canto]]
# Copyright (c) Ignas Anikevicius
+
* MPD Client - [[mpd|ncmpcpp]]
#
+
* Versioning system - [[git]]
# Inspired by Phillip Berndt, 2007
+
* File Manager - [[ranger]]
#            Michael Schmuker, 2007
+
* Network Manager - [[wicd]]-curses
#
+
* IRC client - [[weechat]]
+
## Configuration #####################################################
+
# X11 access for osd_cat and xset dpms
+
USER="ignas" # Main user of this PC
+
export XAUTHORITY="/home/ignas/.Xauthority" # X authority file
+
#export DISPLAY="auto" # Default display
+
export DISPLAY=":0"
+
# default xkbmap
+
def_map="gb"
+
xkbm_opt="-model thinkpad -option caps:super"
+
+
# APPS
+
LOCKAPP="/usr/bin/i3lock -c 333436 -n"
+
+
# Type of Notification
+
NOTIFY_TYPE="DBUS"
+
NOTIFY_DISABLE_FILE="/var/lib/misc/acpid_notify_disable"
+
+
## Help ##############################################################
+
#
+
# Installation:
+
#  Copy to /etc/acpi/default.sh for acpid
+
#
+
# This script has the following configuration:
+
* F1: Change between ondemand and powersave govenor (CPU)
+
#  * F2: dpms force off (Blank screen)
+
#  * F3: Lock screen
+
#  * F4: Suspend to ram
+
#  * F5: WiFi on/off
+
#  * F5: Bluetooth on/off
+
#  * F7: ARandR
+
#  * F8: Touchpad on/off
+
#  * F9: Unassigned
+
#  * F10: Toffle Notification Options
+
#  * F11: Suspend to both
+
#  * F12: Suspend to disk
+
#  * Change to performance on AC-plug-in
+
#  * Change to powersave on AC-unplug
+
#  * Hibernate on battery power < 5%
+
#  * Spindown HDD on lid close
+
#  * Poweroff after pressing the power button TWO times
+
#  * Load and unload wlan driver on "Access IBM" button
+
#
+
# You'll need the following tools to use all features:
+
#
+
#  * /usr/sbin/hibernate Hibernate script
+
#  * /usr/bin/osd_cat cat'like X11 tool
+
######################################################################
+
+
## Functions #########################################################
+
# Notifications
+
#if [ "${DISPLAY}" == "auto" ]; then
+
# X="$(ls /tmp/.X11-unix/X* | head -n1)";
+
# [ "x${X}" != "x" ] && export DISPLAY=":0"
+
#fi
+
+
if [ "${DISPLAY}" != "auto" ]; then
+
  if [ "x${NOTIFY_TYPE}" == "xDBUS" ] && (which notify-send &) >/dev/null; then
+
    notify()
+
    {
+
      logger "${NOTIFY_TYPE} Notification: $@"
+
      [ -f ${NOTIFY_DISABLE_FILE} ] && return
+
      su ${USER} \
+
      --command="notify-send \
+
      --urgency=normal \
+
      --expire-time=1500 \"$@\""
+
    }
+
  elif [ "x${NOTIFY_TYPE}" == "xOSD" ] && (which osd_cat &) >/dev/null; then
+
    notify()
+
    {
+
      logger "${NOTIFY_TYPE} Notification: $@"
+
      [ -f ${NOTIFY_DISABLE_FILE} ] && return
+
      pkill osd_cat
+
      echo $@ | osd_cat \
+
      --pos=bottom \
+
      --align=center \
+
      --offset=-1 \
+
      --delay=3 \
+
      --colour=#317de5 \
+
      --outline=1 \
+
      --outlinecolour=#111214 \
+
      --font="-*-bitstream vera sans mono-medium-r-*-*-25-*-*-*-*-*-*-*" &
+
    }
+
  else
+
    notify()
+
    {
+
      logger "Notification: $@"
+
    }
+
  fi
+
fi
+
+
# locking function
+
lockfunc()
+
{
+
  local cur_map=$( setxkbmap -print | grep symbols | sed 's/.*pc+//' | sed 's/+.*//' )
+
  su ${USER} -c "setxkbmap $def_map ${xkbm_opt}" &
+
  su ${USER} -c "${LOCKAPP}"
+
  su ${USER} -c "setxkbmap \"$cur_map\" ${xkbm_opt}"
+
}
+
+
# Suspend to prep
+
susp_prep()
+
{
+
  # Prepare suspend (Power saving hacks)
+
  #chvt 1
+
  echo -n eject > /proc/acpi/ibm/bay
+
  ethtool -s eth0 wol d
+
  #/usr/share/wicd/daemon/suspend.py
+
+
  # Suspend
+
  #sleep 1
+
  #echo mem > /sys/power/state
+
}
+
+
# Toggle Synaptics Touchpad state
+
togglesyn() {
+
  #
+
  if synclient -l | grep TouchpadOff | grep -q 0; then
+
    synclient TouchpadOff=1;
+
    STATE="Disable"
+
  else
+
    synclient TouchpadOff=0;
+
    STATE="Enable"
+
  fi
+
}
+
+
## Handlers ##########################################################
+
case "$1" in
+
  button/power)
+
  #echo "PowerButton pressed!">/dev/tty5
+
    case "$2" in
+
      PWRF) 
+
        logger "PowerButton pressed: $2"
+
        su ${USER} -c "${LOGOUT_DIALOG}" &
+
      ;;
+
      *)      logger "ACPI action undefined: $2" ;;
+
    esac
+
    ;;
+
    button/sleep)
+
    case "$2" in
+
      SLPB)  echo -n mem >/sys/power/state ;;
+
      *)      logger "ACPI action undefined: $2" ;;
+
    esac
+
    ;;
+
    ibm/hotkey)
+
    case "$2" in
+
      HKEY)
+
        case "$4" in
+
          00001001) # Fn +  F1 --- Governor change
+
            DO="ondemand"
+
            grep "ondemand" "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" &>/dev/null && DO="ondemand"
+
            echo ${DO} > "/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"
+
            notify "Governor is now ${DO}"
+
          ;;
+
          00001002) # Fn +  F2 ---
+
          ;;
+
          00001003) # Fn +  F3 --- Screen Lock
+
            # set layout to english
+
            # lock the screen
+
            lockfunc
+
          ;;
+
          00001004) # Fn +  F4 --- Suspend to Ram (Sleep)
+
            notify "Going to suspend the machine" &&
+
        susp_prep &&
+
            pm-suspend &
+
            lockfunc &
+
          ;;
+
          00001005) # Fn +  F5 --- Toggle WiFi
+
          ;;
+
          00001006) # Fn +  F6 --- Toggle Bluetooth
+
            DO="disable"
+
            grep -q "disabled" "/proc/acpi/ibm/bluetooth" && DO="enable"
+
            echo ${DO} > "/proc/acpi/ibm/bluetooth"
+
            notify "Bluetooth ${DO}d"
+
          ;;
+
          00001007) # Fn +  F7 --- Screen management
+
            su ${USER} -c "arandr"
+
          ;;
+
          00001008) # Fn +  F8 --- Toggle Touchpad
+
            togglesyn
+
            notify "Touchpad is ${STATE}d "
+
          ;;
+
          00001009) # Fn +  F9 ---
+
          ;;
+
          0000100a) # Fn + F10 --- (De)activate OSD
+
        if [ -f ${NOTIFY_DISABLE_FILE} ]; then
+
          rm ${NOTIFY_DISABLE_FILE}
+
          notify "Notifications Enabled"
+
        else
+
          notify "Notifications Disabled"
+
          touch ${NOTIFY_DISABLE_FILE}
+
        fi
+
          ;;
+
          0000100b) # Fn + F11 --- Suspend to Both
+
            notify "Going to suspend the machine" &&
+
            #susp_prep &&
+
            #hibernate
+
            lockfunc &
+
          ;;
+
          0000100c) # Fn + F12 --- Suspend to Disk (Hibernate)
+
            notify "Going to hibernate the machine" &&
+
            #susp_prep &
+
            lockfunc &
+
          ;;
+
          *)  logger "ACPI action undefined: $2" ;;
+
        esac
+
        ;;
+
  esac
+
  ;;
+
  ac_adapter)
+
  case "$2" in
+
    AC)
+
    case "$4" in
+
      00000000)
+
        cpufreq-set -f powersave
+
#osd "Powering from Battery"
+
        notify '"'"Powering from Battery"'"'
+
      ;;
+
      00000001)
+
        cpufreq-set -f ondemand
+
#osd "Powering from AC"
+
        notify '"'"Powering from AC"'"'
+
      ;;
+
    esac
+
    ;;
+
    *)  logger "ACPI action undefined: $2" ;;
+
  esac
+
  ;;
+
  battery)
+
    case "$2" in
+
    BAT0)
+
    case "$4" in
+
      00000000)  #echo "offline" >/dev/tty5
+
      ;;
+
      00000001)  #echo "online"  >/dev/tty5
+
      ;;
+
      esac
+
    ;;
+
    CPU0)
+
    ;;
+
    *)  logger "ACPI action undefined: $2" ;;
+
  esac
+
  ;;
+
  button/lid)
+
  #echo "LID switched!">/dev/tty5
+
  ;;
+
  *)
+
  logger "ACPI group/action undefined: $1 / $2"
+
  ;;
+
esac
+
 
+
==Programs that ease CLI life==
+
  
 
==X.org and friends==
 
==X.org and friends==

Revision as of 13:01, 23 April 2012

The Thinkpad laptops are known for their durability and build quality. However, one must tweak a bit his linux to unleash the real potential of this square box hardware. This one will not be a guide to get a fancy eyecandy-full machine, but fast (considering the hardware) geeky machine, which does the job efficiently.

System specs

  • Intel Pentium M (Dothan) 2.13GHz CPU
  • ATI Mobility FireGL V3200 with 128MB
  • 14.1" TFT display with 1400x1050 resolution
  • 2GB PC2-4200 RAM
  • 80GB 7.2k rpm HDD


  • Broadcom Gigabit Ethernet (10/100/1000)
  • MiniPCI slot with Intel PRO/Wireless 2915ABG Mini-PCI Adapter
  • IBM Integrated Bluetooth IV with 56K Modem (BMDC-3)


  • Intel AC'97 Audio with a AD1981B codec
  • UltraBay Slim with DVD±RW
  • CardBus slot (Type 2)
  • ExpressCard/54 slot
  • IBM Embedded Security Subsystem 2.0
  • IBM Active Protection System
  • Integrated Fingerprint Reader on select systems
  • UltraNav (TrackPoint / Touchpad combo)

The installation

Well the basic installation can be found in the Beginner's Guide. However, there was done a lot of customization to suit my need and here I will try to list them.

Basically what I did was to do several optimizations shown in HDAPS article as well as in tp_smapi article. What is more hdd spindown tweaks were applied in order to solve the problem of hd failures due to numerous times when it might get spined down.

Config Files (found int /etc/ dir)

The contents of /etc/rc.local can be found here.

Powersaving and ACPI

My handler.sh can be found here.

Programs that ease CLI life

The list of programs which I usually use for my everyday life:

X.org and friends

Desktop Manager

In the beginning I have been using SLiM, but the switch to CDM. The latter is simpler, faster and far more stable. What is more it might be the case that is more customizable as well.

awesomewm and desktop interaction stuff