GP2X View Gp2x Telnet And Mnt Harddrive Help?


GP2X_Coder

Member
Joined
May 17, 2006
Messages
220
Age
51
Location
USA
Website
mysite.verizon.net
Ok, so here is what I have so far I can connect my gp2x to my computer with the usb cable using telnet with no problem I go into my gp2x and view all of its files in a window on my pc ( running windows xp ) which is great. I can swap files back and forth to the sd or nand.

This is what I need help with. I hear you can use the pc to view game output could someone please explain to me how to do this with an example please? also how can I read files straight from my pc to the gp2x do I have to mount it if I do how do I go about doing that?

Any help would be greatly appreciated.
 
GP2X_Coder said:
This is what I need help with. I hear you can use the pc to view game output could someone please explain to me how to do this with an example please?
Either this: http://www.gp32x.de/board/index.php?showtopic=24053 or this: http://wiki.gp2x.org/wiki/Serial_cable should do the trick. Mind you, I've never used either :)

You can also use a script file:

CODE
sync #all IO operations
#mount /mnt/sd -o remount,sync

#run app, redirect stdout/in
./app.gpe 1>stdout.txt 2>stderr.txt

unsync #(save battery and whatever)
#mount /mnt/sd -o remount,async

# return to the menu screen
cd /usr/gp2x
exec /usr/gp2x/gp2xmenu

which will also redirect output to the files stderr.txt and stdout.txt. It works great. Just rename the script file to something like "run.gpe" and edit the line

CODE
./app.gpe 1>stdout.txt 2>stderr.txt
to match your executable's name. Then run "run.gpe" instead of "app.gpe" (or whatever it is you want to run).
 
Last edited by a moderator:
Sebastian said:
GP2X_Coder said:
This is what I need help with. I hear you can use the pc to view game output could someone please explain to me how to do this with an example please?
Either this: http://www.gp32x.de/board/index.php?showtopic=24053 or this: http://wiki.gp2x.org/wiki/Serial_cable should do the trick. Mind you, I've never used either :)

You can also use a script file:

CODE
sync #all IO operations
#mount /mnt/sd -o remount,sync

#run app, redirect stdout/in
./app.gpe 1>stdout.txt 2>stderr.txt

unsync #(save battery and whatever)
#mount /mnt/sd -o remount,async

# return to the menu screen
cd /usr/gp2x
exec /usr/gp2x/gp2xmenu

which will also redirect output to the files stderr.txt and stdout.txt. It works great. Just rename the script file to something like "run.gpe" and edit the line

CODE
./app.gpe 1>stdout.txt 2>stderr.txt
to match your executable's name. Then run "run.gpe" instead of "app.gpe" (or whatever it is you want to run).


Thanks for the reply Sebastian but I just can't get it to work on windows xp. :(
 
Last edited by a moderator:
GP2X_Coder said:
Thanks for the reply Sebastian but I just can't get it to work on windows xp. :(
Oh, I assumed you wanted to see the console output... Example, in my code, I mostly use stuff like
CODE
fprintf(stderr, "v[0] %f\n", v[0]); // print value to stderr.txt

and then the program outputs to stderr.txt so I can debug my buggy code :)

I don't have any experience with the serial cable thingie.
 
Last edited by a moderator:
Sebastian said:
GP2X_Coder said:
Thanks for the reply Sebastian but I just can't get it to work on windows xp. :(
Oh, I assumed you wanted to see the console output... Example, in my code, I mostly use stuff like
CODE
fprintf(stderr, "v[0] %f\n", v[0]); // print value to stderr.txt

and then the program outputs to stderr.txt so I can debug my buggy code :)

I don't have any experience with the serial cable thingie.

The GP2X automatically outputs the stderr and stdout stream to the console, so yeah, if you telnet into your gp2x and want to see console output, just put it in something like this into your code:

CODE

fprintf(stderr, "There has been an error");



That goes for stdout too
 
