LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   USB driver not registering the device (https://www.linuxquestions.org/questions/linux-newbie-8/usb-driver-not-registering-the-device-4175578327/)

jjd3592 04-25-2016 10:06 PM

USB driver not registering the device
 
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?

c0d3d 04-26-2016 07:34 AM

Have you checked the output of dmesg?

jjd3592 04-26-2016 10:05 AM

Sorry, I don't understand what you mean. I output dmesg in the post.


All times are GMT -5. The time now is 08:14 PM.