From: Olaf Hering <olh@suse.de>
To: linux-hotplug@vger.kernel.org
Subject: Re: [PATCH] hotplug usb.rc changes
Date: Sun, 08 Jun 2003 05:42:00 +0000 [thread overview]
Message-ID: <marc-linux-hotplug-105505121505194@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-105500525713006@msgid-missing>
On Sat, Jun 07, Wout Mertens wrote:
> Hi Olaf,
>
> Is the waiting absolutely necessary?
>
> Could it be shorter? Or could you make it only do that during coldplug
> phase?
>
> The reason I'm asking is because I use my USB memory key to log in, and
> that needs to wait 3 seconds (I patch it out of course) for no reason
> whatsoever.
You mean you need the sleep 3 or you do not need the sleep 3?
And with the current way, a 3 seonds delay will happen anyway, with the
patch it will only wait 1 second for the first event.
If you are worried about usb.rc, there will be no delay if the events
are already finished. I'm not sure if we should wait for all background
events before proceeding. A little testing shows that it could take up
to 30 seconds, depending on the amound and kind of connected USB
devices. Really slow hid devices are a pain...
We could improve things alot if /proc/bus/usb/devices had a better
design :(
It is updated dynamically, reading it can take an unknown amount of time
and it triggers bus traffic. You can not do
grep -Eq '^I: .* Driver=\(none\)$' /proc/bus/usb/devices
Alot bus traffic could be avoided if the content would be static, no
poking with usbmodules needed if there is no device without a driver ->
no delay needed at all in such a case. There are probably ways in 2.5 to
check for devices without drivers in /sys, but I have not verified it.
-rw-r--r-- 1 root root 225 2003-06-08 07:26:57.000000000 +0200 /tmp/a
-rw-r--r-- 1 root root 3022 2003-06-08 07:27:01.000000000 +0200 /tmp/b
-rw-r--r-- 1 root root 980 2003-06-08 07:27:26.000000000 +0200 /tmp/c
This was my test patch:
# there could be still some active hotplug events
# wait for them because other rc scripts may need the drivers
+ echo /var/run/usb/*.queue.* > /tmp/a
sleep 3 & DELAY_PID=$!
until [ "`ls /var/run/usb/*.queue.* 2>/dev/null`" = "" ] ; do
test -d /proc/$DELAY_PID || break
done
+ echo /var/run/usb/*.queue.* > /tmp/b
+ ps axf >> /tmp/b
+ until [ "`ls /var/run/usb/*.queue.* 2>/dev/null`" = "" ] ; do
+ sleep 1
+ done
+ echo /var/run/usb/*.queue.* > /tmp/c
+ ps axf >> /tmp/c
> > + # there could be still some active hotplug events
> > + # wait for them because other rc scripts may need the drivers
> > + sleep 3 & DELAY_PID=$!
> > + until [ "`ls /var/run/usb/*.queue.* 2>/dev/null`" = "" ] ; do
> > + test -d /proc/$DELAY_PID || break
> > + done
--
USB is for mice, FireWire is for men!
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
next prev parent reply other threads:[~2003-06-08 5:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-07 16:56 [PATCH] hotplug usb.rc changes Olaf Hering
2003-06-07 17:51 ` Olaf Hering
2003-06-07 20:28 ` Wout Mertens
2003-06-08 5:42 ` Olaf Hering [this message]
2003-06-08 19:11 ` David Brownell
2003-06-10 21:30 ` Olaf Hering
2003-06-11 0:19 ` David Brownell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-linux-hotplug-105505121505194@msgid-missing \
--to=olh@suse.de \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).