Results 1 to 7 of 7
Hi,
How we can call a c program from a driver? Can we use system() for this?
Thanks...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-18-2012 #1Just Joined!
- Join Date
- Nov 2011
- Posts
- 67
how to call a c pgm from driver
Hi,
How we can call a c program from a driver? Can we use system() for this?
Thanks
- 02-19-2012 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,163
From a driver? Not easily, since the driver is running in kernel-space and a program has to run in user-space. Please explain, in gory detail, what EXACTLY you are trying to accomplish?
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 02-21-2012 #3Just Joined!
- Join Date
- Nov 2011
- Posts
- 67
We have a gpio driver with interrupt handler .If some interrupt is coming it will go to interrupt handler , from that interrupt handler i want to call a C program which will take picture.
- 02-21-2012 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,163
Sorry, but I don't think you can do that. You need to signal a running user-space program that can do that for you. In any case, you NEVER want to do anything that takes more than microseconds in an interrupt handler. You set some flags, return from the handler (freeing the interrupt controller as a result), and then do stuff that is more time consuming. In any case, you still will not want to do this in the driver. So, have a daemon program running that the driver can signal. When the daemon gets the signal, it can then take the picture, and do whatever you need with it. In any case you absolutely CANNOT run executable programs from the kernel using system() or exec...() functions. Start reading up on kernel module development, because it is clear to me that you are still pretty clueless. Not to case aspersions on you or your development skills, but kernel development work is highly specialized, with a lot of rules that do not apply to normal software, and until you learn those rules, you are treading in dangerous waters!
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 02-21-2012 #5Just Joined!
- Join Date
- Nov 2011
- Posts
- 67
Thanks for your reply. How a driver can signal daemon program and call other c program? I am new to this field so dont have much idea.
- 02-21-2012 #6Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 10,163
Sorry, but I don't have time to give you kernel programming lessons. However, there are means for kernel modules to raise signals in user-space programs. You daemon process can have an appropriate signal handler that will intercept the raised signal, and it can then use a system() call to execute the appropriate program.
FWIW, I have recently (at the beginning of the year) started a new position as Senior Systems/Performance Engineer at Nokia, so most of my spare time is taken up with analyzing a few million lines of Java, Javascript, C++, and other code, along with designing new SNMP system/network management framework tools... Time is something that I have little of right now. They hired me because we are growing the division from 1-5M users now, to 50M in a year, and 100M in 2 years. I'm running as fast as I can...
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 02-21-2012 #7Just Joined!
- Join Date
- Nov 2011
- Posts
- 67
Its k ....Thanks....


Reply With Quote

