[ltp] T42p + suspend2 + acpi + hotplug Ultrabay working (fwd)

David A. Desrosiers linux-thinkpad@linux-thinkpad.org
Sun, 17 Apr 2005 10:07:41 -0400 (EDT)


	Through much testing this morning, I decided to try to get 
suspend2 working instead of apm. It required me to have some ACPI 
hooks enabled to trap events, so I could trigger on them. Based on my 
experience with ACPI, I was hesitant, but as long as I'm not using 
ACPI itself to suspend, I'm probably safe.

	(If anyone has questions about what I've configured, what my 
various system files that govern these changes look like, etc. just 
let me know, and I'll try to provide more detail here).

	The results were successful, and my laptop suspends to swap in 
about 2 seconds, and comes back out of suspend in about 4 seconds. 
There is one minor buglet, where my wallpaper in X gets corrupted 
coming out of suspend (24bpp, non-ATI driver), but that's very minor.

	So then I moved onto harder things, getting hot-swappable 
support for my Ultrabay devices (a second IDE sled and the standard 
CD/DVD+/-RW drive.

	First, I tried using idectl and hdparm directly, but that 
didn't turn out so well. For those who want to try it, I used the 
following in my eject event:

	/bin/sync && /bin/sync
	/usr/bin/idectl 1 off
	/sbin/hdparm -b0 /dev/hdc

	..and the following in my "insert" event: 

	/sbin/hdparm -b1 /dev/hdc
	/usr/bin/idectl 1 on
	/usr/bin/idectl 1 rescan

	While that did bring up an 'hdc' device, it was completely 
unusable to any userland application, and was throwing all kinds of 
errors in the logs (723M of logs in only a few seconds, EEK!).

	Dead end there.

	So then I tried the 'hotswap' package, with greater success: 

	In my "eject" event, I have: 

	/bin/sync && /bin/sync
	/usr/bin/hotswap -c 1 unregister-ide

	..and the following in my "insert" event: 

	/bin/sleep 2
	/bin/sync && /bin/sync
	/usr/bin/hotswap -c 1 rescan-ide

	This worked perfectly, and lets me put my secondary IDE drive 
in the Ultrabay _or_ the DVD/CD drive. There's one problem though, and 
I believe it lies deep in the kernel... once you unregister the IDE 
interface, you lose DMA, and you can't get it back until/unless you 
reboot with a device in the bay that supports DMA. Ugh.

	For me, this is a blocker. Once I hot-swap the Ultrabay, the 
entire machine gets jerky, like a strobe light. The mouse jerks 
around, the sound jerks around, everything goes haywire, since DMA was 
disabled. It brings the machine to its knees. Near-success, but still 
a dead-end there (I tried this with a 2.6.11.7 kernel, FWIW).

	The next thing was to get cpufreq properly working, so I can 
save on battery life by keeping the laptop down to 600Mhz most times, 
until I'm either using vmware or building software. 

	This involved a quick change to the governor I was using in 
the kernel, and one userland binary to switch the "ondemand" governor 
to "on". That was a quick and easy change, and as I type this, the 
cpufreq applet shows 600Mhz.

	One more thing I wanted to try, was getting multichannel audio 
support working through dmix (via alsa). After some minor changes to 
the userland apps I use to play audio (mplayer, xine, xmms, ogle), 
everything worked out great, and now I have multiple audio channels 
available simultaneously.

	For me, this means I can be listening to music streams, and 
also have my text-to-speech plugins for xchat and gaim available at 
the same time as well, so I don't have to keep switching virtual 
desktops to check when/if people are talking to me.

	Lastly, keyboard hotkeys, and this is partly where I'm stuck 
at the moment.. I've got the "Back" and "Forward" keys working fine 
via xmodmap, but I can't seem to hook suspend2 into Fn-F12 or suspend 
to RAM (via acpi, potentially deadly on my particular hardware) to 
Fn-F4. Bluetooth (Fn-F5) works (always has, without acpi), Fn-F7 works 
(always has, even without acpi or any event trapping), and the various 
other hotkeys work... except Fn-F4 to suspend to RAM and Fn-F12 to 
hibernate to disk.

	Anyone know how to do that? 
 

David A. Desrosiers
desrod@gnu-designs.com
http://gnu-designs.com