[ltp] hotplugging IDE-devices

André Wyrwa linux-thinkpad@linux-thinkpad.org
Sun, 31 Oct 2004 19:40:41 +0100


Hi David,

thanks for your suggestions, but my problem is before all this script
stuff comes in. My hdparm call (which is executed at the end of the
idectl script) seems not to work.

Could you please issue a "ls /proc/ide/hdc" after doing a
"/usr/local/sbin/idectl 1 off" and give me the output?

And are you using udev? Do you have the ide driver compiled into the
kernel or as modules?

Thx,
André.


On Sa, 2004-10-30 at 23:00 -0400, David Tansey wrote:
> here are my dock/undock scripts. you have to use idectl, which is
> usually included with hdparm.
> 
> dock.sh:
> #!/bin/bash
> 
> status=`/usr/bin/awk '/^present:/ { print $2 }' /proc/acpi/ibm/dock`
> 
> if [ "$status" == "yes" ]; then
>         /bin/sync
>         /bin/echo dock > /proc/acpi/ibm/dock
>         /usr/local/sbin/idectl 1 rescan
> fi
> 
> undock.sh:
> #!/bin/bash
> 
> status=`/usr/bin/awk '/^present:/ { print $2 }' /proc/acpi/ibm/dock`
> 
> if [ "$status" == "yes" ]; then
>         /bin/sync
>         /usr/local/sbin/idectl 1 off
>         if [ -L /proc/ide/hdc ]; then
>                 exit 1
>         fi
>         /bin/echo undock > /proc/acpi/ibm/dock
> fi
> 
> i tested the line /usr/local/sbin/idectl off/on to make sure that 1 was
> the right number. 
> 
> do you have your /etc/acpi/events directory set up to detect the right
> event? just doing         /bin/echo undock > /proc/acpi/ibm/dock doesn't
> do it.
> 
> events/dock:
> event=(ibm/dock GDCK 00000000 00000003|ibm/hotkey HKEY 00000080
> 00001008)
> action=/etc/acpi/dock.sh
> 
> events/undock:
> event=(ibm/dock GDCK 00000000 00000003|ibm/hotkey HKEY 00000080
> 00001008)
> action=/etc/acpi/dock.sh
> 
> 
> enjoy! i'm loving ibm-acpi!!!
> 
> -david
> 
> 
> On Sun, 2004-10-31 at 02:05 +0200, André Wyrwa wrote:
> > Hei,
> > 
> > since ibm-acpi supports ultrabay and dock/undock events i just wanted to
> > adjust the scripts for my machine.
> > 
> > Trouble is that when i do i.e. a hdparm -U 1 /dev/hdc (my combo drive),
> > the thing would just say
> >    /dev/hdc:
> >    attempting to unregister hwif#1
> > and nothing more.
> > After that /proc/ide/ide1 still exists with the full file tree inside
> > it.
> > 
> > I'm using 2.6.9 and udev. The ide driver is built into the kernel.
> > 
> > Any idea what might go wrong?
> > 
> > André.
> > 
> > 
>