Linux on a Dell Latitude X300

Dell
	Latitude D400

Updates

2007-02-18: Upgraded to a 2.6.18 kernel, with the kernel's own support for wifi and ALSA sound, and a patch to slow down the mouse.

2005-11-19: Upgraded to a 2.6.12.2 kernel. Also tried a 2.6.14 kernel, but suspend to disk failed. Moved my external back-up disk into a new enclosure. Documented my back-up script.

2005-06-14: Suspend to disk linked to lid closure, but occasionally fails. Upgraded to a 2.6.11.11 kernel.

2005-03-07: Suspend to disk and external video are working.

2005-01-17: Installed (Free) ipw2200 wifi driver and upgraded to a 2.6.10 kernel

2004-08-31: Driverloader won't compile under 2.6.8.1 kernel.

2004-08-24: (broken) Fn-F2 wifi key combination disabled.

2004-07-26: ndiswrapper failed, driverloader instead.

2004-07-10: The integrated Ethernet failed intermittently, but works again after a warranty motherboard replacement.

Features and Linux Installation

In April 2004, I decided my Gateway Solo notebook was ready for retirement, due to poor battery life and continuing problems with the PC card and internal 56K winmodem. However, I still liked its form factor: 12.1 inch screen and less than 4 pounds.

There are several machines available in the "ultralight" class. On the IBM X40, I didn't like the keyboard layout (I'm an emacs user, and I expect the left control key to be in the corner) or the lack of a touchpad. The Toshiba M205-S810 had a nice 1400x1050 display, but lacked a right hand control key, and I didn't think I would use the touch screen. The Sony V505EX had a small right hand shift key and very short key travel. The HP 4010nc had good specs (including disk drives up to 80 MB), but I couldn't find one to try out, and I was worried about the air inlet on the bottom. The Dell X300 had a nice keyboard, but short battery life according to cnet tests. I actually ordered a D400, but when I realized how wide it was I decided to get an X300 instead. (My wife took the D400 and is very happy with it.)

The X300 came with a 60 GB disk (Hitachi model IC25N060ATMR04-0) which hdparm describes as follows:

# hdparm -I /dev/hda

/dev/hda:

ATA device, with non-removable media
        Model Number:       IC25N060ATMR04-0                        
        Serial Number:      MRG357K3K13L6H
        Firmware Revision:  MO3OAD0A
Standards:
        Used: ATA/ATAPI-6 T13 1410D revision 3a 
        Supported: 6 5 4 3 
Configuration:
        Logical         max     current
        cylinders       16383   65535
        heads           16      1
        sectors/track   63      63
        --
        CHS current addressable sectors:    4128705
        LBA    user addressable sectors:  117210240
        LBA48  user addressable sectors:  117210240
        device size with M = 1024*1024:       57231 MBytes
        device size with M = 1000*1000:       60011 MBytes (60 GB)
Capabilities:
        LBA, IORDY(can be disabled)
        bytes avail on r/w long: 4      Queue depth: 1
        Standby timer values: spec'd by Vendor, no device specific minimum
        R/W multiple sector transfer: Max = 16  Current = 0
        Advanced power management level: 128 (0x80)
        Recommended acoustic management value: 128, current value: 254
        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5 
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4 
             Cycle time: no flow control=240ns  IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           *    NOP cmd
           *    READ BUFFER cmd
           *    WRITE BUFFER cmd
           *    Host Protected Area feature set
           *    Look-ahead
           *    Write cache
           *    Power Management feature set
                Security Mode feature set
           *    SMART feature set
           *    FLUSH CACHE EXT command
           *    Mandatory FLUSH CACHE command 
           *    Device Configuration Overlay feature set 
           *    48-bit Address feature set 
                Automatic Acoustic Management feature set 
           *    SET MAX security extension
                Address Offset Reserved Area Boot
           *    SET FEATURES subcommand required to spinup after power up
                Power-Up In Standby feature set
           *    Advanced Power Management feature set
           *    General Purpose Logging feature set
           *    SMART self-test 
           *    SMART error logging 
Security: 
        Master password revision code = 65534
                supported
        not     enabled
        not     locked
        not     frozen
        not     expired: security count
        not     supported: enhanced erase
        50min for SECURITY ERASE UNIT. 
HW reset results:
        CBLID- above Vih
        Device num = 0 determined by the jumper
Checksum: correct
    
The disk apparently has a temperature sensor. After I added an appropriate line to the configuration file, hddtemp can report the disk temperature:
# grep IC25.*ATM /etc/hddtemp.db
"IC25N0[23468]0ATMR04"          194  C  "Hitachi Travelstar 80GN"
# hddtemp  /dev/hda
/dev/hda: IC25N060ATMR04-0: 35 C
    

The disk came with partitions of 31.3 MB (DELLUTILITY) and 57.192 GB with a FAT32 filesystem (per my order) with 4.5 GB used. (Serious bloatware - and I don't even have Office installed.) I installed Partition Magic and shrank the C: partition to 9.0052 GB.

I then booted a Debian 3.0 cdrom using Dell's USB cdrom drive.

cfdisk showed 50536 MB of free space, which I allocated as 98.71 MB unused (since I don't trust Windows to stay within its partition), 48899.29 MB for Linux, and 1538.13 MB for swap.

I initialized the swap partition and installed an ext2 filesystem in the root partition.

At this point the installer failed to recognize the cdrom (which was connected via USB), offering only the floppy, a partition on the hard disk, or an already mounted filesystem. I rebooted into Windows, copied /dists/woody/main/disks-i386/ onto the hard disk, and rebooted the install disk. That let me get a few steps further, but I still didn't have access to either the cdrom or the network. I had previously downloaded a copy of the Linux 2.4 driver module and saved it in c:\tmp. I could access it with the commands

mknod /dev/hda2 b 3 2
mkdir /c
mount -t vfat /dev/hda2 /c
insmod /c/tmp/bcm5700.o
    
However, this failed with many undefined variables.

Next I downloaded a "daily build" of the sarge Debian netinstall cdrom. Its default boot also failed to recognize either the cdrom or the network interface. Booting with "linux26" brought up 2.6.5 kernel which did recognize and mount the cdrom. However, it failed at the next step, logging a message "(none) user.notice hw-detect: Missing modules 'tg3 (BROADCOM Corporation NetXtreme BCM5705M Gigabit Ethernet)". Under Linux 2.6, the network interface is supported by the tg3 module. I compiled a module tg3.ko using Linux 2.6.6 sources on another machine and copied into c:\tmp. Installing it failed with the message

insmod: error inserting '/c/tmp/tg3.ko': -1 invalid module format
    
Repeating with tg3.o generated the same message.

Googling, I discovered that the tg3 driver had been intentionally removed from the Debian installation disk because of doubt as to its license.

I discovered an excellent listing of alternative Debian installation tools at http//www.linuxmafia.com/faq/Debian/installers.html, which included a link to Victor van Beekum's netinst image at http://www.beekum.nl/pe26xx.iso which claimed to include the tg3 driver. I downloaded that, burned (yet another) cd, and also wrote the cd files to the c: directory (since I didn't know that the USB disk would be accessible). I installed the base system that way. It turned out to have a 2.2.20 kernel, and had no support for the Ethernet card that I could find.

Next I compiled a 2.6.6 kernel on another machine with support for both the Ethernet and cdrom devices:

CONFIG_TIGON3=y
CONFIG_USB=y
CONFIG_USB_DEBUG=y
CONFIG_USB_DEVICEFS=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_OHCI_HCD=y
CONFIG_USB_UHCI_HCD=y
CONFIG_USB_STORAGE=y
CONFIG_USB_STORAGE_DEBUG=y
    
I copied these to c: and booted the 2.2.20 kernel, copied the kernel to /boot, added an entry to /etc/lilo.conf, ran lilo, and tried to boot the new kernel. It displayed:
boot: linux-2.6.6
Loading linux-2.6.6............
Uncompressing Linux... Ok, booting the kernel.
    
and crashed.

Next I copied all eight Debian 3.0 installation disks to c:/tmp on the theory I could install enough to compile a kernel there. I completed the Woody installation that way.

Then a friend asked whether I had configured the 2.6.6 kernel for the right processor family - which of course I had not. I had started with the configuration for my dual Athlon desktop system, but had neglected to change the processor family. While I was at it, I enabled "Dell laptop support" (CONFIG_I8K=y) and disabled CONFIG_SMP. I installed that kernel as before, and this time it worked.

I set up networking manually with route and ifconfig, set up /etc/apt/sources.conf, did

apt-get update
apt-get upgrade
apt-get dist-upgrade
    
and had a working Linux system!

Xfree86

I had asked for gdm and X windows client and driver, but X wouldn't come up. After quite a few fruitless attempts at reconfiguration (including several copies of XF86Config posted to the net) I noticed that (in spite of the "apt-get dist-upgrade" mentioned above) the version of the server was still 4.1.something. I did an explicit "apt-get install xserver-xfree86" which got 4.3.0.dfsg.1-1, which came up immediately.

The X-300 has a VGA connector to drive an external CRT, but the Fn-F8 key combinations didn't work. I tried the i810switch program. It did enable the video signal, but the image was corrupted (something like a Moire pattern that crawled slowly up the screen) - certainly nothing I would want to use for a business presentation.

Following a pointer at http://www.cavecanen.org/index.shtml, I tried i855crt by Merello Andrea, which works great! The only anomaly was that the cursor disappears over certain windows (notably those for Word and PowerPoint when they're running under Crossover Office). I tried the "software cursor" option, but that left a white square in one corner of the display. (Morello recommends patching XFree86, and I don't have the appropriate patches for version 4.3 of XFree86, which is what I'm running.)


Integrated Ethernet

After using the integrated Ethernet for initial Linux installation (as described above), it started failing intermittently. The RJ-45 port has two lights. If the rear light is orange, the port is working. If it is green or off, it is not working. (The front light flashes yellow to show data traffic.) At first I ascribed this to my home-made cables. Sometimes flexing the cable or moving the machine would start the port working. However, the problem has persisted across four cables (all of which worked with other machines) and under both Linux and Windows. Eventually I found that I could restore connectivity by torquing the case: applying pressure down on the back left corner (just beyond the RJ-45 port) and the front left corner, and up in the center. (I have set up ifplugd and ifupdown-roam, so the port gets configured as soon as it comes up.) I guess there's a flaky solder joint or motherboard trace. I plan to back everything up, wipe the disk, and return the machine on warranty.

Update 2004-07-10: Ethernet Fixed

I talked to the "Technical Support" people at Dell. After spending a long time on the phone and answering some inane questions like "do you use static IP" and "do you use TCP/IP or some other protocol", they finally admitted I had a hardware problem. They sent a new motherboard to the outfit in my area who had the service contract. The next day they called to set up an appointment, and the day after that they came by and fixed the machine. I didn't have to restore from backups or anything. I'm happy with Dell's service!


Wireless LAN

I got an Intel PRO/Wireless 2200BG miniPCI 802.11 b/g adaptor. There is a project at http://ipw2200.sourceforge.net to develop a Linux driver for it, but it's apparently just getting started.

In the mean time, one can get a kernel module that can load NDIS (windows network driver API) drivers from ndiswrapper. The sources built fine, but "make install" generated a error message "depmod: QM_MODULES: Function not implemented". Documentation/Changes in the Linux sources advised getting version 0.9.10 or newer of module-init-tools, and to check using "depmod -V". Confusingly, the latter replied 2.4.26. It turns out I didn't have module-init-tools. I installed module-init-tools version 3.0-pre10-4 and ndiswrapper installed fine. When I tried to install the driver I got this complaint:

ndiswrapper: version magic '2.6.6 preempt PENTIUM4 gcc-3.3' should
      be2.6.6 preempt PENTIUM4 gcc-2.95'
    
because my successful kernel was compiled by the Woody's gcc. After recompiling with gcc 3.3.3, it installed fine. Here's the installed driver list:
# ndiswrapper -l
Installed ndis drivers:
w22n51  present
    
Installing the driver seems to work:
# modprobe ndiswrapper
# dmesg|tail -3
ndiswrapper version 0.7 loaded
ndiswrapper adding w22n51.sys
wlan0: ndiswrapper ethernet device xx:xx:xx:xx:xx:xx using driver w22n51.sys
# ifconfig
eth0      Link encap:Ethernet  HWaddr yy:yy:yy:yy:yy:yy
          inet addr:192.168.1.102  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:18664 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14248 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:15156061 (14.4 MiB)  TX bytes:2347787 (2.2 MiB)
          Interrupt:11 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4248 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4248 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:355848 (347.5 KiB)  TX bytes:355848 (347.5 KiB)

wlan0     Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:1368 (1.3 KiB)
          Interrupt:5 Memory:e0210000-e0210fff 
    
(I've replaced the MAC addresses in all these printouts.) Setting the mode generates an error message, which I have read is harmless:
# iwconfig wlan0 mode Managed
Error for wireless request "Set Mode" (8B06) :
    SET failed on device wlan0 ; Invalid argument.
falcon:/usr/local/src/ndiswrapper# 
    
However, the driver itself does not appear to work:
# iwconfig
eth0      no wireless extensions.

lo        no wireless extensions.

wlan0     no wireless extensions.
# iwlist wlan0 scan
wlan0     Interface doesn't support scanning.
    
Eventually I found a discussion at www.minet.uni-jena.de/~dank/eigene/DELL_LATITUDE_X300.html which (after translation from German to English, thanks to the Google option) suggested adding the kernel configuration option CONFIG_NET_RADIO=y. With that change, the driver does recognize the adaptor:

# iwconfig wlan0
wlan0     IEEE 802.11b  ESSID:""  
          Mode:Managed  Access Point: FF:FF:FF:FF:FF:FF  Bit Rate:54Mb/s   
          RTS thr:1600 B   Fragment thr:2304 B   
          Encryption key:off
          Power Management min timeout:0us  mode:All packets received
          Link Quality:0/100  Signal level:24/154  Noise level:0/154
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
    
Then I found Debian packages of ndiswrapper by Erik Rigtorp at http://rigtorp.se/debian/unstable/ and installed version 0.8-1.

After must frustrating experimentation, I have settled on the following process:

# modprobe ndiswrapper
# iwconfig wlan0 power on
<press Fn-F2 twice>
# dhclient wlan0
    
Pressing the "Fn-F2" key generates this warning message:
atkbd.c: Unknown key pressed (translated set 2, code 0x88 on isa0060/serio0).
atkbd.c: Use 'setkeycodes e008 <keycode>' to make it known.
    
which appears to be harmless. After the first two keypresses, "Fn-F2" appears to toggle the wifi radio. For example, if I start pinging a site, I can use "Fn-F2" to interrupt and restart the replies. However, I have found no indication of the current state of the radio, either among the status lights along the front edge or anywhere under /proc/acpi or /sys. I also have not found any way to enable the radio from a script.

I'm using the driver that came with XP installed by Dell. The driver at the ndiswrapper web site is different, but I suppose it would work as well. Here are the md5sums for the two drivers:

4fed83668f087ecbe810ea90beceb765  /c/drivers/network/addon/w22n51.sys
4c009d4352849d79bf347846b6e03bfd  WLAN_8.0.12.9000/w22n51.sys
    

Here is how iwconfig and iwlist report the wifi configuration:

# iwconfig wlan0
wlan0     IEEE 802.11g  ESSID:"linksys"  
          Mode:Managed  Frequency:2.412GHz  Access Point: xx:xx:xx:xx:xx:xx
          Bit Rate:54Mb/s   
          RTS thr:1600 B   Fragment thr:2304 B   
          Power Management min timeout:0us  mode:All packets received
          Link Quality:0/100  Signal level:-43 dBm  Noise level:-256 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
# iwlist wlan0 scan
wlan0     Scan completed :
          Cell 01 - Address: xx:xx:xx:xx:xx:xx
                    ESSID:"foobar"
                    Protocol:IEEE 802.11g
                    Mode:Managed
                    Frequency:2.412GHz (channel 1)
                    Quality:0/100  Signal level:-48 dBm  Noise level:-256 dBm
                    Encryption key:off
                    Bit Rate:1Mb/s
                    Bit Rate:2Mb/s
                    Bit Rate:5.5Mb/s
                    Bit Rate:11Mb/s
                    Bit Rate:18Mb/s
                    Bit Rate:24Mb/s
                    Bit Rate:36Mb/s
                    Bit Rate:54Mb/s
                    Bit Rate:6Mb/s
                    Bit Rate:9Mb/s
                    Bit Rate:12Mb/s
                    Bit Rate:48Mb/s
# iwlist wlan0 power
wlan0     Current mode:All packets received
                  min timeout:0us
# iwlist wlan0 txpower
wlan0     unknown transmit-power information.

# iwlist wlan0 freq
wlan0     14 channels in total; available frequencies :
          Channel 01 : 2.412 GHz
          Channel 02 : 2.417 GHz
          Channel 03 : 2.422 GHz
          Channel 04 : 2.427 GHz
          Channel 05 : 2.432 GHz
          Channel 06 : 2.437 GHz
          Channel 07 : 2.442 GHz
          Channel 08 : 2.447 GHz
          Channel 09 : 2.452 GHz
          Channel 10 : 2.457 GHz
          Channel 11 : 2.462 GHz
          Channel 12 : 2.467 GHz
          Channel 13 : 2.472 GHz
          Channel 14 : 2.484 GHz
          Current Frequency:2.412GHz (channel 01)
    

I tried "iwconfig wlan0 mode Ad-Hoc", but the reported mode stayed at "Managed".

2004-07-26 update: ndiswrapper quit working. The command "modprobe ndiswrapper" stops just after printing "w22n51.sys", apparently going into a infinite loop. "top" running on another virtual console shows a steadily increasing load. None of the processes listed there is using a significant amount of CPU, so the load must be in kernel tasks. I don't know why it broke. I suppose the driver may be running out of stack space (although I do not have "CONFIG_4KSTACKS" configured in the kernel).

I have since switched to "driverloader" from Linuxant. They offer a .deb file. After installation (using the same Windows driver) the wireless adaptor showed up as eth1. Pressing "Fn-F2" twice is still necessary. "driverloader" requires a $20 license which is keyed (naturally enough) to the MAC address of the wifi adaptor.

2004-08-24 update: I discovered an option in the BIOS setup program to disable the Fn-F2 key. Now I can start up wifi with just "iwconfig eth1 power on ; dhclient eth1".

2004-08-31 update: driverloader won't compile under the 2.6.8.1 kernel due to an undefined symbol "waitpid". That's another reason to switch to the free ipw2200 driver.

2005-01-17 update: I installed version 0.19 of the ipw2200 driver, as follows:

2007-02-18 update: I'm now using the ipw2200 driver in the kernel sources, currently version 1.1.2kmprq.

ACPI

The X300 BIOS does not implement APM, so I have to use ACPI with this machine.

With ACPI configured, the /proc/acpi/battery directory was empty, and the boot messages included errors like this:

evregion-0347: *** Error: Handler for [EmbeddedControl] returned AE_BAD_PARAMETER
 dswexec-0435 [42] ds_exec_end_op        : [LEqual]: Could not resolve operands, AE_BAD_PARAMETER
dswstate-0273 [44] ds_result_pop_from_bot: No result objects! State=e7477828
 dsutils-0526 [44] ds_create_operand     : Missing or null operand, AE_AML_NO_RETURN_VALUE
 psparse-1133: *** Error: Method execution failed [\_TZ_.THRM._TMP] (Node c152dc38), AE_AML_NO_RETURN_VALUE
    
Following the method of Philipp Matthias Hahn described at http://acpi.sourceforge.net/wiki/index.php/HowToOverrideTable I copied the BIOS generated DSDT from /proc/acpi/dsdt and decompiled it with the Intel program iasl. I then compared it with the X300 dsdt files from http://acpi.sourceforge.net/dsdt/tables/Dell/Latitude_X300/. Some differences seemed to relate to the amount of memory installed (I have 640 MB). The fixes can be summarized in this patch against the disassembled dsdt.dsl file. I assembled and installed it like this:
iasl -tc revised-dsdt.dsl
cp revised-dsdt.hex /usr/local/linux/linux-2.6/drivers/acpi/dsdt.hex
    

I then made the changes in this patch to /usr/local/linux/linux-2.6/drivers/acpi/osl.c, then compiled and installed the kernel. After booting, I found this power and thermal information available:

# head ac_adapter/*/* battery/*/* thermal_zone/THRM/*
==> ac_adapter/ADP1/state <==
state:                   off-line

==> battery/BAT1/alarm <==
alarm:                   unsupported

==> battery/BAT1/info <==
present:                 yes
design capacity:         1900 mAh
last full capacity:      1900 mAh
battery technology:      rechargeable
design voltage:          14800 mV
design capacity warning: 190 mAh
design capacity low:     57 mAh
capacity granularity 1:  1 mAh
capacity granularity 2:  1 mAh
model number:            

==> battery/BAT1/state <==
present:                 yes
capacity state:          ok
charging state:          discharging
present rate:            711 mA
remaining capacity:      1655 mAh
present voltage:         15945 mV

==> battery/BAT2/alarm <==
alarm:                   unsupported

==> battery/BAT2/info <==
present:                 yes
design capacity:         unknown
last full capacity:      unknown
battery technology:      rechargeable
design voltage:          unknown
design capacity warning: 10 mAh
design capacity low:     3 mAh
capacity granularity 1:  1 mAh
capacity granularity 2:  1 mAh
model number:            

==> battery/BAT2/state <==
present:                 yes
capacity state:          ok
charging state:          charged
present rate:            unknown
remaining capacity:      unknown
present voltage:         unknown

==> thermal_zone/THRM/cooling_mode <==
cooling mode:            active

==> thermal_zone/THRM/polling_frequency <==
<polling disabled>

==> thermal_zone/THRM/state <==
state:                   ok

==> thermal_zone/THRM/temperature <==
temperature:             40 C

==> thermal_zone/THRM/trip_points <==
critical (S5):           84 C
active[0]:               65 C: devices=0xc152deb8 
    
The only problem I see is that battery 2 is marked as "present", when there is in fact only one battery installed (one of the lower-capacity ones).

Some of the "function" keys work:

2004-06-26 update: The kernel reports a total of 18 errors (AE_BAD_PARAMETERS or AE_AML_NO_RETURN_VALUE). I downloaded and installed the A07 BIOS update file, R79464.exe, from http://support.dell.com. However, the kernel still reports 18 errors, so they didn't fix the DSDT.

The X300 offers several CPU clock frequencies, as described here:

jrv@falcon:/sys/devices/system/cpu/cpu0/cpufreq$ head *
head: cannot open `cpuinfo_cur_freq' for reading: Permission denied
==> cpuinfo_max_freq <==
1200000

==> cpuinfo_min_freq <==
600000

==> scaling_available_frequencies <==
1200000 1100000 1000000 900000 800000 600000 

==> scaling_available_governors <==
powersave userspace performance 

==> scaling_cur_freq <==
600000

==> scaling_driver <==
centrino

==> scaling_governor <==
powersave

==> scaling_max_freq <==
1200000

==> scaling_min_freq <==
600000

I wish the frequencies went far lower, so I could extend my battery life. If I use emacs or vi in a virtual console, I would expect it to keep up with my typing at 100 MHz or lower. On the other hand, according to the discharge current reported in /proc/acpi/battery/BAT1/state, cutting the frequency in half saves only about five percent. I suppose the display backlight, RAM, and hard disk make up the rest. Come to think of it, I'd like to be able to turn the backlight off while I'm just taking notes. The "Fn-CRT/LCD" button appears to be disabled if there is no CRT connected.

For comparison, turning on the wifi radio increases discharge current by about ten percent.


Suspend to Disk

After updating to the 2.6.10 kernel, its implementation of suspend to disk started working. To get the Fn-ESC key combination to work, I installed this script in /etc/acpi/events/sleep:

event=button[/]sleep
action=/etc/acpi/actions/hibernate %e
    
This is the file /etc/acpi/actions/hibernate:
#!/bin/sh

# record battery state
logger -- `power`
# surrender DHCP lease, 
# per http://www.x1000forums.com/index.php?showtopic=5405
dhclient -r eth0
dhclient -r eth1
# stop network interfaces, unload modules
/etc/init.d/networking stop
rmmod ipw2200
# we don't want to keep stale DNS information around
/sbin/resolvconf -d eth0
/sbin/resolvconf -d eth1

chvt 1				# change to a virtual terminal

# mysql daemon doesn't survive suspension
/etc/init.d/mysql stop

# suspend. The first line is essential!
echo -n shutdown > /sys/power/disk
echo -n disk > /sys/power/state

###################################################################
# After the suspend, we restart here...

# reset the system clock from the hardware clock
hwclock --hctosys

# Matlab's license manager dies when the system clock is reset
/etc/init.d/flexlm restart

# restart network interfaces.
modprobe ipw2200 #ifname=eth%d
/etc/init.d/networking start
/etc/init.d/mysql start

# record battery state
logger -- `power`

# start anacron, otherwise cron jobs can be never restarted
/etc/init.d/anacron start
    

Recent changes:

Suspending has failed a few times, with the machine displaying "Freeing memory...done (XX pages freed)" then locking up. I don't believe I have seen that problem since upgrading to the 2.6.11 kernel.

More recently, I have encountered the following symptoms:

I think this has only happened after I have suspended from within an X session. Anyway, I haven't seen it since I added the "chvt 1" line to the "hibernate" script. Of course that represents a retreat of one more step from the "pick up exactly where you left off" model that suspending attempts to maintain.

Sound

The X300 has the Intel 810 audio chipset.

2007-02-18 update: I have configured ALSA with OSS emulation, like this:

CONFIG_SOUND=y
#
# Advanced Linux Sound Architecture
#
CONFIG_SND=m
CONFIG_SND_TIMER=m
CONFIG_SND_PCM=m
CONFIG_SND_RAWMIDI=m
CONFIG_SND_SEQUENCER=m
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=m
CONFIG_SND_PCM_OSS=m
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_SEQUENCER_OSS=y
CONFIG_SND_RTCTIMER=m
CONFIG_SND_SEQ_RTCTIMER_DEFAULT=y
CONFIG_SND_SUPPORT_OLD_API=y
CONFIG_SND_VERBOSE_PROCFS=y
CONFIG_SND_MPU401_UART=m
CONFIG_SND_AC97_CODEC=m
CONFIG_SND_AC97_BUS=m
CONFIG_SND_VIRMIDI=m
CONFIG_SND_MTPAV=m
CONFIG_SND_SERIAL_U16550=m
CONFIG_SND_MPU401=m
CONFIG_SND_INTEL8X0=m
    
Here is the audio configuration as reported by /dev/sdnstat:
$ cat /dev/sndstat
Sound Driver:3.8.1a-980706 (ALSA v1.0.12rc1 emulation code)
Kernel: Linux falcon 2.6.18 #21 PREEMPT Wed Oct 11 14:00:11 EDT 2006 i686
Config options: 0

Installed drivers: 
Type 10: ALSA emulation

Card config: 
Intel 82801DB-ICH4 with STAC9750,51 at 0xe0100c00, irq 10

Audio devices:
0: Intel 82801DB-ICH4 (DUPLEX)

Synth devices: NOT ENABLED IN CONFIG

Midi devices: NOT ENABLED IN CONFIG

Timers:
7: system timer

Mixers:
0: SigmaTel STAC9750,51
    

56K Modem

The modem is of course a Winmodem.

scanmodem from http://linmodems.technion.ac.il/ reports:

Providing detail for device at PCI_bus 0000:00:1f.6
  with vendor-ID:device-ID
            ----:----
Class 0703: 8086:24c6   Modem: Intel Corp. 82801DB (ICH4) AC'97 Modem Controller (rev 01) (prog-if 00 [Generic])
  SubSystem 14f1:5422   Conexant: Unknown device 5422
        Flags: medium devsel, IRQ 10
        I/O ports at 2400
        I/O ports at 2000 [size=128]
 The soft modem Subsystem operates under a controller
     8086:24c6 82801DB ICH4   with Subsystem chipset POSSIBLY from:
        Broadcom
        AgereSystems
        Conexant
        Intel
        Smartlink

I checked Linuxant for drivers. I had to patch their "listmodem" script to get it to run, but it wasn't very informative:

# diff -u listmodem.sh-orig listmodem.sh
--- listmodem.sh-orig   2004-06-05 07:47:05.000000000 -0400
+++ listmodem.sh        2004-06-05 07:47:30.000000000 -0400
@@ -123,7 +123,7 @@
        if ( $1 ~ /^00:0/ )
        {
            if (/\(rev [a-zA-Z0-9]+\)$/)        
-                       revision = toupper (gsub(")", "", $NF))
+                       revision = toupper (gsub("\)", "", $NF))
                else
                        revision = "NONE"
                next
# sh listmodem.sh
=============================================================
=                  RESULT OF MODEM QUERY                    =
=============================================================

  
Also device ID 5422 does not appear in their listmodem guide. I downloaded their HCF driver hcfpcimodem_1.01lnxt04051300full_i386.deb, but it reported "ERROR: no device detected by hcfpci driver". However, their HSF modem Debian package installed without complaint:
$ su -c 'dpkg -i hsfmodem_6.03.00lnxt04051300full_i386.deb '
Password: 
Selecting previously deselected package hsfmodem.
(Reading database ... 96984 files and directories currently installed.)
Unpacking hsfmodem (from hsfmodem_6.03.00lnxt04051300full_i386.deb) ...
Setting up hsfmodem (6.03.00lnxt04051300full) ...
Conexant HSF softmodem driver, version 6.03.00lnxt04051300full

If you need license keys, assistance or more information, please go to:
        http://www.linuxant.com/

When reporting a problem for the first time, please send
us the file generated by "hsfconfig --dumpdiag".

No pre-built modules for: Debian-testing/unstable linux-2.6.6 i686

Trying to automatically build the driver modules...
(this requires a C compiler and proper kernel sources to be installed)

Where is the linux source build directory that matches your running kernel?
[/lib/modules/2.6.6/build] 

Building modules for kernel 2.6.6, using source directory
/lib/modules/2.6.6/build. Please wait...
done.
error: 'kernel.modprobe' is an unknown key

Automatically guessed region (using timezone): "USA"

Please enter region name for modem unit 0 [USA]: 

Setting region for modem unit 0: "USA"

To change, use "hsfconfig --region" or "AT+GCI=<T35code>"
The current region can be displayed by entering "ATI9" in a terminal program.

Note: we respect user privacy. Email addresses are not communicated
nor used for any purpose other than to manage licenses!

Please enter your email address [unknown]: jrvz@NOSPAMcomcast.net

License keys can be obtained from http://www.linuxant.com/
Without one, the modem operates in FREE mode (max 14.4Kbps data only, no fax)

The registration ID for modem unit 0 is: 0837-0D7C-D8C0

Please enter license key [FREE]: 

Setting license for modem unit 0: "jrvz@NOSPAMcomcast.net/FREE"

Current parameters: ("hsfconfig --info")

Config for modem unit 0: /dev/ttySHSF0
        Device instance: 0-PCI-8086:24c6-14f1:5422
        HW revision    : CXT22
        HW profile name: hsfmc97ich
        Registration ID: 0837-0D7C-D8C0
        License owner  : jrvz@NOSPAMcomcast.net
        License key    : FREE
        License status : FREE (max 14.4kbps data only)
        Current region : USA (T.35 code: 00B5)

The /dev/modem alias (symlink) points to /dev/ttySHSF0

To enable full 56K modem and FAX functionality, enter your license information
with "hsfconfig --license".

License owner and key data must EXACTLY match the information respectively
provided to and by Linuxant. Otherwise, license status will remain "FREE"!

jrv@falcon:~/hardware/x300/modem$ lsmod
Module                  Size  Used by
hsfmc97ali             51476  0 
hsfmc97via             49304  0 
hsfmc97ich             50832  0 
hsfpcibasic2           56720  0 
hsfserial              20996  4 hsfmc97ali,hsfmc97via,hsfmc97ich,hsfpcibasic2
hsfengine            1218980  1 hsfserial
hsfosspec              64996  9 hsfmc97ali,hsfmc97via,hsfmc97ich,hsfpcibasic2,hsfserial,hsfengine
hsfsoar                52480  4 hsfmc97ali,hsfmc97via,hsfmc97ich,hsfpcibasic2
hcfpcihw                9728  0 
hcfpciserial           20868  1 hcfpcihw
hcfpciengine          800052  1 hcfpciserial
hcfpciosspec           56748  2 hcfpciserial,hcfpciengine
driverloader          157572  0 

Actually /dev/modem didn't exist. I set it up to point to /dev/ttySHSF0, and it worked!

(All the hotel rooms come with wifi or hardwired Ethernet nowadays, so I have not used the modem for months.)


Touchpad and Mouse

I downloaded an XFree86 driver for the touchpad from http://w1.894.telia.com/~u89404340/touchpad/, and it now does tap-to-click.

I also plan to investigate Dmitry Torokhov's modifications to gpm to handle the Synaptics touchpad (e.g. tap-to-click in a virtual console). Unfortunately his patches collide with the Debian patches. I have not reconciled them.

I picked up a Targus AMW07 wireless optical mouse which works great, but was far too sensitive for me. To make it usable, I have applied my own slow-mouse-patch which adds two configuration parameters:


DVD/CD-RW

I got an external DVD/CD-RW drive with my X300. To use it, I configured my kernel with "CONFIG_BLK_DEV_SR=y", created the symbolic link

$ ls -l /dev/cdrom
lrwxr-xr-x  1 root root 3 2004-07-03 12:44 /dev/cdrom -> sr0
    

and included this line in /etc/fstab:

/dev/sr0        /cdrom          iso9660 ro,user,noauto          0       0
    

I can mount and read CDROMs and DVDs and write CDRs. However, I can't write DVDs. It's not that kind of drive. dvdrecord reports:

falcon:/debian/images# dvdrecord -blank=fast -v speed=4 dev=0,0,0 test.iso
dvdrtools v0.1.5
Portions (c) 2002-2003 Ark Linux <bero@arklinux.org>
dvdrtools patched by Julien Delange for Debian 
Note that you have to reports bug to the debian maintainer
Please ask Debian for support, and not ask the original author
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program; see the file COPYING.  If not, write to the Free Software
Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
Based on:
Cdrecord 1.11a15 (i386-pc-linux-gnu) Copyright (C) 1995-2001 Jörg Schilling
TOC Type: 1 = CD-ROM
scsidev: '0,0,0'
scsibus: 0 target: 0 lun: 0
Linux sg driver version: 3.5.32
Using libscg version 'schily-0.7'
atapi: 1
Device type    : Removable CD-ROM
Version        : 0
Response Format: 1
Vendor_info    : 'SAMSUNG '
Identifikation : 'CDRW/DVD SN-324F'
Revision       : 'U203'
Device seems to be: Generic mmc2 DVD-ROM.
resid: 118
Using generic SCSI-3/mmc CD-R driver (mmc_cdr).
Driver flags   : SWABAUDIO BURNFREE 
Supported modes: TAO PACKET SAO SAO/R96P SAO/R96R RAW/R16 RAW/R96P RAW/R96R
Drive buf size : 1959936 = 1914 KB
FIFO size      : 4194304 = 4096 KB
Track 01: data   20 MB        
Total size:      24 MB (02:22.68) = 10701 sectors
Lout start:      24 MB (02:24/51) = 10701 sectors
dvdrecord: Input/output error. test unit ready: scsi sendcmd: no error
CDB:  00 00 00 00 00 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: F0 00 02 00 00 00 00 0A 00 00 00 00 3A 01 00 00
Sense Key: 0x2 Not Ready, Segment 0
Sense Code: 0x3A Qual 0x01 (medium not present - tray closed) Fru 0x0
Sense flags: Blk 0 (valid) 
cmd finished after 0.009s timeout 40s
dvdrecord: No disk / Wrong disk!
    
Of course, I had loaded a disk and closed the tray. The disk was the Memorex DVD+RW that came packed with the drive - now why do you suppose they packed it with a disk it can't write?

Linux Kernel Image

2005-01-17 update: I upgraded to version 2.6.10 of the kernel, making these changes to the configuration:
-CONFIG_MPENTIUM4=y
+CONFIG_MPENTIUMM=y
+CONFIG_ACPI_CUSTOM_DSDT=y
+CONFIG_ACPI_CUSTOM_DSDT_FILE="/boot/dsdt.hex"
+CONFIG_ACPI_VIDEO=y
+CONFIG_CPU_FREQ_GOV_ONDEMAND=y
+CONFIG_PCCARD=y
+CONFIG_PNPACPI=y
+CONFIG_CDROM_PKTCDVD=y
+CONFIG_CDROM_PKTCDVD_BUFFERS=8
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+CONFIG_USB_STORAGE_RW_DETECT=y
+CONFIG_MMC=y
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_WBSD=y
	
I don't know why I originally got the CPU type wrong.

The stock kernel now has provisions for a custom DSDT. I put it in /boot along with the other boot-time files.

I made the last three changes in hopes of getting the internal MMC/SD card reader working, using the driver for Winbond's W83L518D and W83L519D SD/MMC card readers in the 2.6.10 kernel. No success there, though. According to the project page http://projects.drzeus.cx/wbsd/, the driver should display a message if it recognizes the chip. However, when I load the wbsd module all I get is:

  wbsd: Winbond W83L51xD SD/MMC card interface driver, 1.0
  wbsd: Copyright(c) Pierre Ossman
	
Also, the Windows didn't include the file wbsd.sys. Apparently Dell used some other chip for the SD/MMC slot.

2005-11-19 update: I've upgraded to a 2.6.12.2 kernel. I tried a 2.6.14 kernel, but software suspend failed. I've read there were problems with USB support, and assume that was the culprit.

2007-02-18 update: I've upgraded to a 2.6.18 kernel. Here is a 2.6.18 kernel configuration file and the resulting kernel image. Note that this kernel has the above mentioned DSDT compiled in, so it's customized for 640 MB of system memory. It has drivers compiled in for the Ethernet (CONFIG_TIGON3), video, and USB flash memory and CDROM (CONFIG_USB_STORAGE and CONFIG_BLK_DEV_SR to provide /dev/sr0). This kernel also has swsusp configured and working. I've added support for IEEE 1394 (FireWire), 2200BG miniPCI wifi using the version of ipw2200 now shipped with the kernel, LEDs (though I have not found anything that uses them), ALSA sound, and tunneling (for setting up a Virtual Private Network).


External Backup

2005-11-19 update: I have been backing this machine up to a Lacie external USB drive, which worked fine but got pretty hot. I just moved the drive to a Creative I/O aluminum enclosure with fan that I got from newegg.com. The first one they sent was DOA (no +5 power). I RMA'd it, and the second one works fine. However, there were two errors in the documentation:

I have been using the following script to back up to the external drive. The primary differences from Mike Rubel's script are: For what it's worth, I've found that adding another linked backup costs five or ten percent more space, for a Linux machine. However, if your mail user agent keeps all messages in one big file, then each backup will have its own copy of that file. If you keep a big mail archive, this can substantially increase the size of a backup.
#!/bin/bash
# ----------------------------------------------------------------------
# adapted from Mike Rubel's handy rotating-filesystem-snapshot utility
# http://www.mikerubel.org/computers/rsync_snapshots/
# ----------------------------------------------------------------------

PATH=/bin:/usr/bin; unalias -a; set -e		# avoid surprises

# ------------- file locations -----------------------------------------

SELF=$(basename $0)
BACKUP_DIR=/backup;
HOST=`uname -n`
d=$BACKUP_DIR/$HOST/snapshot
EXCLUDES=/usr/local/etc/backup_exclude;

# ------------- rotate the backups -------------------------------------

# The parameters are the suffixes of the directory names to be
# included in the rotation, with the oldest mentioned first.  
# "rotate 2 1 0" does $d.1 -> $d.2 then $d.0 -> $d.1.

rotate(){
    logger -s -t $SELF "rotating $d.0 through $d.$1"
    rm -rf $d.$1
    while [ -d $d.$2 ]; do
	mv $d.$2 $d.$1
	shift		
    done
}

# ------------- the script itself --------------------------------------

# make sure we're running as root
if (( `id -u` != 0 )); then {
	echo "$0: Sorry, must be root.";
	exit 1;
} fi

# attempt to (re)mount the backup filesystem as RW; else abort
if grep -q $BACKUP_DIR /etc/fstab; then	# directory is mountable
    if mount | grep -q $BACKUP_DIR; then # directory is mounted
	opt=remount,rw
    else opt=rw
    fi
    if ! mount -o $opt $BACKUP_DIR; then
	logger -s -t $SELF "could not (re)mount $BACKUP_DIR readwrite.";
	exit 1;
    fi
fi

# check whether a backup is in progress
if [ -f /var/lock/$SELF ]; then
    logger -s -t $SELF "another backup is already in progress."
    exit 1;
fi
echo $$ > /var/lock/$SELF # /var/lock is cleaned out on reboot

START=`date +%s`
logger -s "$SELF starts"

# ensure directories exist, to avoid errors in the following
for x in 1 2 3 4 5; do
    if [ ! -d $d.$x ]; then mkdir -p $d.$x; touch -d 1970-01-01 $d.$x; fi
done

# Maintain geometrically spaced backups even if backup script is
# called at irregular times (e.g. for a removable drive).  (This also
# makes the backup script idempotent, so calling it twice in succession
# only updates the current backup.)
now=`date +%s`
if [   $((($now-`date -r $d.5 +%s`)/86400)) -gt 243 ]; then rotate 5 4 3 2 1 0;
elif [ $((($now-`date -r $d.4 +%s`)/86400)) -gt 81  ]; then rotate 4 3 2 1 0;
elif [ $((($now-`date -r $d.3 +%s`)/86400)) -gt 27  ]; then rotate 3 2 1 0;
elif [ $((($now-`date -r $d.2 +%s`)/86400)) -gt 9   ]; then rotate 2 1 0;
elif [ $((($now-`date -r $d.1 +%s`)/86400)) -gt 3   ]; then rotate 1 0;
else                                                      true;
fi

# rsync from the system into the new snapshot, making hardlinks to
# files in the previous snapshot when unchanged
rsync  --verbose --archive --delete --delete-excluded --sparse		\
    --exclude-from="$EXCLUDES"						\
    --link-dest=$d.1							\
    /c/proj /c/Documents\ and\ Settings /c/tmp /c/pub			\
    /bin /boot /etc /home /initrd /lib /opt /root /sbin /usr /var	\
    $d.0  || logger -s -t $SELF "rsync returns $?"

rm -f $d.0/TIMESTAMP
touch $d.0/TIMESTAMP		# also updates mtime of $d.0
ls -litd $d.0 > /etc/BACKUP-LOCAL

rm -f  /var/lock/$SELF

echo "disk space usage on backup partition:"; df /backup

# remount the snapshot mountpoint as readonly
if grep -q $BACKUP_DIR /etc/fstab; then	# directory is mountable
    if grep -q "$BACKUP_DIR.*noauto" /etc/fstab; then # dir usually unmounted
	umount $BACKUP_DIR || \
	    logger -s -t $SELF "could not umount $BACKUP_DIR.";
    else
	mount -o remount,ro $BACKUP_DIR || \
	    logger -s -t $SELF "could not remount $BACKUP_DIR readonly.";
    fi
fi

END=`date +%s`
logger -s -t $SELF "finished in $((($END-$START)/60)) min"
    

DISCLAIMER: I have no connection to any of the companies mentioned here, other than as a customer. For official information, see the official sites.


home

Last modified: 2008-01-19

Valid HTML 4.01!

Valid CSS!

TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones