[php]
#define VENDOR_ID 0x0fc5 // 請依照實際硬體的韌體 Vendor ID 作修改,不然會有問題
#define PRODUCT_ID 0x1223 // 請依照實際硬體的韌體 Products ID 作修改,不然會有問題
/* table of devices that work with this driver */
static struct usb_device_id id_table [] = {
{ USB_DEVICE(VENDOR_ID, PRODUCT_ID) },
{ },
};
MODULE_DEVICE_TABLE (usb, id_table); // 重要不要忘記 作 MODULE_DEVICE_TABLE
static struct usb_driver skel_driver = {
.name = "skeleton",
.probe = skel_probe,
.disconnect = skel_disconnect,
.fops = &skel_fops,
.minor = USB_SKEL_MINOR_BASE,
.id_table = skel_table,
};
static int __init usb_skel_init(void)
{
int result;
/* register this driver with the USB subsystem */
result = usb_register(&skel_driver);
if (result < 0) {
err("usb_register failed for the "__FILE__ "driver."
"Error number %d", result);
return -1;
}
return 0;
}
module_init(usb_skel_init);
[/php]
reference: here