Last edited by a moderator:
Ok I am sorry for being so stupid and not under standing this at all this is what I want to do I just have my Gp2x connected to my PC(Windows XP ) with a usb cable I can connect using telnet and I go to the run menu and I get this in a console window.

Linux 2.4.25 <gp2x> <ttyp0>

gp2x login: root

[root@gp2x root]$
[root@gp2x root]$

how do I get a console window to show the debug output wile the program is running so I can see what is causing bugs in my program? I ran the script listed above from both my gp2x and from the console window and all it does it run the program and I can't see debug output in the window. I feel so stupid but I just don't know what to do to get it to work :(

Squidge this link http://archive.gp2x.de/cgi-bin/cfiles.cgi?0,40,0,0,1 doesn't seem to work for me.
 
If you're actually writing out debug info with printf, then using 'cd /mnt/sd/path/to/app' followed by './appname.gpe' will run the app and dump any output to the console.
 
woogal said:
If you're actually writing out debug info with printf, then using 'cd /mnt/sd/path/to/app' followed by './appname.gpe' will run the app and dump any output to the console.
If it type that in my console window it will start the program on the gp2x with the background of the original gp2x menu flashing back and forth but still no output and I am using printf
 
Last edited by a moderator:
Try 'killall -9 gp2xmenu' to get rid of the menu (otherwise it's still running in the background), but even without that if you're using printf you should get some output.
 
woogal said:
Try 'killall -9 gp2xmenu' to get rid of the menu (otherwise it's still running in the background), but even without that if you're using printf you should get some output.
I ran killall gp2xmenu and that stopped the menu flick but still no text in my console window :( I even made a quick little program that did nothing but printf's and still nothing. I am at a loss. I was really hoping to get this to work.
 
Last edited by a moderator:
post a screenshot of your terminal window after you have attempted to run a program with console output

if the link doesn't work, goto archive.gp2x.de and type "samba" in the search box.
 
Squidge said:
post a screenshot of your terminal window after you have attempted to run a program with console output

if the link doesn't work, goto archive.gp2x.de and type "samba" in the search box.
This is my screen nothing else appears after I start the program

screen.jpg


This it the code for a quick test.

CODE

#include "SDL/SDL.h"
#include <unistd.h>

char *ExeDir = NULL;
int main( int argc, char* args[] )
{
printf( "Start" );
printf( "Hope to see something?" );
printf( "End" );

#ifdef GP2X

// Finished with program now return to the main
chdir( "/usr/gp2x" );
execl( "/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL );

#endif

return 0;
}



I don't know what I am doing wrong.
 
Last edited by a moderator:
GP2X_Coder said:
Squidge said:
You don't even get another [root@gp2x sd]$ ?
Nope just a blinking cursor until the program exits and then it says usb net 0 and that's it.


You won't get a prompt because,

QUOTE

chdir( "/usr/gp2x" );
execl( "/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL );



That's why it's better to do the return to menu in a separate script

It could be why you're not getting any output, like woogal said, a '\n' may help or you could call flush on stdout.

exec overwrites the current process so you probably lose any buffered output
 
Last edited by a moderator:
woogal said:
Stick \n (newline) on the end of your printf's 'printf("hello\n")' or use puts instead. That might do it.
Thanks alot everyone this works great I appreciate all of the help. Now if I can just get samba to work everything will be perfect.
 
Last edited by a moderator:
Hey guys, I've been searching the forums for information on how to get the gp2x to mount a folder on my pc and found this thread.
I have tried Squidge's suggestion but when I try to mount the folder using telnet I get this:

error.png


What am I doing wrong?


EDIT: Ok, now I've tried with the ip instead of the hostname as suggested on the wiki but now I get this:

QUOTE
108: session request to 10.1.0.1 failed (Called name not present)
108: session request to 10 failed (Called name not present)



EDIT 2: Hmm, seems to work despite these error messages, nevermind me.
 
Back
Top