LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   doubt in /sys (https://www.linuxquestions.org/questions/linux-newbie-8/doubt-in-sys-672662/)

shariefbe 09-27-2008 02:24 AM

doubt in /sys
 
i connect the webcam...it loads the zc0301 module...along with some other modules too...in that i found that the module v4l1_compat and v4l2_common intalled..and its in /sys/modules...actually what type of files will be in /sys/module directory?what is the use of that v4l1_compat and v4l2_common modules?can anyone help me please....

sundialsvcs 09-28-2008 09:43 PM

Everything in both /sys and /proc has the following very-important characteristic: it doesn't really "exist."

Everything that you "see" in either of these two "directories" is actually something that describes the operating-system itself. In other words, when you "ask for a list of the 'files' and 'directories' in" either of these two "locations," Linux actually generates what you see ... "on the fly!"

For instance: try dir /proc. In this "directory" you will find a slew of "sub-directories" whose names are numbers. (Say... /proc/3569.) "Inside of" each of these "sub-directories" you will find other "files" and "directories."

So far, so good?

Well... the truth is, /proc/3569 does not correspond to any physical resource: it corresponds to a currently-running process, #3569. The "files and subdirectories" within that "directory" correspond to various characteristics of that process. When process #3569 ceases to exist, so will the "directory" and all of its "contents."

This peculiar strategy enables commands like ps ("process list") to do their magic without being "magical." All they need to do is to look at the "contents of" /proc.

To make a long story short, /sys works in exactly the same way. This "directory" allows the Linux system to expose useful characteristics of itself in exactly the same way that /proc allows it to expose useful characteristics of the process-table.

This strategy is actually very, very clever. You see, "ordinary" programs already know how to deal with "files and directories." It doesn't take any "special voodoo" for them to do that. But if they wanted to take a peek at the process-table??? If they wanted to take a peek at the current characteristics of "Linux itself?" :eek: Major Voodoo!! Not! Instead of subjecting these programs to the 'necessity' of performing 'major voodoo,' Linux provides a mechanism that exposes the necesssary 'voodoo' information "as though it were 'just' an ordinary file."

And that, I assure you, is "real voodoo!"

shariefbe 09-29-2008 02:56 AM

what is meant by voodoo?sorry...i cant understand that voodoo...

jf.argentino 09-29-2008 05:24 AM

Quote:

what is meant by voodoo?sorry...i cant understand that voodoo...
Voodoo is a way to talk with spirits and to awake the deads... But for sundialsvcs, it's a way to explain that programs don't have to use tricks (complicated things, dark system calls...) to take some stat from the kernel.

To try to answer your first question:
V4L2 (read Video For Linux version 2) is a generic API for a user program to use video related devices, without knowing what device it really uses. In fact, if the system calls to get the last image grabbed by your web-cam depends on the web-cam models, you have to write as many program version that there's webcam you want your program to run with, and if a new webcam with a different driver come, you have to add it to your program. That where a framework like V4L2 is great, your program uses system call provided by the V4L2 user side, which won't change, and there's the driver part of V4L2 which deal with the hardware. So if your user program is V4L2 compliant, it will work with all hardware which have, and will have, a V4L2 driver!
You have the same principle in ALSA for sound devices, COMEDI for acquisition devices ....

v4l1_compat is just a layer for compatibility issue between V4L version 2 and 1.

shariefbe 09-30-2008 12:13 PM

ok...Thanks a lot


All times are GMT -5. The time now is 10:24 AM.