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 

WLAN Support in PSPSDK

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


Joined: 17 Jan 2004
Posts: 362
Location: Melbourne, Australia

PostPosted: Fri Oct 21, 2005 1:45 pm    Post subject: WLAN Support in PSPSDK Reply with quote

It seems getting WLAN support into PSPSDK continues to be a problem. I know there are issues with loading modules, however, the problems and solutions seem to be scattered through out the forums.

So, what are the issues, what are the possible solutions, and what do we do to get WLAN support finished and a new release of PSPSDK out the door?

These threads seem to have some details. Where is the other information?


wifi and user mode.
http://forums.ps2dev.org/viewtopic.php?t=3753

Wifi MultiTest .02 - updated WiFi sample code
http://forums.ps2dev.org/viewtopic.php?t=2543

Some sceNet / sceHttpInit usage questions
http://forums.ps2dev.org/viewtopic.php?t=2211

David. aka Oobles.
http://www.livemedia.com.au/Blog
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Fri Oct 21, 2005 3:57 pm    Post subject: Reply with quote

I am back and I've started working a new source and binary release of PSPSDK. I'm working through a TODO list which includes a native Win32 installer (ala devkitpro), an updated toolchain (including VFPU support that was never finished), and misc. other fixes.

Network support would be nice, but getting it into PSPSDK in a portable manner is a bit complicated.
Back to top
View user's profile Send private message
Oobles
Site Admin


Joined: 17 Jan 2004
Posts: 362
Location: Melbourne, Australia

PostPosted: Fri Oct 21, 2005 4:26 pm    Post subject: Reply with quote

mrbrown, good to see you back!

Can you explain what the issues are for network support? What are the current solutions etc? It would be nice to have this in one spot where people can get an understanding of why it isn't included.

David. aka Oobles.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sat Oct 22, 2005 1:44 am    Post subject: Reply with quote

I've seen on a todo list of John_K in the wiki that DHCP support is missing, which would be nice to have, perhaps with the standard menu for selecting a connection, like in UMD games.

