The Dell Latitude C640 laptop and linux

Work got me a Dell Latitude C640 laptop, and since the pages people wrote about their experiences installing it helped me a lot, I wanted to share my experiences which might help other people. Stuff here: The descriptions of the success and the failures with several mobile phones have moved to their own pages:

The machine delivered

The laptop came with Windows XP home edition installed. I did want to keep some windows bits so I can boot Windows if needed. So the co worker who knows a lot more about Windows XP used Partition Magic to resize the WinXP partition to 10G.

The distro

I like and know Debian, so I installed that. First using a Sarge (debian testing) CD but that delivered a non-working Debian (must have been a bad day for the Debian testing installer). So I got a Debian Woody CD and did a minimalist install (make system running) and used apt-get dist-upgrade to upgrade it to Debian Sarge and then started adding packages. Which got me a working system.

XFree86

I used settings from pages linked from the Linux laptop pages. X runs nicely with XFree86 4.2.1 using the Radeon driver:
(II) Primary Device is: PCI 01:00:0
(II) ATI:  Candidate "Device" section "Generic Video Card".
(--) Assigning device section with no busID to primary device
(--) Chipset ATI Radeon Mobility LW (AGP) found
A nitpick is that the screen is screwed up after a suspend/resume or screensave. Fix: ctrl-alt-f1 (console 1), fn-d (blank display), shift (unblank), alt-f7 (back to X).

A better touchpad driver

The touchpad has the option to detect a tap and see it as a mouse button. Thanks but no thanks. There are really nice mouse buttons real close to the touchpad area that do that just fine, I'll press those when I need a mouse button. So, I got the special synaptics driver and installed that in XFree. Problem solved.

Audio

Audio uses the i810_audio module from the Linux kernel. Works. Sometimes 'sox' hangs when started from gkismet, keeping the audio driver occupied.
Intel 810 + AC97 Audio, version 0.24, 21:24:50 Sep 30 2003
PCI: Found IRQ 11 for device 00:1f.5
PCI: Sharing IRQ 11 with 00:1f.6
PCI: Sharing IRQ 11 with 02:03.0
PCI: Setting latency timer of device 00:1f.5 to 64
i810: Intel ICH3 found at IO 0xdc80 and 0xd800, MEM 0x0000 and 0x0000, IRQ 11
i810_audio: Audio Controller supports 6 channels.
i810_audio: Defaulting to base 2 channel mode.
i810_audio: Resetting connection 0
ac97_codec: AC97 Audio codec, id: CRY91 (Unknown)
i810_audio: AC'97 codec 0 supports AMAP, total channels = 2

mplayer

I installed mplayer to play dvd's. Using the xv outputdevice I get good results with fullscreen viewing. Mplayer comes with scripts to install and maintain it as a debian package.

I wanted to use the tv-out plug (to play movies on the TV set). I found out that the only way to get tv-out going is to have the tv-out cable connected when the system boots. It's weird (for me) to have to reboot a system to enable a certain port when almost everything else is hotplug-able. Using the atitvout utility I got the image switched to my TV, but the image is really distorted which seems to be a bug in XFree. Waiting for updates. On that other OS it does work and I can watch stuff fullscreen.

Wired network

The built-in network is quite default, I installed 'ifplugd' which automatically configures the network (using ifup) when a cable is plugged in.

Old wireless network

This section is now marked 'old' as I replaced the builtin wireless card

The built-in wireless card (Dell True Mobile 1150 PCI) uses the Orinoco drivers. Works fine as a normal wireless card using the Orinico drivers.

