[ltp] Re: What are people using for Dock/Undocking scripts for their X60/61's?

Daniel Castro linux-thinkpad@linux-thinkpad.org
Thu, 5 Mar 2009 17:05:44 +0000


--0016367fa374ce35a40464622d51
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

2009/3/5 Theodore Tso <tytso@mit.edu>

> 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.

oh sorry... yes my scripts are to run stuff after dock/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
> --
> The linux-thinkpad mailing list home page is at:
> http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpad
>
>


-- 
________________________

Daniel Castro, M.Sc.
+353 083-318-2058
dancasmo@gmail.com
castromd@tcd.ie
________________________

--0016367fa374ce35a40464622d51
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br><div class=3D"gmail_quote">2009/3/5 Theodore Tso <span dir=3D"ltr">=
&lt;<a href=3D"mailto:tytso@mit.edu">tytso@mit.edu</a>&gt;</span><br><block=
quote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 2=
04); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class=3D"im">On Thu, Mar 05, 2009 at 02:41:50PM +0000, Daniel Castro w=
rote:<br>
&gt; &gt; I checked this link and it led to <a href=3D"http://en.opensuse.o=
rg/Dockutils" target=3D"_blank">http://en.opensuse.org/Dockutils</a><br>
&gt; &gt; which, as you say, hasn&#39;t been updated since 2007.<br>
&gt; &gt;<br>
&gt; &gt; Have you found something better in the meantime?<br>
<br>
</div>With the latest bleeding edge kernel and with Ubuntu 8.10, pushing th=
e<br>
request-to-undock button seems to do the trick automatically for me.<br>
I haven&#39;t had a chance to track exactly *how* this magic is performed,<=
br>
since it&#39;s missing some pieces that I would like to add.<br>
Specifically, before actually allowing the undock to proceed, I want<br>
to be able to find any filesystems mounted on the hard drive in the<br>
bay, and unmount them, then if LVM is running run &quot;vgchange -an<br>
/dev/&lt;vggroup&gt;&quot; to deactivate the LVM volumes before proceeding =
with<br>
the mount.<br>
<div class=3D"im"><br>
&gt; I recently did this tutorial for t61 and t61p. Might help...<br>
&gt; <a href=3D"http://ubuntuforums.org/showthread.php?t=3D1076486" target=
=3D"_blank">http://ubuntuforums.org/showthread.php?t=3D1076486</a><br>
<br>
</div>Am I right? =A0It *looks* like your scripts run after the laptop is<b=
r>
undocked. =A0What I&#39;m trying to figure out is how to place a hook<br>
*before* the laptop is undocked, and then if it turns out the<br>
filesystem can&#39;t be unmounted (because it&#39;s busy, for example), to<=
br>
refuse the undock.</blockquote><div>oh sorry... yes my scripts are to run s=
tuff after dock/undock... <br></div><blockquote class=3D"gmail_quote" style=
=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; p=
adding-left: 1ex;">
<br>
<br>
That is, I want the script to return an error code, and then for the<br>
system not to proceed with the undock operation.<br>
<br>
You can trigger the undock operation from a shell script like this:<br>
<br>
echo 1 &gt; /sys/devices/platform/dock.0/undock<br>
<br>
So I assume what happens is something is catching the event, and then<br>
running that shell script. =A0If we can add some logic to detect whether<br=
>
or not it is safe to undock, then the user will be able to see if the<br>
he/she has permission to undock by looking at the green arrow or the<br>
red &quot;forbidden&quot; light by the docking latch.<br>
<br>
 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0- Ted<br>
<div><div></div><div class=3D"h5">--<br>
The linux-thinkpad mailing list home page is at:<br>
<a href=3D"http://mailman.linux-thinkpad.org/mailman/listinfo/linux-thinkpa=
d" target=3D"_blank">http://mailman.linux-thinkpad.org/mailman/listinfo/lin=
ux-thinkpad</a><br>
<br>
</div></div></blockquote></div><br><br clear=3D"all"><br>-- <br>___________=
_____________<br><br>Daniel Castro, M.Sc.<br>+353 083-318-2058<br><a href=
=3D"mailto:dancasmo@gmail.com">dancasmo@gmail.com</a><br><a href=3D"mailto:=
castromd@tcd.ie">castromd@tcd.ie</a><br>
________________________<br>

--0016367fa374ce35a40464622d51--