On Fri, Apr 20, 2012 at 4:04 PM, manty kuma <mantykuma@gmail.com> wrote:
Hi Philipp,
The flow you mentioned is something which I was not aware of. I would like to see it happening in code.
My Queries are as follows:
1) " The kernel then creates an uevent and notifies the userspace part of udev (udevd) through a netlink socket. " - What are the corresponding files that i need to check? If the question is too abstract, kindly explain me with respect to any sample Bus.
The article at http://www.linuxjournal.com/article/8093 explains the initialization mechanism for USB. I don't have any code experience on USB hubs but by following the functions mentioned in the article (expecially the khubd kthread) you can see that the interrupt I mentioned is handled by the USB subsystem. Next, the uevent is created. The generic(?) implementation of this can be found at http://lxr.free-electrons.com/source/drivers/usb/core/driver.c#L722, where you can see that the uevent contains the necessary data for creating a udev entry. By sending the uevent we're crossing the kernel/userspace boundary and you have to take a look at the udev and udevd implementation for more information.
2) "The uevent is received by udevd and now udev can check for rules to add the device node to /dev" - Again the same thing. I would like to see it inside the code. Please help me in looking at the real code.
If a `man udev` does not answer your questions, you should take a look at the source code at http://git.kernel.org/?p=linux/hotplug/udev.git;a=summary. Again, please correct me if I'm wrong :) Hope this helps, Philipp