Linux on an Dell Latitude X1

I've been using Debian GNU/Linux quite successfully on a Latitude X1 notebook from Dell's factory outlet for some time. These are some notes on configuring it in a relatively sensible fashion. Lots of the information here is taken from other pages on setting up Linux on this type of laptop, such as those on the Dell page of Linux on Laptops. The information on "Traces of Martin's State" was particularly useful.

Dell also provide good manuals for the X1 which give you clear guidance on taking apart the laptop and putting it back together again. (I needed to do this to get a memory card out of the card reader at one point. In order to get to the back of the card reader you need to separate the laptop into many different pieces (for example, you need to remove the display) but I managed to get it back together again with no screws missing or left over. Strangely, this has actually improved the performance of the laptop, since I think I reattached the thermal-cooling assembly more firmly when reassembling it, which seems to have alleviated an overheating problem I was seeing...)

Installation

I used the i386 etch netinst CD from http://www.debian.org/devel/debian-installer/, resizing the NTFS parition down to have a gigabyte or so of free space, and then divided the rest between the root partition (50GB) and the swap (3GB). I don't really need the Windows installation, but thought I might as well keep it anyway. One thing you might want it for is to remove the region coding from the bundled external DVD drive. The USB DVD drive that I got is a SONY DVD+-RW DW-Q58A, which it turns out you can use LtnRPC on to disable the RPC2. The DOS version won't work with a USB drive, but the Windows one seems to work fine. You should do this, of course, since DVD region is utter nonsense.

The installation went completely smoothly, having selected a fairly minimal set of tasks in tasksel ("desktop environment", "web server", "laptop" and "standard system"). The following notes mention some things you'll probably have to do once the system is up:

Graphics

APT configuration

Kernel

Sound

Device Management

Miscellaneous Next Steps

Complete Packages

After any fairly minimal installation of Debian you have to apt-get install hundreds of packages by hand - rather than itemize these and the reasons I needed them, I've upload a list of my installed packages.

MMC / SD card slot

This works fine with the sdhci module in recent 2.6 kernels. (Well, with most cards anyway - I've tried a few that don't seem to work at all, but I suppose that might be the media.)

External DVD

The bundled external DVD player is just a USB mass storage device with an extra (proprietary) power connector, so it works fine out-of-the-box.

Bluetooth

I made sure the basic BlueZ utils (e.g. hcitool scan) worked OK (the hci_usb driver works fine).

gnome-bluetooth is very useful for OBEX file transfer but for some difficult-to-discern reason it isn't in Debian yet (although my memory is that it used to be...) So, I got the Ubuntu "Hoary" versions of the dependencies that aren't in Debian (python2.4-libbtctl, libbtctl1, libbtctl1-dev, libgnomebt0) and downloaded the source of gnome-bluetooth itself from the links on the Ubuntu gnome-bluetooth page. (You need to rebuild from source, since it depends on a later version of the python package than is available in Debian.) You should unpack the orig.tar.gz, patch with zcat gnome-bluetooth_0.5.1-1ubuntu7.diff.gz | patch --strip=0 --silent and make debian/rules executable. You probably need to try building it with dpkg-buildpackage -rfakeroot and then going back and satisfying the build dependencies. Build again (which should succeed) install the .deb file and check that gnome-obex-send and gnome-obex-server work OK.

Setting up dial-up networking over your mobile: Set a pin in /etc/bluetooth/pin and make the pin_helper application referenced in /etc/bluetooth/hcid.conf a script that does something like "echo PIN:1234". Use hcitool to find the bluetooth address of your phone and pair with your phone. Use sdptool to find the RFCOMM channel of the service that offers Dial-Up Networking on your phone and use rfcomm bind 0 <bluetooth-address> <rfcomm-channel>, create /etc/chatscripts/mobile as:

SAY "Starting /etc/chatscripts/mobile ..."
""           ATZ
OK           ATD*99#
CONNECT      ""

and /etc/ppp/peers/mobile

connect "/usr/sbin/chat -s -v -f /etc/chatscripts/mobile"
/dev/rfcomm0
115200
noipdefault
usepeerdns
defaultroute
noauth
nodetach
deflate 9,9
debug

That works OK for me...

Networking

To stop the wireless and ethernet randomly swapping between eth0 and eth1, I used ifrename with an /etc/iftab of:

eth5    mac 00:13:72:6A:AA:C5
eth6    driver ipw2200

This doesn't quite work unless you make sure that you have a /etc/modprobe.d/ipw2200 file which contains:

install ipw2200 /sbin/modprobe --ignore-install ipw2200; /sbin/ifrename

... and the modules are loaded beforehand, so I added tg3 and ipw2200 to /etc/modules. Also the /etc/init.d/ifrename script in the Debian package uses the undesirable (in my situation) -d option, so I removed that option from the script and put the package on hold.

The above steps should be sufficient to make sure that your ethernet interface is always eth5 and the wireless is always eth6. There are about a thousand different ways of setting up networking for a laptop on Debian, most of which are far too complicated, or have undesirable default behaviour. My preference is to use ifupdown "interfaces" files in as simple a way as possible. This is to create a series of interfaces files in /etc/network for all the different networking environments I find myself in (e.g /etc/network/interfaces/wireless-house) and have a script called switch-network that just lowers the current interfaces, copies over the file for the new situation and raises the intefaces again.

For example, this is the /etc/network/interfaces.wireless-central file I set up for the Edinburgh University central wireless network runs a script bluesocket that logs in and out of the Bluesocket authentication system on raising and lowering the interface:

auto lo eth6

iface lo inet loopback

iface eth6 inet dhcp
        wireless-essid central
        wireless-mode Managed
        post-up  su - mark -c "bluesocket"
        pre-down su - mark -c "bluesocket --logout"

Sometimes you need to use the post-up line to copy over a new /etc/resolv.conf, as in my /etc/network/interfaces.wireless.house:
auto lo eth6

iface lo inet loopback

iface eth6 inet static
        address 192.168.2.3
        netmask 255.255.255.0
        gateway 192.168.2.1
        wireless-essid house-network
        wireless-mode managed
        wireless-key1 XX:XX:XX:XX:XX
        post-up cp /etc/resolv.conf.wireless-house /etc/resolv.conf

This works pretty well for me. The other script which makes this system slightly less hassle is called guess-network, which uses mii-tool and iwlist scan to check whether it's possible to recognize a situation and call switch-network if so (like a very village guessnet). I call this in startup (as /rcS.d/S41guess-network) and after unsuspending (see below.) ifupdown stores the state when you shut down the computer, though, so I switch to the loopback only configuration on halting or rebooting via /rc6.d/S34switch-to-loopback and /etc/rc0.d/S34switch-to-loopback.

Suspend-to-RAM

The only type of power management I ever really use is suspend-to-RAM, which works fine with echo -n mem > /sys/power/state as long as you're not in X and you've removed a few of the more sensitive modules on your system (which includes the ipw2200 driver, so I switch to a loopback-only networking setup first):

#!/bin/sh

set -e
set -x

chvt 1

switch-network loopback

rmmod ipw2200
rmmod i2c_i801
rmmod i2c_core
rmmod tg3

echo -n mem > /sys/power/state

modprobe tg3
modprobe i2c_core
modprobe i2c_i801
modprobe ipw2200

chvt 7

guess-network

... but after closing and opening the lid to unsuspend, the backlight isn't turned back on automatically, so you need to do Fn + ↑ to turn the backlight back up.

lspci -v

In case it's of use to anyone who's thinking of buying one of these machines and wants to know exactly what hardware is in there, this is the result of lspci -v:

0000:00:00.0 Host bridge: Intel Corporation Mobile 915GM/PM/GMS/910GML Express Processor to DRAM Controller (rev 03)
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, fast devsel, latency 0
	Capabilities: <available only to root>

0000:00:02.0 VGA compatible controller: Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 03) (prog-if 00 [VGA])
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, fast devsel, latency 0, IRQ 169
	Memory at dff00000 (32-bit, non-prefetchable) [size=512K]
	I/O ports at ec38 [size=8]
	Memory at c0000000 (32-bit, prefetchable) [size=256M]
	Memory at dfec0000 (32-bit, non-prefetchable) [size=256K]
	Capabilities: <available only to root>

0000:00:02.1 Display controller: Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 03)
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, fast devsel, latency 0
	Memory at dff80000 (32-bit, non-prefetchable) [size=512K]
	Capabilities: <available only to root>

