LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problem with "call_usermodehelper" function (https://www.linuxquestions.org/questions/linux-newbie-8/problem-with-call_usermodehelper-function-781629/)

er.saurabh 01-12-2010 01:46 AM

problem with "call_usermodehelper" function
 
Dear Experts,

I want to awake my program located at /folder/exe_prog from
one of the kernel module usbcore.ko (hub.c), on usb insertion event..

I have chnaged source file of hub.c (where it detects the usb event
plug-in new device)..

at there I made call to my prog "exe_prog" using
call_usermodehelper , as below...


/*-------- hub.c codes -----------------------*/

// my code inside hub.c
int ret = 0;
char *argv[] = {"/folder/exe_prog", "Hello1", "Hello2",NULL };
// two dummy args...
char *envp[] = {"HOME=/", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };

ret = call_usermodehelper("/folder/exe_prog", argv, envp, 1);
if (ret != 0)
printk("error in call to usermodehelper: %i\n", ret);
else
printk("everything seems all right\n");

// end - my code inside hub.c





program body of exe_prog is as below

int main( int argc, char ** argv)
{
system("mkdir /home/tempdir");
}


When see the syslogs I can see that the function call to call_usermodehelper
returns 0. But it does not execute exe_prog at all.

When i manually run the exe_prog is generates directory in
the directory as it should do, but some how it is not getting
run from module.

What I expected to do is, when i insert USB device , then
my code (inside the hub.c) should run my prog exe_prog and create
a directory there.

Am I missing something???

er.saurabh 01-12-2010 05:19 AM

Got ...

not was any issue...worked as it is.. (stupid spelling mistake)
was there in my org code...

BTW thannks...


All times are GMT -5. The time now is 12:45 AM.