Wifi_DisconnectAP() doesn't seem to work

Post Reply
JanMulder
Posts: 15
Joined: Wed Jan 26, 2011 2:52 pm

Wifi_DisconnectAP() doesn't seem to work

Post by JanMulder » Fri Mar 25, 2011 9:53 pm

After I call Wifi_DisconnectAP(); Wifi_AssocStatus() doesn't become ASSOCSTATUS_DISCONNECTED or ASSOCSTATUS_SEARCHING. So it basically doesn't work... What can I do to make it work?
Thanks in advance!

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: Wifi_DisconnectAP() doesn't seem to work

Post by elhobbs » Fri Mar 25, 2011 11:54 pm

You could look at the connects on the AP if you have access

JanMulder
Posts: 15
Joined: Wed Jan 26, 2011 2:52 pm

Re: Wifi_DisconnectAP() doesn't seem to work

Post by JanMulder » Sat Mar 26, 2011 12:19 am

It's about disconnecting. I'm really sure it is connected, but if I return to the menu, I want to disconnect from the access point. So first the Wifi_AssocStatus() is equal to 5 (which is connected) and after I call Wifi_DisconnectAP(); it still is 5.

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: Wifi_DisconnectAP() doesn't seem to work

Post by elhobbs » Sat Mar 26, 2011 12:24 am

If you disconnect wouldn't it disappear from the list? Alternatively you could use a packet sniffer to look for disassociation packets.

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: Wifi_DisconnectAP() doesn't seem to work

Post by elhobbs » Sat Mar 26, 2011 2:21 am

I took a look at the dswifi code. It does not send a disassociation packet. the function sets a flag for the arm7 to perform the disconnect - but it does not send anything (that I can tell). it sets the AID to 0 and removes the connected flag. I am a little surprised that you are seeing 5 from Wifi_AssocStatus as I would expect 6 (ASSOCSTATUS_CANNOTCONNECT) as the Wifi_DisconnectAP sets wifi_connect_state=-1 before it returns - which should cause Wifi_AssocStatus to always return ASSOCSTATUS_CANNOTCONNECT.

it looks like Wifi_AssocStatus is only really useful while trying to associate. I think WifiData->curMode would be a better indicator but it is not really exposed anywhere.

after a few minutes of inactivity the AP should drop the connection anyway. You probably need to wait a little while before trying to connect to a different AP so that the arm7 has a chance to process the disconnect request.

JanMulder
Posts: 15
Joined: Wed Jan 26, 2011 2:52 pm

Re: Wifi_DisconnectAP() doesn't seem to work

Post by JanMulder » Sat Mar 26, 2011 9:05 am

Thanks for the help. You are right it did return 6 afterwards.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests