[ltp] T43p: Status Report and request for assistance

Maik Zumstrull linux-thinkpad@linux-thinkpad.org
Sun, 5 Jun 2005 23:28:50 +0200 (CEST)


So I recently got myself the new T43p and wanted to Debianize it
immediately. Here's how it went:

Installation
------------

debian-installer didn't work, neither out-of-the-box nor with some
fiddling. The reason: The HDD of the T43p is S-ATA, while the 
CD-ROM is IDE. (Actually, I think it's a P-ATA HDD on the chipset's S-
ATA port via some adapter, but from the software POV, it's a S-ATA
device.)

I used Knoppix and debootstrap to get a base system onto the disk and
install grub, then continued from there. I needed to modify the
mkinitrd configuration to be able to use a Debian distrubtion kernel.

I put

ide-generic
piix
ata_piix
libata
sd_mod
scsi_mod

in /etc/mkinitrd/modules, and set ROOT=/dev/sda1 in
/etc/mkinitrd/mkinitrd.conf.


Hardware
--------

Most of the hardware just works. The problematic stuff:

WLAN:
The madwifi driver is non-free and thus not in Debian. Integrating it
was, however, easy with nothing T43p-specific to it, so I'll skip the
details.

Ethernet:
The tg3 driver works just fine, but is non-free. I used
dilinger's .deb, which will probably enter Debian non-free soon.

CD-ROM:
With a correctly configured initrd, the device is recognized and works
normally. Hotplugging needs a little support from acpid:

# /etc/acpi/events/bay_eject
event=ibm[/ ]bay MSTR 00000003 00000000
action=/etc/acpi/actions/bay_eject.sh

# /etc/acpi/events/bay_insert
event=ibm[/ ]bay MSTR 00000001 00000000
action=/etc/acpi/actions/bay_insert.sh

# /etc/acpi/actions/bay_eject.sh
#!/bin/sh

export PATH="/sbin:/usr/sbin:$PATH"

modprobe -r ide-cd
echo eject > /proc/acpi/ibm/bay

# /etc/acpi/actions/bay_insert.sh
#!/bin/sh

export PATH="/sbin:/usr/sbin:$PATH"

if grep '       occupied' /proc/acpi/ibm/bay ;
then
  modprobe ide-cd
fi

Remaining Problem:
The CD-ROM needs to be present on boot. Afterwards, it can be swapped
out and in at will; but if it isn't in the bay during bootup, it won't
be recognized.

Video Card/Display:
I don't use any kernel framebuffer driver. I use the ATI fglrx driver.
I have the usual problems with this configuration. (When will ATI fix
this shit? Why do I pay for a "professional workstation graphics
adapter" with "professional support" and get...basically junk? A
Laptop without Suspend-to-RAM and external VGA is very limited.
Inacceptably limited.)


Special Buttons
---------------

I'll go through these top-to-bottom, left-to-right.

"Access IBM": Can be used as usual through tpb. Bound it to "Lock
Screen".

Volume down, up, mute: These work without any special support by the
operating system. tpb provides a nice OSD for them. Interestingly, they
seem to control an additional mixer behind the Master and PCM mixer
channels available through ALSA. But...who cares, as long as it works?

Power Button: This one doesn't do anything. It doesn't trigger a tpb
event, and it doesn't trigger an ACPI event. I'd love to use it to
initialize a clean shutdown, but no such luck. Well, I guess I can live
with that.

Fn+F1--Fn+F12: All these trigger ACPI events, because I use the ibm-acpi
module with a mask of 0xffff. I'll only go through those I have bound
to a function or that have logo on them; theoretically, they all can be
used.

Fn+F3: Logo on the key is "disable backlight", so that's what I bound
it to, using radeontool.

Fn+F4: Logo on the key is sleep mode, which I have bound it to using
the following scripts:

# /etc/acpi/events/sleep
event=ibm[/ ]hotkey HKEY 00000080 00001004
action=/etc/acpi/actions/sleep.sh

# /etc/acpi/actions/sleep.sh
#!/bin/sh

export PATH="/sbin:/usr/sbin:$PATH"

# Sync all disks
sync

# Save the video card's internal state
VBES="`mktemp`"
vbetool vbestate save > "$VBES"

# Switch away from X
CURVT=`fgconsole`
chvt 1

# Sync all disks, again
sync

# Disable WLAN
lsmod | grep ath_pci && /etc/acpi/actions/toggle_wlan.sh

# Disable USB
invoke-rc.d hotplug stop

# Save system time
hwclock --systohc

# Actually go to sleep
echo mem > /sys/power/state

# Restore system time
hwclock --hctosys

# Initialize video card
vbetool post

# Restore video card's internal state
vbetool vbestate restore < "$VBES"
rm "$VBES"

# Reload USB
invoke-rc.d hotplug start

# Switch back to X
chvt $CURVT

Except...it doesn't work. Most stuff comes back just fine (boot
with acpi_sleep=s3_bios is necessary), but the HDD doesn't spin back
up. If anyone knows a fix for this, I'd really appreciate the help.
For now, the key is useless.

Fn+F5: Logo on the key is something with radiowaves. Before acpid
starts, this triggers bluetooth (which I guess works, the kernel loads
the modules just fine, but I don't have any bluetooth devices to test).
I've rebound this to switch WLAN on and off. Scripts:

# /etc/acpi/events/wlan
event=ibm[/ ]hotkey HKEY 00000080 00001005
action=/etc/acpi/actions/toggle_wlan.sh

# /etc/acpi/actions/toggle_wlan.sh
#!/bin/sh

export PATH="/sbin:/usr/sbin:$PATH"

if lsmod | grep ath_pci
then
  ifdown ath0
  invoke-rc.d wpasupplicant stop
  modprobe -r ath_pci wlan_ccmp
else
  modprobe ath_pci
  invoke-rc.d wpasupplicant start
  sleep 2
  ifup ath0
fi

Fn+F7: Logo is "toggle LCD/CRT". I've bound it to the equivalent 
ibm-acpi command, but this only works on the console, not in X, and on
the console the "LCD and CRT" mode doesn't work correctly (creates
some insane video timing on the external port).

This one, I'm really pissed about. I basically don't care _why_ it
doesn't work; point is, it should. The ATI guys, IBM, kernel devs, X11
devs, or whomever need to fix this. Like, NOW. From what google tells
me, basically every modern laptop has trouble with this.

Fn+F9: No logo, but this key triggers video zoom on quite a few models,
so I've bound precisely that function to this key. Surprisingly, this
even works under X (if I don't change the fglrx driver options even a
little bit from what they are now).

Section "Device"
        Identifier      "ATI"
        Driver          "fglrx"
        Option          "DynamicClocks" "on"
        Option          "VideoOverlay" "on"
        Option          "OpenGLOverlay" "off"
        Option          "UseInternalAGPGART" "off"
EndSection

Fn+F12: Key logo is suspend-to-disk, but I haven't tried getting that to
work yet.

Fn+Space: This key has the "trigger video zoom" logo. If I press it,
tpb gives a "Zoom On" or "Zoom Off" OSD message. Unfortunately, the
combination does not trigger an ACPI event, and tpb can't bind it to
anything, so it has no effect right now except to give a message for
something it doesn't even do -- that function is on Fn+F9.



So, my TODO list as of now reads:
- External display support, with Fn+F7
- Suspend-to-RAM support, problem to solve: HDD
- Suspend-to-Disk support, problem to solve: Haven't started yet