0000:00:1c.0 PCI bridge: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) PCI Express Port 1 (rev 03) (prog-if 00 [Normal decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=01, subordinate=01, sec-latency=0
	Memory behind bridge: dfd00000-dfdfffff
	Capabilities: <available only to root>

0000:00:1d.0 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #1 (rev 03) (prog-if 00 [UHCI])
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, medium devsel, latency 0, IRQ 169
	I/O ports at bf80 [size=32]

0000:00:1d.1 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #2 (rev 03) (prog-if 00 [UHCI])
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, medium devsel, latency 0, IRQ 201
	I/O ports at bf60 [size=32]

0000:00:1d.2 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #3 (rev 03) (prog-if 00 [UHCI])
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, medium devsel, latency 0, IRQ 209
	I/O ports at bf40 [size=32]

0000:00:1d.3 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB UHCI #4 (rev 03) (prog-if 00 [UHCI])
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, medium devsel, latency 0, IRQ 177
	I/O ports at bf20 [size=32]

0000:00:1d.7 USB Controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) USB2 EHCI Controller (rev 03) (prog-if 20 [EHCI])
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, medium devsel, latency 0, IRQ 169
	Memory at ffa80800 (32-bit, non-prefetchable) [size=1K]
	Capabilities: <available only to root>

0000:00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev d3) (prog-if 01 [Subtractive decode])
	Flags: bus master, fast devsel, latency 0
	Bus: primary=00, secondary=02, subordinate=03, sec-latency=32
	Memory behind bridge: dfc00000-dfcfffff
	Prefetchable memory behind bridge: 0000000060000000-0000000061f00000
	Capabilities: <available only to root>

0000:00:1e.2 Multimedia audio controller: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Audio Controller (rev 03)
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, medium devsel, latency 0, IRQ 169
	I/O ports at ed00 [size=256]
	I/O ports at ec40 [size=64]
	Memory at dfebfe00 (32-bit, non-prefetchable) [size=512]
	Memory at dfebfd00 (32-bit, non-prefetchable) [size=256]
	Capabilities: <available only to root>

0000:00:1e.3 Modem: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) AC'97 Modem Controller (rev 03) (prog-if 00 [Generic])
	Subsystem: Conexant: Unknown device 5423
	Flags: medium devsel, IRQ 201
	I/O ports at ee00 [size=256]
	I/O ports at ec80 [size=128]
	Capabilities: <available only to root>

0000:00:1f.0 ISA bridge: Intel Corporation 82801FBM (ICH6M) LPC Interface Bridge (rev 03)
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, medium devsel, latency 0

0000:00:1f.1 IDE interface: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) IDE Controller (rev 03) (prog-if 8a [Master SecP PriP])
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, medium devsel, latency 0, IRQ 169
	I/O ports at <ignored>
	I/O ports at <ignored>
	I/O ports at <ignored>
	I/O ports at <ignored>
	I/O ports at bfa0 [size=16]

0000:00:1f.3 SMBus: Intel Corporation 82801FB/FBM/FR/FW/FRW (ICH6 Family) SMBus Controller (rev 03)
	Subsystem: Dell: Unknown device 01a3
	Flags: medium devsel, IRQ 10
	I/O ports at 10c0 [size=32]

0000:01:00.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI Express (rev 01)
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, fast devsel, latency 0, IRQ 169
	Memory at dfdf0000 (64-bit, non-prefetchable) [size=64K]
	Capabilities: <available only to root>

0000:02:01.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev b3)
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, medium devsel, latency 168, IRQ 177
	Memory at dfc00000 (32-bit, non-prefetchable) [size=4K]
	Bus: primary=02, secondary=03, subordinate=06, sec-latency=176
	Memory window 0: 60000000-61fff000 (prefetchable)
	Memory window 1: 62000000-63fff000
	I/O window 0: 00001400-000014ff
	I/O window 1: 00001800-000018ff
	16-bit legacy interface ports at 0001

0000:02:01.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C552 IEEE 1394 Controller (rev 08) (prog-if 10 [OHCI])
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, medium devsel, latency 64, IRQ 209
	Memory at dfcfe800 (32-bit, non-prefetchable) [size=2K]
	Capabilities: <available only to root>

0000:02:01.2 0805: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 17) (prog-if 01)
	Subsystem: Dell: Unknown device 01a3
	Flags: bus master, medium devsel, latency 64, IRQ 10
	Memory at dfcfe700 (32-bit, non-prefetchable) [size=256]
	Capabilities: <available only to root>

0000:02:03.0 Network controller: Intel Corporation PRO/Wireless 2200BG (rev 05)
	Subsystem: Intel Corporation: Unknown device 2721
	Flags: bus master, medium devsel, latency 64, IRQ 201
	Memory at dfcff000 (32-bit, non-prefetchable) [size=4K]
	Capabilities: <available only to root>