hermes.c: 4 Dec 2002 David Gibson <hermes gibson.dropbear.id.au>
orinoco.c 0.13d (David Gibson <hermes gibson.dropbear.id.au> and others)
orinoco_cs.c 0.13e (David Gibson <hermes gibson.dropbear.id.au> and
others)
cs: IO port probe 0x0100-0x04ff: excluding 0x378-0x37f 0x3c0-0x3df 0x4d0-0x4d7
cs: IO port probe 0x0800-0x08ff: excluding 0x800-0x817 0x828-0x837 0x840-0x857
0x860-0x877 0x880-0x88f 0x898-0x89f 0x8a8-0x8cf 0x8e0-0x8ff
cs: IO port probe 0x0a00-0x0aff: clean.
cs: IO port probe 0x0c00-0x0cff: clean.
eth1: Station identity 001f:0001:0008:000a
eth1: Looks like a Lucent/Agere firmware version 8.10
eth1: Ad-hoc demo mode supported
eth1: IEEE standard IBSS ad-hoc mode supported
eth1: WEP supported, 104-bit key
eth1: MAC address 00:02:2D:B9:0D:35
eth1: Station name "HERMES I"
eth1: ready
eth1: index 0x01: Vcc 3.3, irq 11, io 0x0100-0x013f
eth1: New link status: Connected (0001)

The main task: network scanning

The main reason I got this laptop was to use it for network debugging, testing and measurements. Both wired and wireless, and I decided to play with wireless first (new toy! ooh, shiny!).

So I installed Kismet. Which requires network card drivers that support monitoring mode, by default not available in the Orinoco driver in the Linux kernel. Kismet links to Airsnort for this subject where the Orinoco Monitor Mode patch page has the patches.

So, I got the Linux 2.4.22 sourcetree (the latest version at that moment), added those patches, compiled it, booted...

PCMCIA gets interesting

No PCMCIA. It seems the PCMCIA controller in the C640 is of a newer type. The Linux Kernel Card Services 3.1.22 give:
Sep 29 16:15:17 memory kernel: Linux Kernel Card Services 3.1.22
Sep 29 16:15:17 memory kernel:   options:  [pci] [cardbus] [pm]
Sep 29 16:15:17 memory kernel: Intel PCIC probe: not found.
Sep 29 16:15:17 memory kernel: ds: no socket drivers loaded!
The kernel that came with the Debian install (forcing the 2.4 version) gives:
Sep 29 16:22:48 memory kernel: Linux PCMCIA Card Services 3.1.33
Sep 29 16:22:48 memory kernel:   kernel build: 2.4.18-bf2.4 unknown
Sep 29 16:22:48 memory kernel:   options:  [pci] [cardbus] [apm]
Sep 29 16:22:48 memory kernel: Intel ISA/PCI/CardBus PCIC probe:
Sep 29 16:22:48 memory kernel: PCI: Found IRQ 11 for device 02:01.0
Sep 29 16:22:48 memory kernel: PCI: Sharing IRQ 11 with 02:01.1
Sep 29 16:22:48 memory kernel: PCI: Found IRQ 11 for device 02:01.1
Sep 29 16:22:48 memory kernel: PCI: Sharing IRQ 11 with 02:01.0
Note the big difference in version number of the Card Services.

Different pcmcia sources help

So, I got out a newer version of the pcmcia card services from Linux PCMCIA information. I did not get a running version of everything with pcmcia-cs-3.1.34 but trying the version pcmcia-cs-3.2.5 gave me a running version of everything, including the needed options for the wireless card:
$ /sbin/iwpriv eth1
eth1      Available private ioctl :
          force_reset      (8BE0) : set   0       & get   0      
          card_reset       (8BE1) : set   0       & get   0      
          set_port3        (8BE2) : set   1 int   & get   0      
          get_port3        (8BE3) : set   0       & get   1 int  
          set_preamble     (8BE4) : set   1 int   & get   0      
          get_preamble     (8BE5) : set   0       & get   1 int  
          set_ibssport     (8BE6) : set   1 int   & get   0      
          get_ibssport     (8BE7) : set   0       & get   1 int  
          monitor          (8BE8) : set   2 int   & get   0      
          dump_recs        (8BFF) : set   0       & get   0      
