LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   usb driver probe problem (https://www.linuxquestions.org/questions/linux-kernel-70/usb-driver-probe-problem-813871/)

jzviagin 06-13-2010 09:55 AM

usb driver probe problem
 
hello, im writing a Usb driver and i have an issue.
when i insmod the driver with the device already plugged in before, the probe function is not called. it is only called after i disconnect the device and plug it again.
i wanna make it work when i start my pc with the device plugged in.
could someone please help me?
best regards,
jacob.

JZL240I-U 06-14-2010 05:08 AM

The logic escapes me. As I understand (but don't know) it, the probe function is triggered by plugging in a device. Why should that happen when you insert a module if you didn't program that into the module?

Asked the other way round, do the other drivers trigger a probe? If so, find out how they do it.

jzviagin 06-14-2010 05:40 AM

well maybe i asked the question the wrong way.
when you start ubuntu for example with some usb device plugged in before system loads you see the device working.
in my driver i want the same behavior. at the moment it works only when i plug the device after the driver is already loaded then the probe callback is called and initialization begins.
i want it to work if i start the pc with the device plugged.
can you help please?

JZL240I-U 06-14-2010 05:45 AM

When do you insert your driver (as a kernel module)? Maybe it is too late to be "connected" to the device like the other usb-devices are?

jzviagin 06-14-2010 06:21 AM

i insmod the driver on a script file i put in /etc/rc.d/init.d/ folder

JZL240I-U 06-14-2010 06:40 AM

Well, that is definitely lots later than the other drivers get loaded and by an other mechanism too. Is your driver a kernel object, i.e. *.ko module? Then you should use the usual mechanism to load it, too...

jzviagin 06-14-2010 10:19 AM

thank you for your time but i dont know any mechanism to load a KO because i'm new to linux. im using 2.4.23 kernel because i have some old drivers which are not availible on 2.6.
could you give me more information about the mechanism you mentioned earlier.
thanks!

JZL240I-U 06-15-2010 01:05 AM

I see. Right now I'm not in front of a linux box. I'll try to look it up tonight. In short, the kernel modules are kept in a directory like /lib/modules/2.4.23/* and get loaded via insmod which is controlled by a list in /etc/<forgot>/<it>. I hope I can five you more details later.

jzviagin 06-15-2010 02:51 AM

hello i copied all modules to the folder you mentioned but nothing new.
did you find the module loading script?

JZL240I-U 06-15-2010 03:05 AM

Yeah, I just remembered. The system uses /sbin/modprobe during the boot process. The controlling file resides in /etc/modprobe.conf (if your system uses that to load modules).

jzviagin 06-15-2010 03:18 AM

im using 2.4 kernel and theres's no such file in /etc

JZL240I-U 06-15-2010 03:21 AM

Ooops. First make sure that your system has "/sbin/modprobe". Then it is google for you, find out what preceded modprobe.conf and modify that. Sorry, I can't give more help here, I havo no system which is that old.

bsat 06-15-2010 07:47 AM

I am not very sure but I feel if you want your module to be loaded when the kernel loads you either need to compile the kernel with the driver so that the kernel image has the driver or, you can add the insmod command in the rc.local script so that the module gets loaded as soon as the system boots up.

JZL240I-U 06-15-2010 07:52 AM

Quote:

Originally Posted by bsat (Post 4004176)
...you can add the insmod command in the rc.local script so that the module gets loaded as soon as the system boots up.

Is that the mechanism for the 2.4.x kernel series? Or is it used in 2.6.y too? Or is it specific for any and all distributions?

sanket1512 06-15-2010 08:17 AM

hey can anybody send me source code for that in my email sanket94277@gmail.com


All times are GMT -5. The time now is 10:20 PM.