View previous topic :: View next topic |
Author |
Message |
archieb7 n00b
Joined: 09 Jul 2007 Posts: 7
|
Posted: Fri Nov 02, 2007 2:15 am Post subject: basic c program implementation to get driver working |
|
|
Hello.
I'm having a problem starting a driver for a SpacePilot 3d motion controller.
According to the following link, this basic c program fixes the bug in other distros:
http://www.3dconnexion.com/forum/viewtopic.php?t=1039
Code: | #include <stdio>
#include <string>
#include <stdlib>
#include <utmpx>
int
main(int argc, char ** argv) {
if (argc != 2) {
fprintf(stderr, "Need a name to put in the structure\n");
exit(1);
}
struct utmpx u;
memset(&u, 0, sizeof(u));
u.ut_type = USER_PROCESS;
u.ut_pid = getpid();
strcpy(u.ut_id, ":0");
strcpy(u.ut_line, ":0");
strcpy(u.ut_user, argv[1]);
setutxent();
pututxline(&u);
endutxent();
}
|
I'm new to linux and not sure how to compile and run this properly.
I tried just:
where script3d.c is the source file
the output file is a.out and when I run this from the same directory it exits and prints "need a name to put in structure" so its not doing what i need it to do.
Any suggestions on how I can implement this so I can start my driver? Thanks for your help! |
|
Back to top |
|
|
Genone Retired Dev
Joined: 14 Mar 2003 Posts: 9501 Location: beyond the rim
|
Posted: Fri Nov 02, 2007 4:19 am Post subject: |
|
|
It seems that you have to call it with your username as first argument. |
|
Back to top |
|
|
archieb7 n00b
Joined: 09 Jul 2007 Posts: 7
|
Posted: Fri Nov 02, 2007 4:45 am Post subject: |
|
|
Hey thanks Genone! My device works now.
Wow, such a simple answer too. I just wasn't sure how to pass an argument to an executable in linux; I'm still really new to it.
works, thanks again! |
|
Back to top |
|
|
|