Boot messages:
Sep 30 21:42:52 memory kernel: Linux PCMCIA Card Services 3.2.5
Sep 30 21:42:52 memory kernel:   kernel build: 2.4.22 unknown
Sep 30 21:42:52 memory kernel:   options:  [pci] [cardbus] [apm]
Sep 30 21:42:52 memory kernel: Intel ISA/PCI/CardBus PCIC probe:
Sep 30 21:42:52 memory kernel: PCI: Found IRQ 11 for device 02:01.0
Sep 30 21:42:52 memory kernel: PCI: Sharing IRQ 11 with 02:01.1
Sep 30 21:42:52 memory kernel: PCI: Found IRQ 11 for device 02:01.1
Sep 30 21:42:52 memory kernel: PCI: Sharing IRQ 11 with 02:01.0

Sep 30 21:42:53 memory kernel: hermes.c: 4 Dec 2002 David Gibson <hermes gibson.dropbear.id.au>
Sep 30 21:42:53 memory kernel: orinoco.c 0.13d (David Gibson <hermes gibson.dropbear.id.au> and others)
Sep 30 21:42:53 memory kernel: orinoco_cs.c 0.13e (David Gibson <hermes gibson.dropbear.id.au> and others)
Sep 30 21:42:53 memory kernel: cs: IO port probe 0x0100-0x04ff: excluding
0x378-0x37f 0x3c0-0x3df 0x4d0-0x4d7
Sep 30 21:42:53 memory kernel: cs: IO port probe 0x0800-0x08ff: excluding
0x800-0x817 0x828-0x837 0x840-0x857 0x860-0x877 0x880-0x88f 0x898-0x89f
0x8a8-0x8cf 0x
8e0-0x8ff
Sep 30 21:42:53 memory kernel: cs: IO port probe 0x0a00-0x0aff: clean.
Sep 30 21:42:53 memory kernel: cs: IO port probe 0x0c00-0x0cff: clean.
Sep 30 21:42:53 memory kernel: eth1: Station identity 001f:0001:0008:000a
Sep 30 21:42:53 memory kernel: eth1: Looks like a Lucent/Agere firmware version 8.10
Sep 30 21:42:53 memory kernel: eth1: Ad-hoc demo mode supported
Sep 30 21:42:53 memory kernel: eth1: IEEE standard IBSS ad-hoc mode supported
Sep 30 21:42:53 memory kernel: eth1: WEP supported, 104-bit key
Sep 30 21:42:53 memory kernel: eth1: MAC address 00:02:2D:B9:0D:35
Sep 30 21:42:53 memory kernel: eth1: Station name "HERMES I"
Sep 30 21:42:53 memory kernel: eth1: ready
Sep 30 21:42:53 memory kernel: eth1: index 0x01: Vcc 3.3, irq 11, io 0x0100-0x013f
Sep 30 21:42:53 memory kernel: eth1: New link status: Connected (0001)
The tool iwconfig still complains a bit, but works:
$ /sbin/iwconfig eth1
Warning: Driver for device eth1 has been compiled with version 15
of Wireless Extension, while this program is using version 16.
Some things may be broken...

eth1      IEEE 802.11-DS  ESSID:""  Nickname:"memory"
          Mode:Managed  Frequency:2.422GHz  Access Point: 00:60:1D:1E:CF:D3  
          Bit Rate:11Mb/s   Tx-Power=15 dBm   Sensitivity:1/242700000  
          Retry limit:4   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality:28/1  Signal level:-66 dBm  Noise level:-94 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

And now I can either access wireless networks or start scanning using kismet. Since pcmcia-cs uses the kernel config settings to determine its own settings, I needed to disable PCMCIA in the kernel config, but enable all the drivers for wireless cards. The make modules_install of the kernel will then install the drivers as symlinks in /lib/modules/2.4.22/pcmcia and the make install from the pcmcia-cs package will replace those symlinks with its own versions.