BTW: the Wiki was down 2 days ago as I checked it and it is down today again (don't know if it was up in between).
Back to top
View user's profile Send private message
PspPet



Joined: 30 Mar 2005
Posts: 210

PostPosted: Sat Oct 22, 2005 5:15 am    Post subject: Reply with quote

IMHO, there are four categories of work to be done:

#1: integration into the SDK, startup drivers and library entries
There is a technical problem in the way the drivers must be loaded. The current SDK lets you decide between a USER or KERNEL thread (do-it-yourself if you want both)
Assuming you want to load the sceNet drivers from flash0, there are tricks needed (kernel thread, kernel memory module flag)
Also there is some patch trickery for the way dynamically loaded libraries are loaded [all done in loadutil.c in my sample]

#2: UI code
WiFi apps aren't simple 'printf' like apps - they typically require a user interface - to let the user select the connection, and other options
My WiFi .02 sample lets you pick from a list and draw stuff on the screen, but since there are no universal standards in this area it does it it's own way [not the same as the PSP connection picker, or the same as other apps do their drawing]

#3: compatibility with more common Berekely sockets implementations
The sceNetInet are *like* other implementations - but not exactly.
Timeouts are perhaps the biggest compatibility problems.
Working around these can be a pain.
If someone want 99% compatibility with a standard socket implementation (eg: WinSock or common Unix implementations), there would be a lot of patching needed (and disassembling of the existing implementation to find the quirks)

#4: specific features like DHCP or WPA
These are mostly separate from the SDK integration issues.
[ie. if you can get them to work in your app based off the WiFi .02 sample, they should work everywhere]
FWIW: I've given up looking at the DHCP problem. There is something strange going on in the bowels of the system in the DHCP response thread.

---
NOTE: issues #1 and #2 are SDK philosophy and packaging issues. The existing WiFi sample *does* use the PSPSDK, so including it as a very big sample would satisfy these issues. However, it doesn't pass the test of being a small sample -- see the rules: http://forums.ps2dev.org/viewtopic.php?t=2395
The goal of small samples is a good one IMHO - albeit an artificial one. Issues #3 and #4 are true technical problems that need a new solution (or just live with it...)

Or put another way:
IMHO: it "would be nice" to see this integrated into the PSPSDK and made more compatible - but if you want a WiFi program now, it isn't that hard (ie. start with the WiFi .02 sample). SDK integration is an opportunity of cleaning things up. Waiting for SDK integration shouldn't be an excuse.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
florinsasu



Joined: 15 Dec 2004
Posts: 47

PostPosted: Mon Oct 24, 2005 7:01 am    Post subject: Reply with quote

the problem with loading network modules is that they are running in user mode. kernel application cannot link to user-mode modules afaik. if our app is running in user-mode it cannot load the modules from flash or ms.

so there are 2 solutions:
1. another kernel mode patch added to pspsdk to allow a kernel module to link with user libs
2. have a kernel-mode loader (that loads high!) that does all the kernel mode "dirty tricks", ie. apply the currently available patches
and then calls sceKernelLoadModule with the actual user-mode net application

Note: the load high can be eliminated if the "loader" is a prx and not a pfx
Back to top
View user's profile Send private message
PspPet



Joined: 30 Mar 2005
Posts: 210

PostPosted: Mon Oct 24, 2005 12:36 pm    Post subject: DHCP working Reply with quote

UPDATE: thanks to 'benji' who discovered a combination that does work for DHCP !
The drivers must be loaded in kernel mode thread (with kernel memory access) and everything else, including nlhInit, sceNetApctlConnect and subsequent socket calls should be called from a user mode thread. Don't mix any calls between user and kernel mode and DHCP works great.
Will update my WiFi sample soon - but if anyone is working on a lower-level SDK implementation, the DHCP support should fall out. Be sure to force everything to happen in a User mode thread, except driver/library load/start which must be done in created Kernel mode thread (not the init()/static constructor startup code)

---
'florinsasu' wrote:
> so there are 2 solutions:
> 1. another kernel mode patch added to pspsdk...
> 2. have a kernel-mode loader (that loads high!) that does all the kernel mode "dirty tricks"...
Or 3. do the "dirty tricks" in a PSPSDK support function (like my loadutil.c).

Someone needs to decide how they want this done officially in the PSPSDK. I vote for #3 since that's how WiFi apps are done today. IMHO the PSPSDK should be an "SDK", not a system-patch, bag-of-loader-tricks - but that's just my opinion.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Tue Oct 25, 2005 2:21 am    Post subject: Re: DHCP working Reply with quote

PspPet wrote:
'florinsasu' wrote:
> so there are 2 solutions:
> 1. another kernel mode patch added to pspsdk...
> 2. have a kernel-mode loader (that loads high!) that does all the kernel mode "dirty tricks"...
Or 3. do the "dirty tricks" in a PSPSDK support function (like my loadutil.c).

Someone needs to decide how they want this done officially in the PSPSDK. I vote for #3 since that's how WiFi apps are done today. IMHO the PSPSDK should be an "SDK", not a system-patch, bag-of-loader-tricks - but that's just my opinion.

That's why we have libpspsdk.a :).

I'll start working on adding networking support to PSPSDK soon...
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Tue Oct 25, 2005 2:23 am    Post subject: Reply with quote

Via option #3.
Back to top
View user's profile Send private message
raf



Joined: 13 Oct 2005
Posts: 57

PostPosted: Tue Oct 25, 2005 5:51 pm    Post subject: Re: DHCP working Reply with quote

PspPet wrote:
UPDATE: thanks to 'benji' who discovered a combination that does work for DHCP !
The drivers must be loaded in kernel mode thread (with kernel memory access) and everything else, including nlhInit, sceNetApctlConnect and subsequent socket calls should be called from a user mode thread. Don't mix any calls between user and kernel mode and DHCP works great.
Will update my WiFi sample soon - but if anyone is working on a lower-level SDK implementation, the DHCP support should fall out. Be sure to force everything to happen in a User mode thread, except driver/library load/start which must be done in created Kernel mode thread (not the init()/static constructor startup code)


Wow!! It really does work!! I just got PSPRadio reworked following your note, and DHCP is working now!

Thanks!,

Raf.
Back to top
View user's profile Send private message
Arwin



Joined: 12 Jul 2005
Posts: 426

PostPosted: Tue Oct 25, 2005 7:35 pm    Post subject: Reply with quote

Awesome news, that! Time for me to buy an access point.
Back to top
View user's profile Send private message
sherpya



Joined: 03 Oct 2005
Posts: 61

PostPosted: Wed Oct 26, 2005 9:13 pm    Post subject: Re: DHCP working Reply with quote

PspPet wrote:
UPDATE: thanks to 'benji' who discovered a combination that does work for DHCP !
The drivers must be loaded in kernel mode thread (with kernel memory access) and everything else, including nlhInit, sceNetApctlConnect and subsequent socket calls should be called from a user mode thread. Don't mix any calls between user and kernel mode and DHCP works great.
Will update my WiFi sample soon - but if anyone is working on a lower-level SDK implementation, the DHCP support should fall out. Be sure to force everything to happen in a User mode thread, except driver/library load/start which must be done in created Kernel mode thread (not the init()/static constructor startup code)

---
'florinsasu' wrote:
> so there are 2 solutions:
> 1. another kernel mode patch added to pspsdk...
> 2. have a kernel-mode loader (that loads high!) that does all the kernel mode "dirty tricks"...
Or 3. do the "dirty tricks" in a PSPSDK support function (like my loadutil.c).

Someone needs to decide how they want this done officially in the PSPSDK. I vote for #3 since that's how WiFi apps are done today. IMHO the PSPSDK should be an "SDK", not a system-patch, bag-of-loader-tricks - but that's just my opinion.


why not like pspaudio, a layer between user code and net code, like pspNetInit() that does kernel stuff?
Back to top
View user's profile Send private message
danzel



Joined: 04 Nov 2005
Posts: 182

PostPosted: Tue Nov 08, 2005 7:36 pm    Post subject: Reply with quote

Heres two of the return values from sceNetInetGetErrno() I've got after calling sceNetInetConnect(...)
Found with trial and error (mostly error :))

0x74: Connection Timed out
0x6f: Connection Refused

Danzel.
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed Nov 09, 2005 12:28 am    Post subject: Reply with quote

danzel wrote:
0x74: Connection Timed out
0x6f: Connection Refused

Those are ETIMEDOUT and ECONNREFUSED in sys/errno.h.
Back to top
View user's profile Send private message
danzel



Joined: 04 Nov 2005
Posts: 182

PostPosted: Wed Nov 09, 2005 10:54 am    Post subject: Reply with quote

Doh, of course.

Has anyone figured out the DNS Resolving stuff yet?
I see the stubs in stubs.s but theres no headers to go with them, and my few hacky tests havent come up with anything.

Danzel.
Back to top
View user's profile Send private message
raf



Joined: 13 Oct 2005
Posts: 57

PostPosted: Sat Nov 12, 2005 5:42 am    Post subject: Reply with quote

danzel wrote:
Doh, of course.

Has anyone figured out the DNS Resolving stuff yet?
I see the stubs in stubs.s but theres no headers to go with them, and my few hacky tests havent come up with anything.

Danzel.


I've been using the resolver for a while with great success in PSPRadio. Have a look the code if interested.

Raf.
Back to top
View user's profile Send private message
danzel



Joined: 04 Nov 2005
Posts: 182

PostPosted: Sat Nov 12, 2005 8:02 pm    Post subject: Reply with quote

Awesome, thanks man :)

Danzel.
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