Debian Project on an IBM ThinkPad T40p


Table of Contents

  1. Changes
  2. Introduction
  3. BIOS
  4. Video Blanking
  5. ACPI (APM)
  6. udev
  7. X11
  8. Mice
  9. PCMCIA
  10. USB
  11. Sound
  12. Ethernet
  13. Infrared
  14. Built-in Wireless
  15. Built-in Bluetooth
  16. Built-in Modem
  17. Built-in Security Chip
  18. Burning CDs
  19. Saving Power
  20. Palm
  21. Getting tpctl to Work
  22. References

Changes

2009-02-22 Update for lenny and kernel 2.6.26. ACPI is solid and hibernate now works out of the box. The ehci-hcd driver now works. Now using the ath5k driver. The thinkpad_acpi module has replaced the tpctl program.

2006-09-11 The modem works.

2006-03-16 Add information about BIOS upgrade.

2006-03-10 Update for etch and kernel 2.6.15. No more BIOS changes needed. Describe the Synaptics mouse driver and syndaemon for disabling the touchpad while typing. PCMCIA now works out of the box. Note that the modutils and hotplug packages have been deprecated and misbehaving USB modules can be blacklisted in /etc/modprobe.d/local. Update interesting /etc/network/interfaces (see Ethernet). A madwifi-source package is now available. The files in the bluez-utils are now called bluetooth. Update APM script. Note that tpctl and the thinkpad-modules package is obsolete under ACPI, but included newer, easier build instructions.

2005-07-26 Can now HotSync to a Treo via Bluetooth and use the Treo as a modem (see Bluetooth). Updated the Palm section accordingly.

2005-07-06 After I deleted the 2.4 kernel-image package, I deleted the modutils package which is not needed by the 2.6 kernel. The module-init-tools package takes its place. I then moved /etc/modutils/newt to /etc/modprobe.d/local, although at present, all entries are commented out and don't seem to be needed.

2005-06-20 After switching to udev (I think), I had to add ircomm_tty to /etc/modules to make /dev/ircomm0 appear (see Infrared).

2005-06-03 Switched back to APM to get suspend. Additional 2.6 updates including instructions for upgrading from devfs to udev.

2004-11-23 Note that T40 doesn't have the same ACPI issues as the T40p. Added instructions for accessing the IPW2100 wireless chip.

2004-10-23 Mentioned that some of the older sound configuration might be obsolete. Added info about tpb to the X11 section, a cool tool which has an on-screen display of the volume and mute buttons as one of its features.

2004-10-20 With a recent fresh install to sarge, I found that I could no longer compile VMware and the MADWIFI drivers (if I remember correctly) so I switched to 2.6. As a result, I've had to update nearly every section in this document. Whether the information pertains to older 2.4 systems or the newer 2.6 system is indicated. I've also upgraded the disk to a 60 GB, 7200 RPM, model and added another 512 MB of memory. The ACPI and Devfs sections are new.

2004-06-13 Added some more references.

2004-01-07 Compiling MADWIFI changes a little with kernel 2.4.23.

2003-09-05 I found you don't have to reboot to use the USB ports on the dock; instead, don't load the ehci-hcd module (see USB).

2003-08-11 In order for USB ports on dock to work, you have to boot in the dock with the devices attached (see USB). Added link to IR section in Palm section (see Palm).

2003-08-06 Added information to Built-in Wireless section and Built-in Bluetooth sections to get these things working. Many thanks to Brad Langhorst for the tips.

2003-07-05 Added note that tpctl must be used to turn off blanking if apmiser is in use (see Video Blanking).

2003-06-30 New section that describes how to build thinkpad-modules even if you only have the kernel-image and kernel-headers packages. Many thanks go to Ross Burton (see Getting tpctl to Work). Use tpctl -ptB=disable to accomplish the same thing as the BIOS tweaks (see Video Blanking). Suspending the system with a card installed is generally a problem on AC power, not just if the laptop is docked (see PCMCIA). Updated interfaces file which allows eth0 to use DHCP and as a result doesn't bring up the interface at boot time in case the laptop is off the net (see Ethernet). Added request for information about turning off device in order to conserve batteries (see Infrared). Added /etc/default/cdrecord entries for running cdrecord directly with a minimum of fuss (see Burning CDs). Now that tpctl works, document apmiser (Saving Power). New cradle gets us closer to syncing with USB, but no cigar (see Palm).

