I'm running Ubuntu 14.04 LTS and I'm trying to write a basic usb driver. My init function is here:
Code:
static int __init usb_init(void)
{
int ret = -1;
printk(KERN_INFO "[*] Stick Driver constructor\n");
printk(KERN_INFO "Registering Driver with Kernel");
ret = usb_register(&usb_driver);
printk(KERN_INFO "Driver is registered!\n");
printk(KERN_INFO "Registration Complete");
return ret;
}
Now here is the output of dmesg when I do a sudo insmod
Code:
Apr 25 23:00:35 jamesPC kernel: [14279.134566][*] Stick Driver constructor
Apr 25 23:00:35 jamesPC kernel: [14279.134568] Registering Driver with Kernel
Apr 25 23:00:35 jamesPC kernel: [14279.134602] usbcore: registered new interface driver Stick_Driver
Apr 25 23:00:35 jamesPC kernel: [14279.134603] Driver is registered!
Can anyone help explain why it doesn't output the second printk?? I originally had only the second printk, but just for the heck of it decided to add the first one, and it printed, to my confusion. If I remove any USB device from my computer, it will then print out the second printk in dmesg, but only if I remove a usb device. I don't know what is causing that, or maybe is that normal?