<br><br><div class="gmail_quote">On Wed, Feb 15, 2012 at 10:15 AM, Ezequiel García <span dir="ltr"><<a href="mailto:elezegarcia@gmail.com">elezegarcia@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
El día 14 de febrero de 2012 19:42, Greg KH <<a href="mailto:greg@kroah.com">greg@kroah.com</a>> escribió:<br>
<div class="im">> On Tue, Feb 14, 2012 at 07:05:48PM -0300, Ezequiel García wrote:<br>
</div><div class="im">>> I noticed that after registering a video driver with<br>
>> "video_register_device" the "open" function gets called.<br>
>> The registration is like:<br>
>><br>
>> peasycap->video_device.fops = &v4l2_fops;<br>
>> peasycap->video_device.minor = -1;<br>
>> peasycap->video_device.release = (void *)(&videodev_release);<br>
>><br>
>> video_set_drvdata(&(peasycap->video_device), (void *)peasycap);<br>
>><br>
>> First question: who calls it and why does it open the device?<br>
><br>
> Userspace probably.<br>
><br>
<br>
</div>I find hard that userspace is who opens the device in this particular case,<br>
because I get the "open" call just by plugging in the usb, right after<br>
usb_probe.<br>
(unless there is a daemon, or udev opens the device for module<br>
insertion or something).<br>
<br>
I will investigate this further.<br></blockquote><div><br>Although it doesn't easily click, but very simple. Implement open fop and put following print in it:<br><br>printk("%s: My caller is %s\n", __func__, current->comm);<br>
<br>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.<br>
<br>-Rajat <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thanks,<br>
Ezequiel.<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</div></div></blockquote></div><br>