2003-06-27 Disabled touchpad in the BIOS to eliminate accidental discharge and to regain control of the middle mouse button (see Mice). Documented (as of yet unsuccessful) trials and tribulations with thinkpad-modules in an effort to enable tpctl and lower power consumption (see Saving Power). Don't need to restart esd if sound stops due to load; use esdctl (see Sound).

Introduction

I purchased the T40p because I had once owned a ThinkPad that I just loved, because IBM is pretty Linux-friendly, and because this laptop got some pretty great reviews and had the features I was looking for: long battery life, thin, light, fast, an expansion bay. And it still has a light!

Because this laptop contains pretty bleeding-edge hardware, there are some rough edges in regards to Linux, but I'm not disappointed, and I know that I will either figure out the issues, or the drivers will catch up eventually.

I purchased the ThinkPad T40p (model number 2373G1U) with the following specs:

In addition, I picked up the 72W AC/DC combo and the mini-dock.

I'm currently running etch with pieces of sid and a 2.6.15 kernel. I don't bother to build kernels and use the stock linux-image-2.6-686 package. Similarly, the instructions below (for the most part) do not involve downloading and compiling software, but rather describe tweaks to the Debian packages.

Klaus Weidner's Running Debian Linux on an IBM Thinkpad T40 (previously at http://www.w-m-p.com/linux-on-t40.html) document suggested a few things to do before starting. I didn't do them. I simply turned on my laptop, booted XP, shrunk the XP partition with Partition Magic, and partitioned the disk during the Debian install. When I first installed Debian GNU/Linux, my BIOS said that the reserved area was protected and it appeared that way within both Partition Magic and fdisk as these tools said I had a 36 GB drive when I really had a 40 GB drive. So I'm assuming that my system was set up a little differently and the predesktop area wasn't simply appended to my free space.

Later on, when I installed the 60 GB drive, I disabled the predesktop area in the BIOS and installed Debian GNU/Linux onto the entire drive.

2009-02-22 I'm now running lenny and still running a stock kernel (2.6.26).

BIOS

