On Thu, 26 Feb 2004, DeLeTe wrote:
>############################################################################
>#define MODULE
>#define __KERNEL__
>#include <linux/module.h>
>#include <linux/kernel.h>
>#include <linux/usb.h>
>
>#define USB_SKEL_VENDOR_ID 0x045e
>#define USB_SKEL_PRODUCT_ID 0x0039
>
>MODULE_LICENSE("GPL");
>
>
>static struct usb_device_id id_table [] = {
> { USB_DEVICE(USB_SKEL_VENDOR_ID, USB_SKEL_PRODUCT_ID) },
> { } /* Terminating entry */
>};
/* Here you probable should have: */
MODULE_DEVICE_TABLE(usb, id_table);
/* Although I'm not sure what it does. */
>void *probe(struct usb_device *dev,unsigned int interface,
> const struct usb_device_id *id_table)
>{
> printk(""");
/* I suppose this should be: */
printk("YEAH !! driver seem to be [OK] !!!!!!\n");
> MOD_INC_USE_COUNT;
> return 0;
>}
>
>static void deconnexion(struct usb_device *usbdev,void *drv_context)
>{
> printk("function for deconnexion !!!\n");
> MOD_DEC_USE_COUNT;
>}
>
>static struct usb_driver test = {
> name: "Usb test",
/* Here should be: */
id_table: id_table,
/* Because when you call usb_register(&test),
* it will look for the id_table pointer which
* contains the table of supported vendorid/productid
* usb devices. If a plugged device doesn't match any
* of the given ids, the probe() function is never called.
*/
> probe: probe,
> disconnect: deconnexion
>};
>
>int
>init_module(void)
>{
> printk("Starting test module !!!\n");
> usb_register(&test);
>}
>
>void
>cleanup_module(void)
>{
> printk("End of this module ;)\n");
> usb_deregister(&test);
>}
>############################
>
>That's my simple code with sould detect plug/deplug usb device but that is
>not ok :(
>I never see "YEAH !! driver seem to be [OK] !!!!!!\n"
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel