Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-12-2010, 01:46 AM   #1
LQ Newbie
Registered: Dec 2009
Posts: 13

Rep: Reputation: 0
Question 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);
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???
Old 01-12-2010, 05:19 AM   #2
LQ Newbie
Registered: Dec 2009
Posts: 13

Original Poster
Rep: Reputation: 0
Got ...

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

BTW thannks...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
"substraction" and "division" function in OpenOffice Calc mac1234mac Linux - Software 7 12-03-2009 06:36 AM
Replacing "function(x)" with "x" using sed/awk/smth Griffon26 Linux - General 3 11-22-2006 10:47 AM
When "function pointer" meets "template"... I can't get rid of this compiling er cyu021 Linux - Software 3 12-17-2004 07:52 PM
"Function not implemented" error in call to "sem_open()" Krishnendu8 Linux - Newbie 1 06-07-2003 02:52 AM
"Function not imlemented" error in call to "sem_open()" Krishnendu8 Linux - Networking 0 06-07-2003 02:19 AM > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration