Wifi in a kernel PRX

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
danzel
Posts: 182
Joined: Fri Nov 04, 2005 11:03 pm

Wifi in a kernel PRX

Post by danzel »

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: Select all

	if &#40;pspSdkLoadInetModules&#40;&#41; < 0&#41; //Added to see if it would make wifi work in the child prx, it doesn't &#58;&#40;
	&#123;
		printf&#40;"Driver load error\n"&#41;; // this doesn't happen
		return 0;
	&#125;
	pspSdkInstallNoDeviceCheckPatch&#40;&#41;;
	pspSdkInstallNoPlainModuleCheckPatch&#40;&#41;;
	loadmodule&#40;"myprx",0,0&#41;;
	sceKernelStartModule&#40;....&#41;;
	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.
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: Select all

/usr/local/pspdev/psp/sdk/lib/libpspsdk.a&#40;loadmodule.o&#41;&#58; In function `pspSdkLoadStartModuleWithArgs'&#58;
/tmp/pspdev/pspsdk/src/sdk/loadmodule.c&#58;36&#58; 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.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

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 ;)
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

Last time i used wifi+kernel mode i had random problems that weren't there with user mode...
danzel
Posts: 182
Joined: Fri Nov 04, 2005 11:03 pm

Post by danzel »

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
Post Reply