LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Fedora (https://www.linuxquestions.org/questions/fedora-35/)
-   -   USB Driver Probe function not being called (https://www.linuxquestions.org/questions/fedora-35/usb-driver-probe-function-not-being-called-377851/)

xtom 10-28-2005 03:48 PM

USB Driver Probe function not being called
 
I am trying to write a kernel USB driver. I have loaded the module and see that the core has accepted the registration. I have given the registration the following table for devices that the driver supports- according to all the doumentation I can find, this structure should tell the core to call my probe function for every device that gets plugged in

static struct usb_device_id usb_table[]=
{
{.driver_info= 42},
{}
};
MODULE_DEVICE_TABLE(usb,usb_table);

The usb_driver structure is as follows:
static struct us_driver mydriver=
{
.owner= THIS_MODULE,
.name= "mydriver",
.id_table= usb_table,
.probe= my_usb_probe,
.disconnect= my_usb_disconnect,
};

As I said, I see the core register the driver (through a message in the log file that I see with dmesg), and a driver shows up under /sys/bus/usb/drivers. When I plug in a memory stick, I see the device being added in the log file again (and via a usbview tool) but my probe function does not get called. I have a printk at the start of the probe function but I never see it in the log (I have a similar message in the init function and I do see that one).

Any help is greatly appreciated - I am running 2.6.9-1.667 and the driver sample I got from the Linux Device Drivers 3rd edition book.

Thanks in advance.....

ssdubey 11-10-2018 12:05 PM

Quote:

Originally Posted by xtom (Post 1924884)
I am trying to write a kernel USB driver. I have loaded the module and see that the core has accepted the registration. I have given the registration the following table for devices that the driver supports- according to all the doumentation I can find, this structure should tell the core to call my probe function for every device that gets plugged in

static struct usb_device_id usb_table[]=
{
{.driver_info= 42},
{}
};
MODULE_DEVICE_TABLE(usb,usb_table);

The usb_driver structure is as follows:
static struct us_driver mydriver=
{
.owner= THIS_MODULE,
.name= "mydriver",
.id_table= usb_table,
.probe= my_usb_probe,
.disconnect= my_usb_disconnect,
};

As I said, I see the core register the driver (through a message in the log file that I see with dmesg), and a driver shows up under /sys/bus/usb/drivers. When I plug in a memory stick, I see the device being added in the log file again (and via a usbview tool) but my probe function does not get called. I have a printk at the start of the probe function but I never see it in the log (I have a similar message in the init function and I do see that one).

Any help is greatly appreciated - I am running 2.6.9-1.667 and the driver sample I got from the Linux Device Drivers 3rd edition book.

Thanks in advance.....

Hi, I have kind of same problem as you described here. Can you please offer some guidance. I am new to device drivers. Thanks.


All times are GMT -5. The time now is 04:38 PM.