Troubles in WLAN routines

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

Moderators: cheriff, TyRaNiD

Post Reply
pegasus2000
Posts: 160
Joined: Wed Jul 12, 2006 7:09 am

Troubles in WLAN routines

Post by pegasus2000 »

I have tried to run a simple routine to connect PSP with an access point
(My PC has a LAN with static IP, the PSP has static IP, and test
integrated in firmware works perfectly).

Code: Select all

int connect_to_apctl(int config)
{
	int err;
	int stateLast = -1;

	/* Connect using the first profile */
	err = sceNetApctlConnect(config);
	if (err != 0)
	{
		printf(MODULE_NAME ": sceNetApctlConnect returns %08X\n", err);
		return 0;
	}

	printf(MODULE_NAME ": Connecting...\n");
	while (1)
	{
		int state;
		err = sceNetApctlGetState(&state);
		if (err != 0)
		{
			printf(MODULE_NAME ": sceNetApctlGetState returns $%x\n", err);
			break;
		}
		if (state > stateLast)
		{
			printf("  connection state %d of 4\n", state);
			stateLast = state;
		}
		if (state == 4)
			break;  // connected with static IP

		// wait a little before polling again
		sceKernelDelayThread(50*1000); // 50ms
	}
	printf(MODULE_NAME ": Connected!\n");

	if(err != 0)
	{
		return 0;
	}

	return 1;
}
The trouble is that the state returned by sceNetApctlGetState remains
always to zero and it doesn't change to 4. So the loop continues
indefinitely.

Why ? Do you have any ideas about it ?
guyver2
Posts: 5
Joined: Tue Jul 10, 2007 6:43 am
Contact:

Post by guyver2 »

I'm sorry but I can't answer your question, I'm using exactly the same code and it works.

Just one question:
I use the sample found in the pspsdk and it works fine in folder GAME150 but I recieve an error (80020148) when I put the Homebrew in the folder GAME340.

What can I do to make it work in 3.40 kernel ? I would like to use wlan AND chotto cam in the same HB but the chotto don't work in 1.50 kernel...


Thank you and sorry for my english.
Psp prog
Insert_witty_name
Posts: 376
Joined: Wed May 10, 2006 11:31 pm

Post by Insert_witty_name »

Build the sample for the 3.xx kernel by compiling it as a PRX and pack that into the eboot (add BUILD_PRX=1 to the Makefile).

Use the sceUtilityLoadNetModule() function to load the needed modules, instead of pspSdkLoadInetModules().

Details of what modules need loading can be found in psputility_netmodules.h
Xfacter
Posts: 9
Joined: Wed Feb 28, 2007 10:13 am

Post by Xfacter »

I was having the same problem. I put pspSdkInetInit in my user thread (instead of the kernel thread) and it worked.
guyver2
Posts: 5
Joined: Tue Jul 10, 2007 6:43 am
Contact:

Post by guyver2 »

thank you, I'll try that
Psp prog
Post Reply