Question on registering driver fops
Bjørn Mork
bjorn at mork.no
Sat Feb 18 14:21:59 EST 2012
Ezequiel García <elezegarcia at gmail.com> writes:
> Another question: when does udev recognizes that this device was plugged?
> Probably somewhere inside video_register_device(), right?
Yes, if you look at the extremely long function
__video_register_device() in drivers/media/video/v4l2-dev, you'll find this:
/* Part 4: register the device with sysfs */
vdev->dev.class = &video_class;
vdev->dev.devt = MKDEV(VIDEO_MAJOR, vdev->minor);
if (vdev->parent)
vdev->dev.parent = vdev->parent;
dev_set_name(&vdev->dev, "%s%d", name_base, vdev->num);
ret = device_register(&vdev->dev);
The device_register() will do a
kobject_uevent(&dev->kobj, KOBJ_ADD);
among other things. That's what udev sees.
Bjørn
More information about the Kernelnewbies
mailing list