[ltp] A new udev rule gives me 3min startup delay

Daniel Castro linux-thinkpad@linux-thinkpad.org
Tue, 25 Aug 2009 11:20:30 +0100


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

Hey All,

I think someone here will be able to point me with a solution to this
problem.

A few months ago I wrote this tutorial
http://ubuntuforums.org/showthread.php?t=1076486 which basically catches lid
and dock events so that you can then do whatever you want. I did this
getting bits and pieces of information all over the place, including this
mailer from which I got how to catch the dock/undock event. This was done on
Ubuntu 8.10.

Now that I try the exact same procedure on Ubuntu 9.04 I get a problem with
the udev rule file.

Basically what I do is create a file /etc/udev/rules.d/80-thinkpad-T61.rules
with

KERNEL=="dock.0", ATTR{docked}=="1", RUN+="/etc/thinkpad/dock.sh 1"
KERNEL=="dock.0", ATTR{docked}=="0", RUN+="/etc/thinkpad/dock.sh 0"

And then create a /etc/thinkpad/dock.sh file with

#!/bin/sh
# wait for the dock state to change
sleep 1
DOCKED=$(cat /sys/devices/platform/dock.0/docked)
case "$DOCKED" in
    "0")
    #undocked event - do whatever you want here
    ;;
    "1")
    #docked event - do whatever you want here
    ;;
esac
exit 0

It work fine, it catches the event and does what I want to do. BUT, for some
reason during startup it's creating a huge delay, like 3 minutes. As soon as
I move the file /etc/udev/rules.d/80-thinkpad-T61.rules out of that folder
startup times go back to normal.

Any ideas or pointers?

Thanks!

-- 
________________________

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

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

Hey All,<br><br>I think someone here will be able to point me with a soluti=
on to this problem.<br><br>A few months ago I wrote this tutorial <a href=
=3D"http://ubuntuforums.org/showthread.php?t=3D1076486">http://ubuntuforums=
.org/showthread.php?t=3D1076486</a> which basically catches lid and dock ev=
ents so that you can then do whatever you want. I did this getting bits and=
 pieces of information all over the place, including this mailer from which=
 I got how to catch the dock/undock event. This was done on Ubuntu 8.10.<br=
>
<br>Now that I try the exact same procedure on Ubuntu 9.04 I get a problem =
with the udev rule file.<br><br>Basically what I do is create a file /etc/u=
dev/rules.d/80-thinkpad-T61.rules with<br><br>KERNEL=3D=3D&quot;dock.0&quot=
;, ATTR{docked}=3D=3D&quot;1&quot;, RUN+=3D&quot;/etc/thinkpad/dock.sh 1&qu=
ot;<br>
KERNEL=3D=3D&quot;dock.0&quot;, ATTR{docked}=3D=3D&quot;0&quot;, RUN+=3D&qu=
ot;/etc/thinkpad/dock.sh 0&quot;<br><br>And then create a /etc/thinkpad/doc=
k.sh file with<br><br>#!/bin/sh<br># wait for the dock state to change<br>s=
leep 1<br>
DOCKED=3D$(cat /sys/devices/platform/dock.0/docked)<br>case &quot;$DOCKED&q=
uot; in<br>=A0=A0=A0 &quot;0&quot;)<br>=A0=A0=A0 #undocked event - do whate=
ver you want here<br>=A0=A0=A0 ;;<br>=A0=A0=A0 &quot;1&quot;)<br>=A0=A0=A0 =
#docked event - do whatever you want here<br>
=A0=A0=A0 ;;<br>esac<br>exit 0<br><br>It work fine, it catches the event an=
d does what I want to do. BUT, for some reason during startup it&#39;s crea=
ting a huge delay, like 3 minutes. As soon as I move the file /etc/udev/rul=
es.d/80-thinkpad-T61.rules out of that folder startup times go back to norm=
al.<br>
<br>Any ideas or pointers?<br><br>Thanks!<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"mai=
lto:castromd@tcd.ie">castromd@tcd.ie</a><br>
________________________<br>

--0015175cab7c19af730471f4af50--