(The kobj is also added in this device_add() function by invoke kobject_add() function)
In user space, the udevd is listening the NETLINK_KOBJECT_EVENT to get the "uevent" event. Then it will find a match udev rule under the /etc/udev/rules.d/. It will make changes according to the rule(Like create the device file under /dev).
Every device when it is register, it will create a uevent file(by this way, can trigger a hotplug event), can write a "add" or "remove" command to add or remove a device.
When starting computer, kernel will register a lot of devices, but the udev(in user space) is not start. After it start, it will scan the sysfs, to get all the uevent file, and write "add" into it. In this way, the event been triggered.
----
I'm not so sure that I'm right. Please correct me if there is anything wrong. Thank you~
On Mon, Nov 22, 2010 at 3:22 AM, Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx> wrote:
On Mon, Nov 22, 2010 at 13:37, Bond <jamesbond.2k.g@xxxxxxxxx> wrote:AFAIK, when a device is hotplugged, it raised an interrupt...and
> Hi, in some of the books I am reading I find
> a text which mentions MODULE_DEVICE_TABLE () macro makes a user
> defined structure available in the module image so that the module
> can be loaded on demand if the card is hotplugged.
> I am not clear with how is this detection happening inside the kernel.
> How does the kernel detects the presence of a particular device?( I am
> not referring to the probe function defined in many drivers)
assuming a handler sits there (from device driver), then it is
captured and registered in a subsystem...that is kobject..I
think..which is related to sysfs.
Greg KH and others might know better....
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ
--
from Yuchen Liao via Gmail