Output of kismet wireless scans

Module dependencies weirdness

Later, when trying to compile kernel 2.4.26 giving me non-functional wireless network, I found out this only worked due to an 'interesting' combination of the original kernel modules and pcmcia-cs kernel modules for this wireless card. The module dependencies hid this for me in the original 2.4.22 install that I thought was 'working'. After a number of iterations recompiling and reinstalling the kernel (trying 3 different gcc versions as that was 'all that changed' for as far as I knew) I found out it's: hermes.o from the original kernel, orinoco.o and orinoco_cs.o from pcmcia-cs.

I thought it was the gcc version first. The README for the kernel says gcc-2.95.3 is the 'right' version. Debian/testing has gcc-2.95.4 as gcc-2.95 available.

It took me a few iterations of these steps to get a working version of everything. I hope the information here helps other people trying to establish the same.

Module dependencies weirdness fixed

Update: I fixed this for good (at least until I start using a different kernel) by using the orinoco standalone drivers from http://ozlabs.org/people/dgibson/dldwd/orinoco-0.13e.tar.gz and patching them with the patches at http://www.kismetwireless.net/code/orinoco-0.13e-rfmon-dragorn3.diff and making sure everything was compiled with the same gcc.

New wireless hardware and drivers

The Dell Truemobile card only supports WEP encryption for wireless networks. This is outdated now, WEP can be cracked in 10 minutes.

So I decided to replace the internal MiniPCI card. Some searching found me the Senao 802.11a/b/g card which supports WPA encryption. I selected this card because of the drivers from the MadWifi project (I saw a talk on 'madwifi' at the last Sane conference).

There was a number of issues: the latest madwifi requires a recompilation of the latest wpa_supplicant because of some ioctl error. But after that stuff worked great, with wpa_supplicant even managing to connect to an access-point with WEP set up and a hidden SSID. But I switched my access-point to WPA right after that. WPA has a lot of options for authentication and crypto, wpa_supplicant can deal with all of them. It's also a great tool because it automatically connects to networks it has access rules for. In combination with ifplugd the IP configuration happens automagically.

Kismet also had an ioctl issue with the madwifi driver so I downloaded the latest stable version.

The internal modem

Is a winmodem, but with available drivers from the linmodem : PCTEL modem on linux. Listed by lspci as:
00:1f.6 Modem: Intel Corp. 82801CA/CAM AC'97 Modem (rev 02)
Configure driver with --with-hal=i8xx, compile, install, which fails on a weird GCC version problem (which comes from the fact that some parts are binary-only in the pctel package) and needs to be done with insmod -f :
# insmod -f pctel
Using /lib/modules/2.4.22/misc/pctel.o
Warning: The module you are trying to load (/lib/modules/2.4.22/misc/pctel.o)
is compiled with a gcc
version 2 compiler, while the kernel you are running is compiled with
a gcc version 3 compiler. This is known to not work.
Warning: loading /lib/modules/2.4.22/misc/pctel.o will taint the kernel:
non-GPL license - GPL linked with proprietary libraries
  See http://www.tux.org/lkml/#export-tainted for information about tainted
modules
  Warning: loading /lib/modules/2.4.22/misc/pctel.o will taint the kernel:
forced load
  Module pctel loaded, with warnings
# insmod -f ptserial country_code=14
Using /lib/modules/2.4.22/misc/ptserial.o
Warning: loading /lib/modules/2.4.22/misc/ptserial.o will taint the kernel:
non-GPL license - GPL linked with proprietary libraries
  See http://www.tux.org/lkml/#export-tainted for information about tainted
modules
  Warning: loading /lib/modules/2.4.22/misc/ptserial.o will taint the kernel:
forced load
  Module ptserial loaded, with warnings
Above is word-wrapped for readability

Kernel messages:

