Posts

Showing posts from June, 2013

simple usb driver in linux

#include<linux/module.h> #include<linux/init.h> #include<linux/usb.h> MODULE_LICENSE("GPL"); /* When the device is inserted into the USB bus and the vendor id and product id matches with the driver registered in the core,the probe function is called.The usb_device structure,interface number and interface id are passed to the function */ static int toshiba_probe(struct usb_interface *interface,const struct usb_device_id *id) { printk("\n In probe function"); return 0; } /* This function is called whenever the device is removed from the USB device */ static void toshiba_disconnect(struct usb_interface *interface) { printk("\n In disconnect function"); } /* struct usb_device_id  structure provides a list of different types of USB devices that the driver supports */  static const struct usb_device_id usb_table[] = { { USB_DEVICE(0x13fe,0x1d00) }, { }, /*Terminating entry*/ }; /* To enable the linux hotplu