[ltp] T23, ibm-acpi and UltraBay hotswapping
David Tansey
linux-thinkpad@linux-thinkpad.org
Tue, 11 Jan 2005 22:06:13 -0500
here are my docking/undocking scripts (and events/ files) -- got them
somewhere online and only modified them slightly.
dock.sh:
#!/bin/bash
status=`/usr/bin/awk '/^status:/ { print $2 }' /proc/acpi/ibm/dock`
echo dock > /proc/acpi/ibm/dock
# if ide1 (cdrom) is already there exit
if [ -L /proc/ide/hdc ]; then
exit 1
fi
# else register it
sleep 1
/bin/sync
hotswap -c 1 rescan-ide
chvt 1
sleep 1
chvt 7
undock.sh:
#!/bin/bash
status=`/usr/bin/awk '/^status:/ { print $2 }' /proc/acpi/ibm/dock`
if [ "$status" == "docked" ]; then
ifdown eth0
/bin/sync
# make sure the bay's cdrom is unmounted
umount /cdrom
#idectl not working properly on Debian sarge at the moment.
#/usr/local/sbin/idectl 1 off
#so use hotswap:
#unregister ide1
hotswap -c 1 unregister-ide
if [ -L /proc/ide/hdc ]; then
exit 1
fi
echo undock > /proc/acpi/ibm/dock
fi
chvt 1
sleep 1
chvt 7
events/dock:
event=(ibm/dock GDCK 00000000 00000003|ibm/hotkey HKEY 00000080
00001008)
action=/etc/acpi/dock.sh
events/undock:
event=(ibm/dock GDCK 00000003 00000001|ibm/hotkey HKEY 00000080
00001008)
action=/etc/acpi/undock.sh
hope that helps. i switched to hotswap because i was getting a lot of
failed suspends/resumes after undocking. it has helped. i still
sometimes get failed resumes, but very infrequently.
-david
On Wed, 2005-01-12 at 02:50 +0100, André Wyrwa wrote:
> Hi,
>
> > I just tried a kernel 2.6.10 with ACPI support and ibm-acpi, because I
> > wanted to test UltraBay hotswapping on my T23. I ejected the DVD-ROM
> > drive (after echo eject > /proc/acpi/ibm/bay and the UltrBay LED went
> > off) and re-inserted it. Then I did mount /cdrom, the drive spins up,
> > and the machine freezes.
>
> Did you use idectl or hdparm to unregister the device? Echoing eject
> to /proc/acpi/ibm/bay is not enough, since it only tells the ThinkPads
> ACPI interface that the drive is ready for being removed. Prior doing
> this you should unregister the device at the systems IDE driver. To do
> this, use idectl/hdparm.
>
> André.
>