I am using the 2.6.5 kernel on a modular boot disk. I am finding that
invocations of "modprobe" are returning sooner than I would like.
For example, I invoke "modprobe hid" to make my USB keyboard work.
This loads the module and exits immediately, causing my script to
proceed, before the USB keyboard is probed and ready.
I want to wait until the driver is finished initializing (i.e., a USB
keyboard is either found or not found) before my script continues.
How can I do that?
I seem to be having similar problems loading certain other modules
(PCMCIA, Ethernet), but hid.o is the only one for which I have not
found a convenient workaround.
I apologize if this is a stupid question. I have spent some time
searching both the Linux source code and the linux-kernel archives to
no avail.
Thanks!
- Pat
Patrick J. LoPresti wrote:
> For example, I invoke "modprobe hid" to make my USB keyboard work.
> This loads the module and exits immediately, causing my script to
> proceed, before the USB keyboard is probed and ready.
>
> I want to wait until the driver is finished initializing (i.e., a USB
> keyboard is either found or not found) before my script continues.
> How can I do that?
How about scanning the usb device tree to see if the keyboard is present and properly detected?
Chris
Chris Friesen <[email protected]> writes:
> Patrick J. LoPresti wrote:
>
> > For example, I invoke "modprobe hid" to make my USB keyboard work.
> > This loads the module and exits immediately, causing my script to
> > proceed, before the USB keyboard is probed and ready.
> > I want to wait until the driver is finished initializing (i.e., a USB
> > keyboard is either found or not found) before my script continues.
> > How can I do that?
>
> How about scanning the usb device tree to see if the keyboard is
> present and properly detected?
You mean under sysfs or usbfs? Or both?
I see how I can scan for a USB keyboard after loading the USB host
controller module. I think. But what do I look for, exactly, to tell
when hid.o has hooked itself up to the keyboard?
- Pat
Patrick J. LoPresti wrote:
> You mean under sysfs or usbfs? Or both?
Somewhere in there...
> I see how I can scan for a USB keyboard after loading the USB host
> controller module. I think. But what do I look for, exactly, to tell
> when hid.o has hooked itself up to the keyboard?
I don't know exactly what you'd look for. Greg K-H would be the guy to ask, I think.
Chris
On Mon, Apr 26, 2004 at 03:50:52PM -0400, Patrick J. LoPresti wrote:
>
> I see how I can scan for a USB keyboard after loading the USB host
> controller module. I think. But what do I look for, exactly, to tell
> when hid.o has hooked itself up to the keyboard?
I can think of at least 2 different ways (there are probably more):
- look at the device in /proc/bus/usb/devices and wait until the
driver is bound to that device "(hid)" will show up as the
driver bound to that interface
- look at the sysfs directory for the hid driver and wait for
the symlink to the device shows up. This should be at
/sys/bus/usb/drivers/hid
Hope this helps,
greg k-h
On Monday 26 April 2004 22:10, Patrick J. LoPresti wrote:
> For example, I invoke "modprobe hid" to make my USB keyboard work.
> This loads the module and exits immediately, causing my script to
> proceed, before the USB keyboard is probed and ready.
>
> I want to wait until the driver is finished initializing (i.e., a USB
> keyboard is either found or not found) before my script continues.
> How can I do that?
>
> I seem to be having similar problems loading certain other modules
> (PCMCIA, Ethernet), but hid.o is the only one for which I have not
> found a convenient workaround.
Well, this isn't what you wanted to hear :-) but I use sleep on my
PCMCIA/nfsroot boot initrds. Sleeping for 3-5 seconds is enough for the
modules to load properly and it won't slow down the boot too much either...
Kim
Patrick J. LoPresti wrote:
> Chris Friesen <[email protected]> writes:
>
>
>>Patrick J. LoPresti wrote:
>>
>>
>>>For example, I invoke "modprobe hid" to make my USB keyboard work.
>>>This loads the module and exits immediately, causing my script to
>>>proceed, before the USB keyboard is probed and ready.
>>>I want to wait until the driver is finished initializing (i.e., a USB
>>>keyboard is either found or not found) before my script continues.
>>>How can I do that?
>>
>>How about scanning the usb device tree to see if the keyboard is
>>present and properly detected?
>
>
> You mean under sysfs or usbfs? Or both?
>
> I see how I can scan for a USB keyboard after loading the USB host
> controller module. I think. But what do I look for, exactly, to tell
> when hid.o has hooked itself up to the keyboard?
You need to be able to tell "not hooked yet" from "never saw it" for
reliable operation. I don't know how to do that, sorry.
--
-bill davidsen ([email protected])
"The secret to procrastination is to put things off until the
last possible moment - but no longer" -me