forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Wifi in a kernel PRX

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
danzel



Joined: 04 Nov 2005
Posts: 182

PostPosted: Thu Jul 20, 2006 11:33 pm    Post subject: Wifi in a kernel PRX Reply with quote

I'm having a go at making a kernel prx, build settings as follows:
PSP_MODULE_INFO("test",0x1000,1,1);
Makefile:
USE_KERNEL_LIBC = 1
USE_KERNEL_LIBS = 1

I'm trying to get wifi to work in this prx, but when I call pspSdkInetInit() I get the return value 8002013A, which according to a quick google is "Library is not linked yet"
I'm currently running this under a prx loader on 1.5 with psplink, the loader is basically:
Code:
   if (pspSdkLoadInetModules() < 0) //Added to see if it would make wifi work in the child prx, it doesn't :(
   {
      printf("Driver load error\n"); // this doesn't happen
      return 0;
   }
   pspSdkInstallNoDeviceCheckPatch();
   pspSdkInstallNoPlainModuleCheckPatch();
   loadmodule("myprx",0,0);
   sceKernelStartModule(....);
   return 0;


The prx starts a thread and that thread tries to use the inet functions pspSdkInetInit() and sceNetApctlConnect(1). The value 8002013A is returned each time.
Quote:
host0:/> Loading Module ...
: Error, could not initialise the network 8002013A
: sceNetApctlConnect returns 8002013A (want 0)

I've tryed to add the pspSdkLoadInetModules() function call into the prx, but I get the linker error:
Code:
/usr/local/pspdev/psp/sdk/lib/libpspsdk.a(loadmodule.o): In function `pspSdkLoadStartModuleWithArgs':
/tmp/pspdev/pspsdk/src/sdk/loadmodule.c:36: undefined reference to `snprintf'


TyRaNiD seemed to know something about this in his post over here: http://forums.ps2dev.org/viewtopic.php?p=33520#33520
Perhaps he could drop in and lend a hand :) please :)

I've thrown the code up here: http://localhost.geek.nz/crap/prxtest.tar.gz
Compile each dir, put out.elf and test.prx in the same dir and run out.elf through psplink.
Thanks for any help, I've spent all evening messing with various attempts to fix it.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Fri Jul 21, 2006 2:09 am    Post subject: Reply with quote

Well the kernel libc doesn't have an snprintf (naughty Sony) so there is no way of easily using it. Either link with newlib (and take the hit of syscalls instead of direct calls) or just steal the code from pspsdk to do the initialisation modify it :)

Anyway I assume you have a good reason these days to use kernel mode for something like this ;)
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Fri Jul 21, 2006 2:16 am    Post subject: Reply with quote

Last time i used wifi+kernel mode i had random problems that weren't there with user mode...
Back to top
View user's profile Send private message
danzel



Joined: 04 Nov 2005
Posts: 182

PostPosted: Sat Jul 22, 2006 10:30 pm    Post subject: Reply with quote

Well I got it to go, thanks for the warning moonlight, haven't ran into anything yet though, although I haven't done much!

All I've done is just implemented 'snprintf' in my code.
And by implement, I mean hack together using the smallest amount of code. ;)

The included example now loads up a UDP socket and prints what is sent to it, there is also an included client app for the pc to send "hello", just to show it works :)

http://localhost.geek.nz/crap/prxwifi.zip
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group