AC97 modem device found: devnum = 8000FE00, devid = 8086/2486
iobase_0=0xd400, iobase_1=0xdc00,irq=11
PCTel driver version 0.9.5 [5.05c-4.27.215 (09-14-2001)] (MR) (2002-01-31)
with MANY_PORTS SHARE_IRQ SERIAL_PCI AUDIO_ROUTING[INTEL] enabled.
PCTel driver built on [ "2.4.22 <132118>"] with gcc-gcc (GCC) 3.3.2
20030908 (Debian prerelease).
ttyS15 at 0xd400 (irq = 11) is a PCTel
PCI: Found IRQ 11 for device 00:1f.6
PCI: Sharing IRQ 11 with 00:1f.5
PCI: Sharing IRQ 11 with 02:03.0
PCTel initialization. Country code is 14.
Above is word-wrapped for readability

And then minicom on /dev/ttyS15:

AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0                     
OK                                                   
ati3                                                 
PCtel HSP56 MR Linux Driver V4.27.215 (09-14-2001)   
OK
I have made pppd dial in to my provider (xs4all) and set up a connection. It took a few tries. The driver does not seem very stable, and it's the only way I can make the entire system hang.

Update: the hangs go away when I compile the kernel with the same gcc (gcc-2.95 for 2.4.x kernels) as pctel was compiled with.

GPS

