I'm having difficulty getting adhoc code running on firmware 3.60. The entire process consists of initializing adhoc, setting up matching, then shutting down.
The code works on fw 1.50, but it hangs on 3.60 at the very end - when I call sceNetTerm.
Does anyone have any suggestions on what may be causing the issue? The drivers load fine; I'm running in user mode on 3.60.
Initialization code:
Code: Select all
struct productStruct product;
strcpy(product.product, "ULUS99999");
product.unknown = 0;
int _matching_id = 0;
unsigned int err;
err = sceNetInit(0x20000, 0x20, 0x1000, 0x20, 0x1000);
if (err != 0) { return err; }
_net_init = 1;
err = sceNetAdhocInit();
if (err != 0) { return err; }
_net_adhoc_init = 1;
err = sceNetAdhocctlInit(0x2000, 0x20, &product);
if (err != 0) { return err; }
_net_adhoc_ctl_init = 1;
err = sceNetAdhocctlConnect((void*)"");
if (err != 0) { return err; }
_net_adhoc_ctl_connect = 1;
int state, last_state = -1;
for (;;)
{
err = sceNetAdhocctlGetState(&state);
if (state > last_state) last_state = state;
if (state == 1) break; /* connected */
/* wait a little before polling again */
sceKernelDelayThread(50 * 1000); // 50ms
}
char mac[6];
sceWlanGetEtherAddr((unsigned char*)mac);
_pdp_id = sceNetAdhocPdpCreate((unsigned char*)mac,
0x309, // 0x309 in lumines
0x400, // 0x400 in lumines
0); // 0 in lumines
if (_pdp_id <= 0) { return _pdp_id; }
_net_adhoc_pdp_create = 1;
err = sceNetAdhocMatchingInit(0x20000);
if (err != 0) { return err; }
_net_adhoc_matching_init = 1;
_matching_id = sceNetAdhocMatchingCreate( 3,
0xa,
0x22b,
0x800,
0x2dc6c0,
0x5b8d80,
3,
0x7a120,
matchingCallback);
if (_matching_id < 0) { return _matching_id; }
_net_adhoc_matching_create = 1;
err = sceNetAdhocMatchingStart(_matching_id, // 1 in lumines (presuming what is returned from create)
0x10, // 0x10
0x2000, // 0x2000
0x10, // 0x10
0x2000, // 0x2000
0,
NULL);
if (err != 0) {return err; }
_net_adhoc_matching_start = 1;
return 0;
Code: Select all
unsigned int err;
if (_net_adhoc_ctl_connect)
{
err = sceNetAdhocctlDisconnect();
_net_adhoc_ctl_connect = 0;
}
if (_net_adhoc_pdp_create)
{
err = sceNetAdhocPdpDelete(_pdp_id, 0);
_net_adhoc_pdp_create = 0;
}
if (_net_adhoc_matching_start)
{
err = sceNetAdhocMatchingStop(_matching_id);
_net_adhoc_matching_start = 0;
}
if (_net_adhoc_matching_create)
{
err = sceNetAdhocMatchingDelete(_matching_id);
_net_adhoc_matching_create = 0;
}
if (_net_adhoc_matching_init)
{
err = sceNetAdhocMatchingTerm();
_net_adhoc_matching_init = 0;
}
if (_net_adhoc_ctl_init)
{
err = sceNetAdhocctlTerm();
_net_adhoc_ctl_init = 0;
}
if (_net_adhoc_init)
{
err = sceNetAdhocTerm();
_net_adhoc_init = 0;
}
if (_net_init)
{
err = sceNetTerm(); // hangs here
_net_init = 0;
}
return 0;
If it helps, here's output from a bunch of trace fprintf statements:
starting... sceNetInit... OK
sceNetAdhocInit... OK
sceNetAdhocctlInit... OK
sceNetAdhocctlConnect... OK
sceNetAdhocctlGetState... OK
sceWlanGetEtherAddr... done
sceNetAdhocPdpCreate... OK: 1
sceNetAdhocMatchingInit... OK
sceNetAdhocMatchingCreate... OK: 1
sceNetAdhocMatchingStart... OK
sceNetAdhocctlDisconnect... OK
sceNetAdhocPdpDelete... OK
sceNetAdhocMatchingStop... OK
sceNetAdhocMatchingDelete... OK
sceNetAdhocMatchingTerm... OK
sceNetAdhocctlTerm... OK
sceNetAdhocTerm... OK
sceNetTerm... (never finishes)
Thanks for any help