insertI have written a simple kernel program to detect USB.The desc.bDeviceClass returns __u16.So when desc.bDeviceClass ==0 a removable drive is detected.But the problem is that it always enters IF even when the drive is removed.Is there something wrong with the comparison?Code:#include <linux/kernel.h> #include <linux/module.h> #include <linux/usb.h> MODULE_LICENSE("GPL"); struct usb_device_descriptor desc; static int prog_init(void) { if(desc.bDeviceClass==0) { printk(KERN_ALERT "Detected"); // char manu=desc.iManufacturer; printk(KERN_DEBUG "Manufacturer:%d",desc.idVendor); printk(KERN_DEBUG "Product:%d",desc.idProduct); } else printk(KERN_ALERT "No removable storage found"); return 0; } static void prog_exit(void) { printk(KERN_ALERT "Program Terminated\n"); } module_init(prog_init); module_exit(prog_exit);