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 

Adhoc wifi

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



Joined: 17 Jul 2007
Posts: 34
Location: California, USA

PostPosted: Sat Jan 12, 2008 7:27 am    Post subject: Adhoc wifi Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Sat Jan 12, 2008 7:47 am    Post subject: Reply with quote

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:
sceUtilityLoadNetModule(PSP_NET_MODULE_COMMON);

sceUtilityLoadNetModule(PSP_NET_MODULE_ADHOC);


Your app is still running in kernel mode, change the following line:

Code:
PSP_MAIN_THREAD_ATTR(0);


To:

Code:
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.
Back to top
View user's profile Send private message
uberjack



Joined: 17 Jul 2007
Posts: 34
Location: California, USA

PostPosted: Sat Jan 12, 2008 7:58 am    Post subject: Reply with quote

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)?

Quote:
Your app is still running in kernel mode, change the following line:


Thanks, will do
Back to top
View user's profile Send private message Visit poster's website
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Sat Jan 12, 2008 10:16 am    Post subject: Reply with quote

To load the requires modules on 1.5 you'll have to use kernel mode and the old-fashioned way, yes.
Back to top
View user's profile Send private message
zilt



Joined: 21 Feb 2006
Posts: 45
Location: Ontario, Canada

PostPosted: Sat Jan 12, 2008 12:15 pm    Post subject: Reply with quote

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

   // 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
Back to top
View user's profile Send private message Visit poster's website
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sat Jan 12, 2008 1:25 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
uberjack



Joined: 17 Jul 2007
Posts: 34
Location: California, USA

PostPosted: Sat Jan 12, 2008 7:51 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Sun Jan 13, 2008 3:49 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message AIM Address
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