Question on registering driver fops
From: bjorn@mork.no (Bjørn Mork)
Date: 2012-02-18 19:21:59
From: bjorn@mork.no (Bjørn Mork)
Date: 2012-02-18 19:21:59
Ezequiel Garc?a [off-list ref] 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