[ltp] Re: What are people using for Dock/Undocking scripts for
their X60/61's?
Theodore Tso
linux-thinkpad@linux-thinkpad.org
Thu, 5 Mar 2009 11:08:44 -0500
On Thu, Mar 05, 2009 at 02:41:50PM +0000, Daniel Castro wrote:
> > I checked this link and it led to http://en.opensuse.org/Dockutils
> > which, as you say, hasn't been updated since 2007.
> >
> > Have you found something better in the meantime?
With the latest bleeding edge kernel and with Ubuntu 8.10, pushing the
request-to-undock button seems to do the trick automatically for me.
I haven't had a chance to track exactly *how* this magic is performed,
since it's missing some pieces that I would like to add.
Specifically, before actually allowing the undock to proceed, I want
to be able to find any filesystems mounted on the hard drive in the
bay, and unmount them, then if LVM is running run "vgchange -an
/dev/<vggroup>" to deactivate the LVM volumes before proceeding with
the mount.
> I recently did this tutorial for t61 and t61p. Might help...
> http://ubuntuforums.org/showthread.php?t=1076486
Am I right? It *looks* like your scripts run after the laptop is
undocked. What I'm trying to figure out is how to place a hook
*before* the laptop is undocked, and then if it turns out the
filesystem can't be unmounted (because it's busy, for example), to
refuse the undock.
That is, I want the script to return an error code, and then for the
system not to proceed with the undock operation.
You can trigger the undock operation from a shell script like this:
echo 1 > /sys/devices/platform/dock.0/undock
So I assume what happens is something is catching the event, and then
running that shell script. If we can add some logic to detect whether
or not it is safe to undock, then the user will be able to see if the
he/she has permission to undock by looking at the green arrow or the
red "forbidden" light by the docking latch.
- Ted