[ltp] hotkey and hotswap

Winsley von Spee linux-thinkpad@linux-thinkpad.org
Wed, 02 Feb 2005 16:04:47 +0100


Hi All

I just played around with the hotkey feature of the new ibm_acpi version
0.10 and I was happy to found out that removing the ultrabay device does
produce an acpi event. So I wrote a little script to automatically
register and unregister the device. 
I don't have the Ulrabay Battery so if you have one try what hotswap
says to the battery. The man page says you don't need to register
batterys or floppy drives cause they are no ide devices but the script
doesn't hang on errors so it shouldn't be a problem. 

To use the script say ./ultrabay unregister to unregister the currently
inserted ide device and ./ultrabay register to register it again.

The Script uses hotswap 0.4.0 and perhaps it's better/makes more sense
to use the hotswaprc file (see man hotswaprc) but so or so you have to
call hotswap with different arguments and write some limes for handling
mounted devices either for registering or for unregistering the device. 

My Thinkpad r50p (183222G) produces "ibm/bay MSTR 00000003 00000000" if
you unlock the bay and "ibm/bay MSTR 00000001 00000000" if you remove
the device or lock the bay. So if you use the script to un-/register the
device it will be called three times. First if you unlock the bay,
second if you remove the device and last if you lock the bay again.
You have to "echo enable > /proc/acpi/ibm/hotkey && echo 0xffff
> /proc/acpi/ibm/hotkey" in order to generate these acpi events. See man
acpid and the ibm_acpi readme for more details on handling acpi events.


Feedback is welcome. Obtain it from here ...
http://jack-son.de/thinkpad/ultrabay


Is there a way to force umounting regardless of the state of the device
(panic umounting or so) ???


Greetz


P.s.: If someone has to smile about my English *g* feel free to correct
me.