简体   繁体   English

未检测到Linux USB设备驱动程序

[英]Linux USB device driver not getting probed

I'm working on a device driver for Linux. 我正在为Linux开发设备驱动程序。 It's a USB pen tablet. 这是USB手写板。 The problem is that the driver's probe callback never gets called. 问题在于,永远不会调用驱动程序的探测回调。 dmesg just shows: dmesg仅显示:

generic-usb: probe of 0003:099A:2620.000F failed with error -22

and i never get to connect to the device. 而且我从来没有连接到设备。 It seems like the systems drivers are overriding my driver in some way? 系统驱动程序似乎在某种程度上替代了我的驱动程序?

My code is registering & unregistering correctly using insmod / rmmod: 我的代码正在使用insmod / rmmod正确注册和注销:

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/usb.h>
#include <linux/slab.h>

MODULE_DEVICE_TABLE (usb, id_table);
struct usb_device_id id_table[] =
{
    {USB_DEVICE(0x099a, 0x2620)}, //Zippy Technology Corp. Digi Tablet
    {0}
};

void dt_disconnect(struct usb_interface *interface)
{
    printk("dt_disconnect called\n");
}

int dt_probe(struct usb_interface *interface, const struct usb_device_id *id)
{
    printk("dt_probe called\n");
    return 0;
}

static struct usb_driver dt_driver =
{
    .name = "Zippy Technology Corp. Digi Tablet",
    .probe = dt_probe,
    .disconnect = dt_disconnect,
    .id_table = id_table
};

static int __init dt_init(void)
{
    //0 means success
    int error = usb_register(&dt_driver);
    if(error)
        printk("dt_init failed\n");

    return 0;
}

static void __exit dt_exit(void)
{
    //void
    usb_deregister(&dt_driver);
}

module_init(dt_init);
module_exit(dt_exit);

MODULE_LICENSE("GPL");

dt_probe is never called. 永远不会调用dt_probe。 I'm using Linux 2.6.40 (Fedora 15's version of 3.0) and most documentation about this stuff is very old so I thought I'd ask here. 我使用的是Linux 2.6.40(Fedora 15的3.0版),有关此内容的大多数文档都非常老,所以我想在这里问一下。 Any thoughts? 有什么想法吗?

Yes, usbhid driver overrides your driver. 是的,usbhid驱动程序会覆盖您的驱动程序。 You need to remove the usbhid driver from the running kernel. 您需要从正在运行的内核中删除usbhid驱动程序。 First deattach your device from the system and use "modprobe -r usbhid" to remove the usbhid module. 首先,从系统上断开设备的连接,然后使用“ modprobe -r usbhid”删除usbhid模块。 Now insert your module and attach the device, then your driver will be taken. 现在插入您的模块并连接设备,然后将使用您的驱动程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM