Thread (5 messages) 5 messages, 3 authors, 2012-02-18

Question on registering driver fops

From: Rajat Sharma <hidden>
Date: 2012-02-15 05:01:51

Possibly related (same subject, not in this thread)

On Wed, Feb 15, 2012 at 10:15 AM, Ezequiel Garc?a [off-list ref]wrote:
El d?a 14 de febrero de 2012 19:42, Greg KH [off-list ref] escribi?:
quoted
On Tue, Feb 14, 2012 at 07:05:48PM -0300, Ezequiel Garc?a wrote:
quoted
I noticed that after registering a video driver with
"video_register_device" the "open" function gets called.
The registration is like:

        peasycap->video_device.fops = &v4l2_fops;
        peasycap->video_device.minor = -1;
        peasycap->video_device.release = (void *)(&videodev_release);

        video_set_drvdata(&(peasycap->video_device), (void *)peasycap);

First question: who calls it and why does it open the device?
Userspace probably.
I find hard that userspace is who opens the device in this particular case,
because I get the "open" call just by plugging in the usb, right after
usb_probe.
(unless there is a daemon, or udev opens the device for module
insertion or something).

I will investigate this further.
Although it doesn't easily click, but very simple. Implement open fop and
put following print in it:

printk("%s: My caller is %s\n", __func__, current->comm);

You will get to know the user space daemon name. I have seen a daemon on
some linux distributions, called 'hald' (Hardware Abstraction Layer Daemon)
doing these sort of activities when it detects hardware changes. Even in
case of new mount point, it stats every mounted filesystem.

-Rajat
Thanks,
Ezequiel.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120215/2071c50d/attachment-0001.html 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help