Adhoc wifi

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
uberjack
Posts: 34
Joined: Tue Jul 17, 2007 9:09 am
Location: California, USA
Contact:

Adhoc wifi

Post by uberjack »

Hi everyone,

I've been trying to get adhoc wifi to work on the PSP in user-mode, but haven't been successful.

A lot of the examples I find use PspPet's loadutil library to load and patch drivers in kernel mode, but it seems to me like the latest version of pspsdk no longer requires this (please correct me if I'm wrong), since the libraries and header declarations are already part of the SDK.

I wrote a simple program to simply initialize, then terminate an adhoc connection - the entire program runs in user mode - but I'm getting an error from sceNetInit, which is the first network-related function I call.

My question is, does an application need to be run in kernel mode for ad-hoc to work with the current version of the SDK? Can anyone provide a possible reason why my call to sceNetInit fails (and yes, I checked the wifi switch :))

Here's my PSP_MODULE_INFO declaration:

PSP_MODULE_INFO(PSP_APP_NAME, 0, 1, 1);
PSP_MAIN_THREAD_ATTR(0);

Any help is appreciated.

Thanks
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

Hi uberjack.

Adhoc in usermode is possible.

I commited a decent sized update to the adhoc stuff in the SDK last night, so check that out.

To load the required net and adhoc modules, simply call the functions from psputility_netmodules.h.

Code: Select all

sceUtilityLoadNetModule(PSP_NET_MODULE_COMMON);

sceUtilityLoadNetModule(PSP_NET_MODULE_ADHOC);
Your app is still running in kernel mode, change the following line:

Code: Select all

PSP_MAIN_THREAD_ATTR(0);
To:

Code: Select all

PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
The sceUtilityLoadNetModule function only works on firmware 2.0+.

I'll be commiting some more adhoc stuff in the near future as well as some samples.

Hope this helps.
User avatar
uberjack
Posts: 34
Joined: Tue Jul 17, 2007 9:09 am
Location: California, USA
Contact:

Post by uberjack »

Hi Insert_witty_name,

Thanks very much for the speedy reply. One of my units is actually at 1.50. Does this mean that I need to run in kernel mode for compatibility with both versions (and do things the old-fashioned way)?
Your app is still running in kernel mode, change the following line:
Thanks, will do
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

To load the requires modules on 1.5 you'll have to use kernel mode and the old-fashioned way, yes.
zilt
Posts: 45
Joined: Tue Feb 21, 2006 11:59 pm
Location: Ontario, Canada
Contact:

Post by zilt »

Here's a bit of code i use to load the network modules depending on firmware version:

Code: Select all

	// setup the net environment
	int ret;
#ifdef PSPFW3X
	printf("[main]: initing PSP 3.x network... \n");
	if( (ret = sceUtilityLoadNetModule(1)) ) /* common */
	{
		printf( "[main]: Unable to load 3.x net common modules: %x\n", ret );
	}
	if( (ret = sceUtilityLoadNetModule(3)) ) /* inet */
	{
		printf( "[main]: Unable to load 3.x net inet modules: %x\n", ret );
	}
#else
	printf("[main]: initing PSP 1.5 network... \n");
	if( (ret = pspSdkLoadInetModules()) )
	{
		printf( "[main]: Unable to load inet modules: %x\n", ret );
	}
#endif
"We are dreamers, shapers, singers, and makers. We study the mysteries of laser and circuit, crystal and scanner, holographic demons and invocations of equations. These are the tools we employ and we know... many things." -- Elric, B5
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

I really think people need to just let 1.5 go. It was nice for it's time, but 3.xx is here to stay. There's no reason to tie people down... let the PSP shine, and 3.xx is the way to do that.
User avatar
uberjack
Posts: 34
Joined: Tue Jul 17, 2007 9:09 am
Location: California, USA
Contact:

Post by uberjack »

While I don't disagree with you, J.F., I prefer to keep my older PSP at the earlier firmware for sentimental reasons :)

Plus, higher compatibility is always better, no?

Thanks again guys
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

uberjack wrote:While I don't disagree with you, J.F., I prefer to keep my older PSP at the earlier firmware for sentimental reasons :)

Plus, higher compatibility is always better, no?

Thanks again guys
But 1.5 won't be higher compatibility for much longer. As more slims come out, and as 3.71+ M33 gets more prevalent on phats, 3.xx homebrew becomes more predominant. Having to add the 1.5 addon to 3.71 M33 on a phat wastes precious flash space.
Post Reply