Re: Linux USB Documentation

"Peter Teoh" <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
May be Srinivas is just learning the higher level codes which call his
USB driver - as I understand - and so the following is my attempt in
this aspect.   Please criticize if there is any error.

First, is the rest_init() function (don't ask who called this
function), which will setup a kernel thread calling kernel_init().

Then kernel_init()  (init/main.c)==> do_basic_setup():

static void __init do_basic_setup(void)
{
        /* drivers will send hotplug events */
        init_workqueues();
        usermodehelper_init();
        driver_init();
        init_irq_proc();
        do_initcalls();
}

And driver_init() is as follows - note the ordering of
devices-specific drivers, bus, and finally class drivers.

void __init driver_init(void)
{
        devices_init();
        buses_init();
        classes_init();
        firmware_init();
        hypervisor_init();
        platform_bus_init();
        system_bus_init();
        cpu_dev_init();
        memory_dev_init();
        attribute_container_init();
}

And do_initcalls() (a summary article is here:
http://lwn.net/Articles/141730/) will go through all the different
subsys_initcall(), including one of which is subsys_init(usb_init) ==>
calling usb_init() in usb/core/usb.c, and this function will execute
the following list of function in sequence (the ordering of the
function calls is what u are looking for right, I supposed?):

	retval = ksuspend_usb_init();
	retval = bus_register(&usb_bus_type);
	retval = usb_host_init();
	retval = usb_major_init();
	retval = usb_register(&usbfs_driver);
	retval = usb_devio_init();
	retval = usbfs_init();
	retval = usb_hub_init();
	retval = usb_register_device_driver(&usb_generic_driver, THIS_MODULE);

And from these high level function I think it is easier to proceed
ahead with the source code analysis now :-).

On Nov 17, 2007 12:17 AM, Alan Stern <[email protected]> wrote:
> On Fri, 16 Nov 2007, Srinivas G. wrote:
>
> > Dear All,
> >
> > I am a Linux device driver developer. I have developed the USB client
> > driver in the Linux environment. For this, I have followed the Rubini's
> > 3rd Edition LLD book. Now I want to know the interaction among the Linux
> > OS, USB Stack and HCD (Host Controller Driver). I mean, what are the
> > modules exists in the stack and how they interacts with the OS as well
> > as HCD? Suppose, how the HCD driver intimates the stack about when a new
> > device attached to the host controller? I think, it is through some
> > event mechanism, but I need code flow.
>
> > I have gone through the following links.
> > http://www.linux-usb.org
> > http://www.linux-usb.org/USB-guide/book1.html
> > http://it.linux-usb.org/FAQ.html
> > http://tldp.org/
> > http://www.tux.org/lkml/index.html
> > http://www.linux-usb.org/usb2.html
> >
> > I did not get the information that I need (that is flow among OS, Stack
> > and HCD). All these links have old information and I am looking into the
> > latest kernel version 2.6.22.
> >
> > So I would be happy if you could provide me some pointers (links) or
> > some good explanation on it.
>
> There is no detailed documentation; there is only the source code.
>
> If you have some specific questions, you can post them to the mailing
> list.
>
> Alan Stern
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> [email protected]
> To unsubscribe, use the last form field at:
> https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
>



-- 
Peter Teoh
HP: 96809281

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.