Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to port the webcam composite gadget from kernel 2.6.37 to 2.6.32. I don't have a choice on this since I depend on other drivers and a SDK which only compile for this version.

My train of thought was to mimic the ethernet gadget functionality with some minor changes and get it working fast, at least loading properly, then spend time working on the video streaming capabilities.

I ran into a brick wall pretty fast, because my new driver cannot be insmod, because -1 Device of resource busy.

I tried to dig in deeper with printk and figure out what was going on.

Main initialization seems to go as follow

module_init(webcam_init)
webcam_init()
usb_composite_register(&webcam_driver)
usb_gadget_register_driver(&composite_driver)

Those functions are defined as follow :

static struct usb_composite_driver webcam_driver = {
    .name       = "g_webcam",
    .dev        = &webcam_device_descriptor,
    .strings    = webcam_device_strings,
    .bind           = webcam_bind,
    .unbind     = webcam_unbind,
};

static int __init
webcam_init(void)
{
    return usb_composite_register(&webcam_driver);
}

int __init usb_composite_register(struct usb_composite_driver *driver)
{
    if (!driver || !driver->dev || !driver->bind || composite)
        return -EINVAL;

    if (!driver->name)
        driver->name = "composite";
    composite_driver.function =  (char *) driver->name;
    composite_driver.driver.name = driver->name;
    composite = driver;

    return usb_gadget_register_driver(&composite_driver);
}

usb_gadget_register_driver man page shows this

Call this in your gadget driver's module initialization function, to tell the underlying usb controller driver about your driver. The driver's bind function will be called to bind it to a gadget before this registration call returns. It's expected that the bind functions will be in init sections. This function must be called in a context that can sleep.

I would expect usb_gadget_register_driver to be mapped to either composite_bind of webcam_bind, both of which are defined. Unfortunately printks in either function never show up in dmesg so I would assume I am missing something here.

usb_gadget_register_driver does show up in g_webcam.mod.c which tells me that it is mapped somewhere, I just can't get where that place is!

share|improve this question
    
Device or Resource Busy implies that something ELSE has grabbed the device or resource (sic!) needed to allow your module to be installed. Have you researched what is grabbing that before you can load your module? That'd be where I'd start. –  lornix Jul 13 '12 at 3:20
    
Yes, my searches led to that. It is the other gadget, g_ether which provides ethernet capabilities which collides. I don't know why or what collides –  Eric Jul 13 '12 at 3:38
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.