Difference between revisions of "User:Hmh"

From ThinkWiki
Jump to: navigation, search
(Kernel setup tasks: i2c_i801 is useless on thinkpads)
(Replace old stuff with a proper user page. I will get back to the old t43 install guide eventually :))
Line 1: Line 1:
== ThinkPad T43 2687-DDU setup for Debian Etch ==
+
== Who is Hmh? ==
  
This is an ongoing, spotty guide for an advanced {{Debian}} setup of a {{T43}}, focused on using absolutely all of its capabilities that can be used.  It is not an installation guide, but rather a configuration guideRefer to {{Debian}} for a list of pages with initial installation instructions.
+
I am a Debian Developer for quite a few years now, and the current maintainer of [[ibm-acpi]], the Linux kernel driver for ThinkPad laptops.   
  
When it is really usable, I will move it to some other far more public place in [[ThinkWiki]].
+
I am also involved with the [[tp_smapi]] and [[HDAPS]] Linux drivers, as a beta-tester and power-user. I don't list myself as a developer for those projects because I have never contributed a single line of code to them, just suggestions and bug reports ;-)
  
Installing should be done using the latest Debian Etch debian-installer release.  Anything else simply will not run on the ThinkPad.
+
== My ThinkPads ==
  
=== Kernel ===
+
I own just a simple [[:Category:T43|T43]] model 2687-DDU.  It is a great machine, a very solid ThinkPad, with its own set of annoying quirks, just like any other IBM-era ThinkPad, the SATA-PATA bridge, tg3 noise and lack of support for AHCI being the worst ones IMHO.
  
Baseline kernel: Debian's latest 2.6.16 (2.6.16.17 with stabilization patches) {{NOTE|Thinkpad support is an ongoing, bleeding edge effort. One ends up needing to apply a ton of patches and to use the latest available kernel, sometimes even kernels not yet released}} {{HINT|The [http://members.optusnet.com.au/ckolivas/kernel/ Con Kolivas (ck) desktop kernel] patches might be very applicable to a ThinkPad Kernel}}
+
== Links ==
  