Before you get started, you need to make a couple of changes to the BIOS. Running Debian Linux on an IBM Thinkpad T40 (previously at http://www.w-m-p.com/linux-on-t40.html) suggests splitting resources rather than use the default value of 11 for all interrupts. Indeed, I encountered the following log message:

PCI: Device 00:1f.1 not available because of resource collisions
    

Since the serial device /dev/ttyS0 got IRQ 4, the infrared device /dev/ttyS1 (mapped to /dev/ircomm0 by irattach) got IRQ 3, the printer got IRQ 7, and the legacy floppy hardware was disabled (freeing IRQ 6), I laid out the IRQs as follows:

INTA PCI IRQ 5
INTB PCI IRQ 6
INTC PCI IRQ 9
INTD PCI IRQ 10
INTE PCI IRQ 11
INTF PCI IRQ 5
INTG PCI IRQ 6
INTH PCI IRQ 9
    

Follow the directions in the sections on Video Blanking and Mice for more BIOS manipulation.

2006-03-10 After a recent motherboard replacement due to faulty video, I didn't mess with the BIOS at all and the errors I reported above have not been seen. But I'll leave this section alone for now in case it is useful.

2006-03-16 Back on 2005-01-27, I had upgraded the BIOS but neglected to talk about it here. I first downloaded the executables for the BIOS (1ruj27us.exe) and Embedded Controller (1rhj10us.exe) onto a memory stick (the links may be stale, just go to the IBM site and search for thinkpad t40p bios upgrade non-diskette). I then booted Windows, and double-clicked first on the Embedded Controller executable followed by the BIOS executable after carefully reading the READMEs. Both installed smoothly and without incident.

Video Blanking

With kernel 2.4, video blanking hangs Linux. Once the video has been turned off, you can't even ping the machine. The video can be turned off via the BIOS APM and by hitting "Fn-F3" or "Fn-F7". While these keystrokes can be avoided, you have to run tpctl --pm-timer-mode-blank-display=disable or make the following BIOS modification in order to keep the system from doing it to you:

Config
    Power
        Power Mode for AC                              [Customized]
        Power Mode for Battery                         [Customized]
        Customize
	    LCD off timer                              [Disabled]
    

Note that since apmiser undoes the BIOS setting when it sets the power mode to automatic on battery; you must use tpctl to turn off blanking. I've added the command above to a script called /etc/init.d/rc.boot and linked to it from /etc/rc* so that it is always run when the system is booted.

With kernel 2.6, the blanking no longer hangs the system. However, the BIOS still thinks I'm idle as I hammer on my USB keyboard, so I still use tpctl to turn off blanking.

With ACPI, the "Fn-F3" hotkey doesn't do anything so this isn't an issue. If you have any information about how to get "Fn-F3" to work under ACPI, please let me know.

ACPI (APM)

The 2.6 kernel has ACPI compiled in; as such it keeps APM from engaging. To make use of ACPI, you need to install the acpid package. When I did, it hung my system when I was on batteries. I found it installed on power, but then my system hung when I went from AC to batteries. I fixed this problem by removing processor and thermal from /etc/default/acpid:MODULES. On the other hand, acpid with these modules worked fine on my T40 at work, so your mileage may vary.

The suspend function in ACPI does not work out of the box. Others have gotten it to work, but it has involved kernel patches and other work. See ibm-acpi and Linux Thinkpad Archives in the References.

In the meantime, I've gone back to APM. With a 2.6 kernel, you have to turn off ACPI to use it. This is done by adding acpi=off to your kernel options. For example, in /boot/grub/menu.lst, I have this:

# kopt=root=/dev/hda1 acpi=off ro
    

Don't forget to run update-grub after modifying menu.lst. I also added apm to /etc/modules.

2006-03-10 I tried ACPI again and found that the processor and thermal modules no longer hang the system (and it's nice to be able to see the temperature). However, suspend on ACPI still hangs my system so once again I reverted to APM.

2009-02-22 I've been running ACPI for some time now. Both suspend and hibernate are working fine out of the box.

Devfs and udev

Devfs and udev create devices dynamically so you don't have to use MAKEDEV to create devices in /dev.

Devfs is used in 2.4 systems and requires a kernel option setting of devfs=mount. For example, in /boot/grub/menu.lst, you might have this:

# kopt_2_4=root=/dev/hda1 devfs=mount ro
    

Don't forget to run update-grub after modifying menu.lst.

Install and run the devfsd package if you're using devfs and the udev package if you're using udev. You'll notice longer filesystem names in the output of df.

Devfs is obsolete in 2.6 systems; use udev instead. If you had previously added the devfs=mount kernel option, you can remove it and the devfsd package. Consider this if you remove the 2.4 kernel from your system.

X11

If you're running woody, you might get by using the vesa driver (I did for a while). Otherwise, you can use the ati driver.

If applications such as xine come up in black and white, use a depth of 16 instead of 24. At any rate glxgears runs twice as fast at a 16-bit depth.

Klaus suggested that the agpgart module should be loaded, but this probably won't load on a woody system running 2.4. It now loads just fine on sarge running 2.6.

The tpb package is very neat. It contains an on-screen display for the volume buttons, among other things. Unfortunately, it suffers from the same problem as does other X11 startup programs such as xmodmap in that it doesn't start properly under GNOME 2.6. To work around this problem, go into /etc/default/tpb and set START to false. Then start the daemon yourself after a short delay. For example, I have the following in my ~/.gnomerc file:

(sleep 10; xmodmap ~/.Xmodmap; tpb -d)&
    

You'll also need to add the nvram module to /etc/modules and add yourself to the nvram group.

Mice

The touchpad and stick both work out of the box. The touchpad works even better after installing the xfree86-driver-synaptics package. I modified the default behavior with the following stanza in /etc/X11/xorg.conf which allows synclient to communicate with the X server, modifies the awesome circular scrolling a bit, and makes the touchpad a little less sensitive.

Section "InputDevice"
	Identifier  	"Touchpad"
	Driver  	"synaptics"
	Option		"SendCoreEvents"	"true"
	Option		"Protocol"		"auto-dev"
	Option		"SHMConfig"		"on" # enables synclient
	Option		"CircularScrolling"	"on"
	Option		"CircScrollTrigger"	"3" # vertical scroll triggers
	Option		"FingerHigh"		"75" # avoid accidental press
EndSection
    

I also added syndaemon -d -k to ~/.gnomerc to disable the touchpad while typing.

I used to have to edit /etc/default/hotplug to enable a USB mouse:

X11_USBMICE_HACK=true    
    

I then ran the following command:

# chmod 666 /dev/input/mice
    

With my current setup (2.6 kernel and xorg 6.8.2), these things are no longer necessary.

After suspending or placing the laptop in the mini-dock with the 2.4 kernel and APM, you have to run the following to get the USB mouse working again. This is automated in the APM Script section, below:

# /etc/init.d/hotplug restart
    

Once, a long time ago, before I had installed the Synaptics TouchPad driver, the middle button didn't work. Klaus indicates this is a flaw in the PS/2 driver. I had disabled the touchpad in the BIOS which resulted in two immediate benefits at the loss of the touchpad:

PCMCIA

PCMCIA works out of the box if you're using kernel version 2.6.13 or later which uses the pcmciautils package. However, if you're using an older system, you may see the following errors when loading PCMCIA modules in the deprecated pcmcia-cs package.

Starting PCMCIA services: modulesinsmod: a module named pcmcia_core already exists
/lib/modules/2.4.20-1-686/pcmcia/i82365.o: unresolved
 symbol isapnp_find_dev_R27cb2cad
/lib/modules/2.4.20-1-686/pcmcia/ds.o: init_module: Operation not permitted
Hint: insmod errors can be caused by incorrect module  parameters,
 including invalid IO or IRQ parameters.
You may find more information in syslog or the output from dmesg.
    

This can be fixed by editing /etc/default/pcmcia as follows:

PCIC="yenta_socket"
    

One problem I used to have with the PCMCIA software was with closing or suspending the laptop with the card inserted while it was docked or otherwise on AC power. This could freeze the system in a similar fashion to the video freeze. The workaround for this was to take the card out before suspending in the dock or to remove the laptop from the dock before suspending. It could then be safely put back in the dock or plugged in. I haven't seen this behavior in a while though.

USB

Whether you use APM or ACPI, you have to stop hotplug (if you're still using it) and unload the USB modules before suspending; otherwise, the system may freeze. See the APM Script section below to do this automatically.

In addition, you may find that you need to blacklist some modules. My entire blacklist is shown here even though not all of the entries are related to USB. The first example is my current blacklist in /etc/modprobe.d/local.

# Prevents USB devices in docking station from being seen.
blacklist ehci_hcd
    

The second example is my old blacklist in /etc/hotplug/blacklist.d/local which I used before the functionality of the hotplug package was moved into modprobe and udev and the package was deprecated. As you can see, not so many modules need to be blacklisted these days.

# Triggers modprobe errors.
hw_random

# Not present under APM. Comment out under ACPI.
shpchp

# Needed in kernel versions prior to 2.6.11.
#pciehp

# Needed in 2.4.
#uhci

# Prevents USB devices in docking station from being seen.
ehci-hcd

# Keeps system from coming back from suspend.
radeonfb

# If usbmouse is installed, the wireless mouse only goes up and down.
# Don't know if this module is the problem, or contention with mousedev.
usbmouse
    

See the section on mice for more information.

2009-02-22 I'm no longer having problems with the ehci-hcd driver.

Sound

If you're running 2.6 and ALSA drivers (which is the case if you're running sarge circa 2004-10-19), you can still use ESD to serialize your sound. ESD users can simply replace the libesd0 package with libesd-alsa0. Then run alsaconf (if you're running a pre-lenny system); otherwise, you won't have any sound. I hit return to all of the OK prompts which seemed to do the right thing.

Suspending the system hangs sound. The apm software seems to be adding the i810_audio module upon restore, and this must confuse esd. Restarting esd fixes this too. This is done in the APM Script section below.

Before the upgrade to 2.6 and ALSA, I had previously added the following to a file in /etc/modutils such as local:

alias sound-slot-0      i810_audio
alias sound-service-0-3 i810_audio
alias sound-service-0-6 i810_audio
    

Run update-modules to add these lines to /etc/modules.conf. Under 2.6, the /etc/modutils directory is obsolete. In addition, these lines are no longer necessary in /etc/modprobe.d with 2.6 and discover.

If there is load, the sound drops out intermittently and sometimes will eventually shut down all together. If this happens, simply run esdctl off; esdctl on to bring back the tunes. However, I haven't seen this behavior in a long time.

Ethernet

With 2.6 and the discover package installed, the Ethernet module is loaded automatically.

In older systems with the obsolete modutils package, add the following to a file in /etc/modutils such as local:

alias eth0              e1000
    

Run update-modules to add this line to /etc/modules.conf.

Even if you're not using the Ethernet port, you might need to keep it up. Before I was using the internal wireless with the madwifi drivers, I found if I did an ifdown eth0 and removed my Cisco PCMCIA card, then cardmgr would hang. The cardmgr comes back immediately after running ifup eth0 though. If you're using DHCP and your Ethernet isn't connected, things get, uh, interesting if you get in a position where you need to bring eth0 up to unfreeze things. I imagine I'll have to get creative if I don't have a ready and willing Ethernet cable. Like bringing up eth0 with a bogus static address.

Here is a sanitized version of my /etc/network/interfaces file.

#
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/netbase/examples for more information.
#
auto lo ath0

iface lo inet loopback


# General interfaces.
iface dhcp inet dhcp
	up update-relayhost mail.newt.com

iface static inet static
	address 191.168.0.4
	netmask 255.255.255.0
	up update-relayhost mail.newt.com


# eth0 interfaces.
iface eth0 inet dhcp
	up update-relayhost mail.newt.com

iface netcom inet ppp
	provider netcom-provider
	up update-relayhost mail.newt.com

iface maui inet ppp
	provider maui-provider
	up update-relayhost mail.newt.com
	
iface dsl inet ppp
	provider dsl-provider
	# please do not modify the following line
	pre-up /sbin/ifconfig eth0 up # line maintained by pppoeconf
	up update-relayhost mail.newt.com


# ath0 interfaces.
iface open inet dhcp
	up update-relayhost mail.newt.com

iface ath0 inet dhcp
	wireless_nick olgas
	wireless_essid <mySSID>
	wireless_channel <a nice unused channel>
	wireless_key <myKey>
	up update-relayhost smtp.earthlink.net

iface adhoc inet dhcp
	wireless_mode ad-hoc
	up update-relayhost mail.newt.com

iface work inet dhcp
	wireless_essid <workSSID>
	wireless_key <workKey>
	up update-relayhost mail.newt.com


# ppp0 interfaces
iface ppp0 inet ppp
	provider t-mobile
	up update-relayhost --addroute mail.newt.com
    

The update-relayhost is a simple Perl script to update the relay host in /etc/postfix/main.cf. The non-default stanzas can be invoked like this:

# ifup ath0=work
    

Infrared

Strangely, findchip does not recognize the IR device. However, the IR device works.

When configuring the irda-common package:

  1. Enable IrDA.
  2. Select serial IrDA device type.
  3. Set serial device to /dev/ttyS1.
  4. Set dongle type to none.
  5. Set discovery mode to No (although Yes doesn't seem to hurt).

The program irattach is launched by /etc/init.d/irda and makes the IR device visible at /dev/ircomm0. After switching to udev (I think), I had to add ircomm_tty to /etc/modules to make /dev/ircomm0 appear.

Since FIR can do 4 MB, it would be cool to use it so please let me know if you can.

It would also be cool to turn off the device when not in use in order to preserve the batteries. Please let me know if you know how to do this too.

Built-in Wireless

The ThinkPads I've used contain either an Atheros wireless chip, or the Intel IPW2100 chip.

If you've got the Atheros chip, and are running etch or better, you can install the madwifi-source package and follow the directions in /usr/share/doc/madwifi-source/README.Debian which uses the module-assistant package as follows:

$ m-a prepare
$ m-a a-i madwifi
    

Otherwise, download the latest from Multiband Atheros Driver for WiFi (MADWIFI) SourceForge project, and run:

# make clean install
    

If this doesn't work for you, ensure that /usr/src/linux points at your kernel (either a kernel-source or kernel-headers directory), and run

# make KERNEL_PATH=/usr/src/linux CONFIG_SMP= CONFIG_MODVERSIONS=yes install
    

Specify the proper KERNEL_PATH. If you get unresolved symbols when running depmod, define CONFIG_MODVERSIONS. Clearing CONFIG_SMP isn't strictly necessary but since I'm not running an SMP kernel, I thought it would be best.

With later versions of madwifi, I've been getting away with just:

$ make clean all
$ sudo make KERNELRELEASE=2.6.10-1-686 install
    

If you have a T40 with the IPW2100 wireless chip instead, then install the ipw2100-source package and follow the instructions in /usr/share/doc/ipw2100-source. The module-assistant program didn't work for me initially, so I called debian/rules directly. I installed the .deb, downloaded the firmware as directed, and the driver worked fine. I didn't have to add the module to /etc/modules since discover at boot appears to load it just fine.

Later on, I was able to use the module-assistant package as follows:

$ m-a prepare
$ m-a a-i ipw2100    
    
The program module-assistant (m-a for short) even calls sudo and does the installation for you.

No matter which chip you have, the next step is to ensure that you have an ath0 entry in /etc/network/interfaces (see Ethernet) and an ath0 alias in a file in /etc/modprobe.d (/etc/modutils in older systems) such as local:

alias ath0		ath_pci
    

If you're using the obsolete modutils package, run update-modules to add this line to /etc/modules.conf.

2009-02-22 I'm now using the built-in ath5k driver and avoiding all of the extra steps described above. WEP isn't working with my card though, so I limit my router to my MAC address.

Built-in Bluetooth

Simply press "Fn-F5". The Bluetooth light will go on and the hotplug system will load the bluez module.

To use devices like the Palm Treo 650, you also need to install the bluez-utils package. Then change the content of /etc/bluetooth/pin to your personal pin and restart bluez-utils with /etc/init.d/bluetooth restart (or /etc/init.d/bluez-utils restart on older systems).

Once configured, you can HotSync your Treo over the Bluetooth connection. You can also use the Treo as a modem! See Using the Palm Treo 650 with Debian GNU/Linux.

If you find a Bluetooth keyboard and mouse that work, let me know. A nice pair of Bluetooth headphones would also be cool.

Built-in Modem

To use the modem, install the sl-modem-daemon package which runs the slmodemd daemon. This daemon loads the snd-intel8x0m module and creates the device /dev/pts/0 with aliases /dev/ttySL0 and /dev/modem. Then, use pppconfig to create a provider using the defined device or an alias (I used /dev/modem). Once you've defined a provider, create the connection with pon provider, or add the following to /etc/network/interfaces and use ifup ppp0 to bring up the interface.

iface ppp0 inet ppp
        provider provider
      

Built-in Security Chip

I haven't investigated how this plays with Linux (or for XP for that matter). Please let me know if you do.

Burning CDs

This works fine. I just use the CD Creator feature of nautilus most of the time. I sometimes use the eroaster package.

I've also used gcombust package in the past: I had to set the SCSI device to 0,0,0 and speed to 16, and turned on the burn-free option.

I modified CDR_DEVICE and added a line to /etc/default/cdrecord as follows so I can crank out tarballs on CDs quickly with tar -cf - file... | cdrecord -v -pad -:

CDR_DEVICE=matshita
matshita=	0,0,0	-1	-1	burnfree
    

Saving Power

I used to use the noflushd package and apmiser daemon from the tpctl packages, but haven't since I upgraded to 2.6 and the ext3 filesystem. Please let me know if you have some good tricks for saving power.

Palm

The Palm can be synced over the serial cable. Set the conduit to use /dev/ttyS0.

The Palm can be synced with the IR device. Set the conduit to sync over /dev/ircomm0 (see IR for instructions on creating this device).

Pushing the hotsync button doesn't stimulate any activity on the USB at all. Not one log message. However, this is most likely due to the static problem as documented in New m500 series USB Sync Problem Solution. See also the section on USB. Indeed, I received a new USB cradle so that the system now sees the Palm. However, the hotsync still doesn't occur. Unplugging the battery as described in the solution didn't bring any relief to me, so perhaps the USB chip on my Palm is fried beyond belief.

This situation is a bit better with the Treo 650, but it still suffers from a timing issue. For more information about this issue and how to HotSync using Bluetooth which is infinitely better anyways, see Using the Palm Treo 650 with Debian GNU/Linux.

APM Script

When I used APM, I used this script in /etc/apm/event.d/local to work around a couple of the problems documented above. The stop-networks script simply runs ifdown on all networks save for lo.

#! /bin/sh

# The ath_pci (used with the wireless network) and uhci_hcd (used with
# USB devices on docking station and Bluetooth) modules don't recover
# after suspending under 2.6 and udev. So, take down all networks upon
# suspend. Remove and insert uhci_hcd upon resume. The networking
# scripts will handle resetting the ath_pci module.
#
# Finally, esd gets hosed after a suspend and resume, so kill it
# before suspending and start it on resume. Starting it as wohler is
# ugly, but works.
#
# See apmd(8) for a description of the parameters passed to this script.

case "$1,$2" in
suspend,*)
    /usr/local/sbin/stop-networks
    killall esd
    # Workaround for an nmbd bug (see Debian BTS #348766). During
    # suspend/resume, nmbd exits without cleaning up its pid file, which
    # later causes problems in logrotate.
    /etc/init.d/samba stop
    ;;

resume,*)
    modprobe -r uhci_hcd ath_pci
    modprobe uhci_hcd
    /etc/init.d/samba start
    su wohler esd &
    ;;
esac

exit 0
    

Getting tpctl to Work

This program requires the thinkpad module. Note that neither this program nor the thinkpad module are needed under recent systems using ACPI and the ibm-acpi module.

If, like me, you're still using APM, you can install the thinkpad-source package and install using the instructions in /usr/share/doc/thinkpad-source/README.Debian.gz which uses the module-assistant package as follows:

$ m-a prepare
$ m-a a-i thinkpad
    

I used to have to build the thinkpad-modules package with the kernel-headers package using steps like the following:

$ cd /usr/src/kernel-headers-2.4.27-1-686
$ make-kpkg --rootcmd=fakeroot modules_image --append-to-version -1-686
$ cd ..
# dpkg -i thinkpad-modules-2.4.27-1-686_5.5-1+2.4.27-2_i386.deb
    

If you're running an older system and this doesn't work for you, then you can follow Ross Burton's instructions to compile the thinkpad-modules package. I can't improve on Ross' explanation, so here it is in its entirety:

Bill,

I hacked a bit, but I managed to build thinkpad-modules using only
kernel-headers-2.4.21-1-686.  I unpacked /usr/src/thinkpad.tar.gz into
/tmp, and opened modules/thinkpad/debian/buildpkg and rules.

debian/buildpkg assumes it can find the top-level kernel source Makefile
to extract version information from. Line 72 contains a line which does
this magic, I removed it and replace it with a hard-coded version
number:

-KVERS="`getlinuxvar VERSION`.`getlinuxvar PATCHLEVEL`.`getlinuxvar SUBLEVEL``getlinuxvar EXTRAVERSION`"
+KVERS=2.4.21-1-686

debian/rules assumes you can write into /usr, if you build as root this
is fine but I prefer not too. So on line 75, remove the --destdir option
to dh_builddeb:

-dh_builddeb --destdir=$(KSRC)/..
+dh_builddeb

Now you can run debian/buildpackage, telling it where the kernel source
is (the kernel headers package) and what compiler to use. I think that
2.4.21 is build with GCC 3.2.

CC=gcc-3.2 KSRC=/usr/src/kernel-headers-2.4.21-1-686/ fakeroot debian/buildpkg

This builds me a .deb in the parent folder, which appears to work okay.

I'll file a bug with thinkpad-source saying that it build without the
full source, so the package should support it.

Regards,
Ross
    

2009-02-22 The tpctl program has been obsolete for some time. It has been replaced by the thinkpad_acpi module.

References

Klaus Weidner, Running Debian Linux on an IBM Thinkpad T40, previously at http://www.w-m-p.com/linux-on-t40.html.

Theodore Ts'o, Linux on T40p, http://www.thunk.org/tytso/linux/t40.html .

Fabrice Bellet, Linux on the Thinkpad T40, http://bellet.info/laptop/t40.html .

William R. Sowerbutts, Using an IBM ThinkPad T41P with Debian GNU/Linux, http://sowerbutts.com/thinkpad/ .

The Linux-Thinkpad Archives, http://mailman.linux-thinkpad.org/pipermail/linux-thinkpad/ .

Linux on Laptops, http://www.linux-on-laptops.com/ .

Linux On Mobile Computers: Laptop & Notebook Installation Guides: Lenovo (formerly IBM), http://www.tuxmobil.org/ibm.html .

ThinkWiki (Linux Thinkpad Wiki), http://www.thinkwiki.org/ .

ibm-acpi - IBM ThinkPad ACPI Extras Driver, http://ibm-acpi.sourceforge.net/ .

Peter Österlund, Synaptics TouchPad driver for XOrg/XFree86, http://web.telia.com/~u89404340/touchpad/ .

Linux Infrared HOWTO, http://www.tldp.org/HOWTO/Infrared-HOWTO/ .


by-nc-nd Best Viewed With YOUR Browser Valid HTML 4.01! Valid CSS! Powered by Debian GNU/Linux
Free DNS