Wireless scanning with Kismet works better with a working GPS unit. At first I used a GPSkit unit (rockwell) connected to serial port and keyboard port (for power). But that unit showed its age (long initial aquisition times, lots of trouble with a limited view of the sky). I bought a Rikaline 6010-X5 gps receiver with a USB connector which is pl2303 based. The usbserial module had lots of problems in Linux 2.4.26 (kernel oops on serial close.. and gpsd likes to close the serial device when no application is using it. Now Linux 2.4.31 works for me.

IrDA

I've been playing with IrDA on the laptop. Results: IrDA 'sees' that mobile phone, a Nokia 6150 in discovery mode, but the phone does not get 'connected'.

Rebooting into Windows XP does get the phone 'connected' there. It also shows the IrDA device is not SIR (standard infrared) but infact FIR (fast infrared) over an 'SMC' irda controller.

Tried the smc-ircc driver, this works (but I have to start the driver twice, on the first try I get an error that iospace is in use).

found SMC SuperIO Chip (devid=0x0e rev=01 base=0x002e): LPC47N252
ircc_open()
SMC IrDA Controller found
 IrCC version 2.0, firport 0x280, sirport 0x2f8 dma=3, irq=3
IrDA: Registered device irda0
But still, the phone does not get 'connected' (the IR icon on the phone blinks for a while and then goes off again. During the blinking I can use irdaping to the phone and it answers). But using serial over IrDA (using /dev/ircomm0) still doesn't "answer". With loads of debug information, I see:
irport_hard_xmit()
irport_hard_xmit()
NETDEV WATCHDOG: irda0: transmit timed out
irda0: transmit timed out
ircc_change_speed()
ircc_change_speed(), using irport to change speed to 9600
irport_change_speed(), Setting speed to: 9600
irport_hard_xmit()
So I guess something is going wrong. But where. I guess the conflict with the iospace is a hint. For as far as I can find on websites, there might be an initialization problem or a conflict with the orinoco_cs driver stepping on the same iospace.

TuxMobil: Linux Mobile Phone Survey

Bluetooth

Bluetooth was dead simple after my not-so-great experiences with IrDA. I bought an MSI pc2pc usb bluetooth dongle (mostly because that was the only one available at the local MyCom computerstore). It works.

Installation of utils under Debian: apt-get install bluez-utils

Kernel driver: hci_usb

I peeked a lot at http://www.hut.fi/~kehannin/bluetooth/bluetooth.html for details.

And then:

# hcitool scan
Scanning ...
        00:0E:6D:1E:14:96       Khoos
There is my phone. Let's ask:
# hcitool info 00:0E:6D:1E:14:96
Requesting information ...
        BD Address:  00:0E:6D:1E:14:96
        Device Name: Khoos
        LMP Version: 1.1 (0x1) LMP Subversion: 0x23b
        Manufacturer: Nokia Mobile Phones (1)
        Features: 0xbf 0x28 0x21 0x00 0x00 0x00 0x00 0x00
        <3-slot packets> <5-slot packets> <encryption> <slot offset> 
        <timing accuracy> <role switch> <sniff mode> <SCO link> 
        <HV3 packets> <CVSD> 
Ok. Bluetooth needs a pairing. And there is a nice, graphical util to set that up on the Linux side. Nice, but normally root can't use X on my laptop. For just this once, for these few seconds needed for it, I used xhost + to set this up and then typed xhost - directly.

That was when I installed stuff. Since then, bluetooth on debian got in a bit of a flux with the dbus package being in an upgrade process, leading to the interesting situation where I could not have bluez-utils and bluez-pin installed a the same time. I found a workaround: get the bluez-utils sources and compile the command-line passkey-agent. See Bug #56651: Impossible to do pairing in Kubuntu where 'Dan V' shows the workaround.

Setting up the serial channel via bluetooth goes like:

rfcomm connect rfcomm0 00:0E:6D:1E:14:96

The phone asks conformation for the connect, and at the first try needed a 5-digit code on both sides. After that both devices store the 'pairing' and no further numbers need to be input. The phone still asks conformation for the rfcomm connect.

The first tests where with a borrowed bluetooth dongle. When that worked, I bought my own, which has ofcourse a different local address. Net effect: bluetooth pairing invalid, and I needed to delete the pairing and make it again.

After the first time, I set up this link in /etc/bluetooth/rfcomm.conf and now when an application opens /dev/rfcomm0 and waits long enough for the result (minicom is too hasty, I can only use minicom when the phone is set up not to ask for conformation), the phone will ask conformation directly and when I press 'Accept', it works. Nice.

Dialing into a provider over the rfcomm device (or use minicom to talk to /dev/rfcomm0) is simple (when using a gsm data call). I added another provider and a chatscript to establish this.

Bluetooth proved to be unstable sometimes, giving weird errors when trying to re-establish the serial link (the serial link laptop - phone gets broken after each call hangup.. how do I disable this?). I fiddled a bit and found that completely stopping and starting bluez-utils can be needed.

Also: when I disable bluetooth on the phone and enable it again, rfcomm can't establish a connection until I set the phone 'discoverable'. Setting it to 'hidden' again after that is no problem.

GPRS

Next step is to dial in using GPRS (still over bluetooth). This is a bit cumbersome to set up since Vodafone NL (IE only site) does not document this very well, just for Vodafone live!, their idea of 'use your mobile for fun and expensive stuff'.

Before you continue, be aware that GPRS use costs money. Check the publications of your provider. I found on the Vodafone website that gprs traffic (disguised as 'Vodafone live!') costs me 25 euro per megabyte.

Things that needed setting up:

Ross Barkman maintains an overview page of how to set up GPRS on all networks. Check that page for your provider.

Hardware tuning

The linux kernel sets the harddisk and dvd drive to conservative settings (no DMA). I installed packages hwtools and hdparm to set the drives to more optimal values (which improved dvd playback a lot) with these settings in /etc/init.d/hwtools:
   hdparm -u1 -c3 /dev/hda
   hdparm -u1 -d1 /dev/hdc

Locations of software

A roundup of all locations of software in the above article. The reports about failure and success with mobile phones and Linux have moved to their own pages:
Comments about this page and updates are welcome. E-mail is the preferred contact method.
Koos van den Hout (koos@kzdoos.xs4all.nl)
Other webprojects: Camp Wireless, wireless Internet access at campsites The Virtual Bookcase webcam.idefix.net Weather maps