==== Patches employed ====
+
* [[ibm-acpi|The Linux kernel ibm-acpi driver, which I currently maintain]]
* Latest ipw2200 driver and ieee80211 layer:
+
* [http://people.debian.org/~hmh/ My Debian.org homepage with some old stuff]
:There are two ways to go about this: either '''disable''' IEEE 802.11 support (and thus ipw2200) in the kernel and build both modules out-of-tree (failure to do so will break the out-of-tree build), or update the kernel subsystems with more up-to-date files.
 
:The advantage of updating the kernel drivers instead of doing an out-of-tree build is that should there be any configuration options that require ieee80211 support, those will be available.  On the other hand, it is a bit more difficult, as you will have to mess with Kconfig.
 
:* copied files over the in-kernel files in {{path|include/net}}, {{path|drivers/net/wireless}}, {{path|Documentation/networking}}, {{path|net/ieee80211}}, thus replacing the old drivers with the new ones.
 
:* ipw2200 often have extra options you need to enable, look in the toplevel Makefile and add them to {{path|drivers/net/wireless/Kconfig}}. They are usually bool types, so it is trivial to copy, e.g. IPW_DEBUG and rename to the new required options.
 
* [[Problems with SATA and Linux#Hang on resume from suspend to RAM|SATA power-management]]
 
* [[HDAPS|freeze-block-queue patch (for HDAPS)]]
 
* [http://acpi.sourceforge.net/download.html ACPI update patches]
 
* [[Problems with ACPI suspend-to-ram#Troubles on resume|ACPI shutdown on resume patch]]
 
* [[Tp smapi|TP SMAPI support]]
 
* [[Software Suspend 2]]
 
* [[Conexant HSF modem drivers#The Linuxant hsf driver|Linuxant Conexant HSF modem driver]]
 
* [[How to make use of IrDA#ISA PnP patch|nsc-ircc ISA PNP patch]]
 
 
 
==== Kernel setup tasks ====
 
# Make sure the following subsystems are modules (for suspend/resume)
 
## USB (especially EHCI_HCD and UHCI_HCD)
 
## HDAPS (may work compiled in, as well)
 
# Make sure the following subsystems are enabled and not modules (safety net)
 
## ThinkPad SMAPI
 
# Do not compile support for these (they are useless on a ThinkPad)
 
## i2c_i801
 
# Place the following modules on /etc/modules:
 
## hdaps
 
## tg3
 
## ipw2200
 
# [[How to make use of IrDA#Kernel configuration|Configure IrDA module options]]
 
# ipw2200 firmware needs to go in {{path|/lib/firmware}}. The module should be given the led=1 module parameter option
 
# If you do not have a dock, you can and should get rid of the legacy floppy support in the kernel. Disable CONFIG_BLK_DEV_FD for a ~0.5s speedup on boot time.
 
 
 
=== Userland ===
 
 
 
==== Complex configuration issues ====
 
 
 
You want to install and configure to your liking:
 
*smartmontools
 
*kde/gnome power management thingies
 
*X.org power management on the video driver
 
 
 
==== Simple configuration issues ====
 
 
 
These are fairly simple minor things you might want to do:
 
 
 
===== /etc/sysctl.conf =====
 
 
 
install the procps package. Add the following lines to /etc/sysctl.conf:
 
 
 
{{FIXME}}
 
 
 
===== /etc/sysfs.conf =====
 
 
 
install the sysfsutils package. Add the following lines to /etc/sysfs.conf
 
 
 
# ThinkPad battery charger defaults
 
devices/platform/smapi/BAT0/start_charge_tresh=40
 
devices/platform/smapi/BAT0/stop_charge_tresh=85
 
devices/platform/smapi/BAT1/start_charge_tresh=70
 
devices/platform/smapi/BAT1/stop_charge_tresh=90
 
 
# Default frequency scalling governor
 
devices/system/cpu/cpu0/cpufreq/scaling_governor=conservative
 
 
 
{{NOTE|Using the '''ondemand''' governor can do a number on your CPU power regulator, the '''conservative''' governor is a much better choice overall, and in fact is good enough at what it does that no userspace power governor daemon is needed, or even desired}}
 
 
 
==== udev rules ====
 
 
 
# udev extended network interface naming needs to be configured, order of tg3/ipw2200 won't be respected if {{path|/etc/modules.conf}} is read after udev did the PCI coldplugging.  Debian does this automatically, if you are lucky... check {{path|/etc/udev/rules.d/*persistent-net.rules}}.
 
# The thinkpad driver takes a long time to load and times-out udev every time.  To shed off this timeout from startup time, edit {{path|/etc/udev/rules.d/020_permission.rules}} and change the line containing '''WAIT_FOR_SYSFS="bus"''' to also have the following conditions: '''BUS!="serio", SUBSYSTEM!="serio"''''
 
 
 
==== Kernel/module configuration ====
 
 
 
This is done in /etc/modprobe.d/ files.  Install the setserial package.
 
 
 
Add a /etc/modprobe.d/thinkpad-t43 file there with this content:
 
# Intel Wireless, default to radio offline for safety and security
 
options ipw2200 disable=1 led=1 hwcrypto=1
 
 
# IrDA
 
alias irda0 nsc-ircc
 
options nsc-ircc dongle_id=0x09 io=0x2f8 irq=3 dma=3
 
install nsc-ircc /bin/setserial /dev/ttyS1 uart none port 0 irq 0; /sbin/modprobe --ignore-install nsc-ircc
 
 
 
References:
 
* [[How to make use of IrDA]]
 
 
 
==== laptop-mode-tools ====
 
 
 
Install and configure laptop-mode-tools to your liking.  If you really want to protect your HD when moving the ThinkPad around, laptop-mode-tools can help that dramatically by leaving the drive spun-down and parked most of the time.
 
 
 
==== Suspend2 ====
 
 
 
On top of what is usually done for ThinkPads, remember to set the acpi_sleep=s3_bios kernel option if you have an ATI GPU.  Suspend to RAM should be done using the default mode in ram.conf (RediSafe-like suspend-to-ram-with-backup-on-disk is possible, using Suspend2... but it takes 10 times more to suspend).
 
 
 
If you can do the suspend to ram without unloading any modules, it is much much faster.  This heavily depends on the kernel, as a lot of drivers are still quite buggy.
 
 
 
# Suspend to RAM mode reminders
 
UseSysfsPowerState mem
 
SaveClock restore-only
 
Unmount /media/*
 
IbmAcpi yes
 
 
 
# Suspend to disk mode reminders
 
UseSuspend2 yes
 
Unmount /media/*
 
UnmountFSTypes vfat msdos cifs smbfs ntfs nfs
 
IbmAcpi yes
 
 
 
==== acpi events ====
 
 
 
To setup the hotkey mask, {{path|/etc/default/acpi}} can be abused (it is a shell script fragment).
 
Just append this fragment to that file:
 
# ThinkPad ACPI setup
 
[ -w /proc/acpi/ibm/hotkey ] && echo enable,0x81c >/proc/acpi/ibm/hotkey
 
:
 
 
 
===== For suspend-to-ram (sleep) =====
 
 
 
The action scripts for suspend-to-ram control:
 
{{path|/etc/acpi/actions/lid-toggle.sh}}
 
#!/bin/sh
 
 
#
 
# Toggle sleep-on-lid-close functionality
 
#
 
 
LIDLCKFILE=/var/run/acpi-lid.lock
 
umask 022
 
 
if [ -r ${LIDLCKFILE} ] ; then
 
        rm -f ${LIDLCKFILE}
 
        echo 12 >/proc/acpi/ibm/beep || true
 
else
 
        touch ${LIDLCKFILE} && \
 
        echo 3 >/proc/acpi/ibm/beep || true
 
fi
 
:
 
 
 
{{path|/etc/acpi/actions/sleep.sh}}
 
#!/bin/sh
 
 
LIDLCKFILE=/var/run/acpi-lid.lock
 
 
 
# Check the reason we are running
 
case "$1" in
 
    button/lid)
 
        # do not run with the lid open
 
        grep -q open /proc/acpi/$1/$2/state && exit 0
 
        [ -r ${LIDLCKFILE} ] && exit 0
 
        ;;
 
esac
 
 
exec /usr/sbin/hibernate -F /etc/hibernate/ram.conf
 
 
 
{{path|/etc/acpi/actions/sleep-ramanddisk.sh}}
 
#!/bin/sh
 
 
LIDLCKFILE=/var/run/acpi-lid.lock
 
 
# Check the reason we are running
 
case "$1" in
 
    button/lid)
 
        # do not run with the lid open
 
        grep -q open /proc/acpi/$1/$2/state && exit 0
 
        [ -r ${LIDLCKFILE} ] && exit 0
 
        ;;
 
esac
 
 
exec /usr/sbin/hibernate -F /etc/hibernate/ramanddisk.conf
 
 
 
To use fn+f3 to control whether to sleep when lid is closed:
 
 
 
{{path|/etc/acpi/events/ibm_fn_f3}}
 
event=ibm/hotkey HKEY 0+80 0+1003
 
action=/etc/acpi/actions/lid-toggle.sh %e
 
 
 
To sleep when the lid is closed:
 
 
 
{{path|/etc/acpi/events/lid}}
 
event=button[ /]lid
 
action=/etc/acpi/actions/sleep.sh %e
 
 
 
To sleep to ram with a dump to disk when fn+f4 is pressed:
 
 
 
{{path|/etc/acpi/events/ibm_fn_sleep}}
 
event=button[ /]sleep
 
action=/etc/acpi/actions/sleep-ramanddisk.sh %e
 
{{path|/etc/acpi/events/ibm_fn_f4}}
 
event=ibm[ /]hotkey HKEY 0+80 0+1004
 
action=/etc/acpi/actions/sleep-ramanddisk.sh %e
 
 
 
===== For hibernation (suspend-to-disk) =====
 
 
 
Requires that ibm-acpi has hotkeys enabled, mask 0x0800.
 
 
 
{{path|/etc/acpi/events/ibm-fn-suspend}}
 
event=ibm[ /]hotkey HKEY 0+80 0+100[cC]
 
action=/usr/sbin/hibernate
 
 
 
===== Radio software switch (rf_kill) =====
 
 
 
If your radios have rf_kill support, the following script can be used to toggle them on or off:
 
 
 
{{path|/etc/acpi/actions/toggle_radios.sh}}
 
#!/bin/sh
 
 
set -e
 
 
cd /sys/class/net
 
state=0
 
 
# Find all radios, set state to the first one we find
 
for i in * ; do
 
        if [ -r "$i/device/rf_kill" ] ; then
 
                state=$(cat "$i/device/rf_kill")
 
                break
 
        fi
 
done
 
 
if [ $state != "0" ] ; then
 
        state=0
 
        txtstate="Enabling radio"
 
        echo 3 >/proc/acpi/ibm/beep || true
 
else
 
        state=1
 
        txtstate="Disabling radio"
 
        echo 12 >/proc/acpi/ibm/beep || true
 
fi
 
 
for i in * ; do
 
        if [ -w "$i/device/rf_kill" ] ; then
 
                echo $state > "$i/device/rf_kill"
 
                echo $txtstate $i
 
        fi
 
done
 
 
:
 
 
 
You could also improve the script to manipulate the bluetooth RF switch, see [[ibm-acpi]] for more information.
 
 
 
To bind that script to fn+f5 (requires ibm-acpi hotkeys enabled, and mask 0x0010):
 
 
 
{{path|/etc/acpi/events/ibm_fn_f5}}
 
event=ibm/hotkey HKEY 0+80 0+1005
 
action=/etc/acpi/actions/toggle_radios.sh
 
 
 
=== Software that needs packaging ===
 
{{NOTE|If nobody beats me to it, I will probably package them for official upload to Debian, and official Debian Sarge backports. This requires that the software be properly licensed first, of course}}
 
* hdapsd (a bit crude, needs a lot of work still)
 
* ipw2200/ieee80211 need adopting, and since they clash terribly with in-kernel support, they will only work right if we either convert them to be patch-based, or to detect that the user built with in-kernel ieee80211/ipw2200 enabled and abort the out-of-tree compilation.
 
 
 
=== Software that could benefit from re-packaging ===
 
* hsfmodem: should be easy to build out-of-tree in another machine other than the one it will be installed at
 
 
 
== External Links ==
 
* [http://www.debianhelp.co.uk/udev.htm udev interface naming guide]
 
* [http://members.optusnet.com.au/ckolivas/kernel/ ck desktop-kernel patches]
 

Revision as of 14:15, 28 January 2007

Who is Hmh?

I am a Debian Developer for quite a few years now, and the current maintainer of ibm-acpi, the Linux kernel driver for ThinkPad laptops.

I am also involved with the tp_smapi and HDAPS Linux drivers, as a beta-tester and power-user. I don't list myself as a developer for those projects because I have never contributed a single line of code to them, just suggestions and bug reports ;-)

My ThinkPads

I own just a simple T43 model 2687-DDU. It is a great machine, a very solid ThinkPad, with its own set of annoying quirks, just like any other IBM-era ThinkPad, the SATA-PATA bridge, tg3 noise and lack of support for AHCI being the worst ones IMHO.

Links