[HTC One X] pakjebakmeel:
Another wireless update.

I've looked at external/wpa_supplicant_8_ti/wpa_supplicant/android.config and found some interesting things.

One is this:

# Disable roaming in wpa_supplicant
#CONFIG_NO_ROAMING=y

It's commented out but I wonder what the default value is.. hmmm.

The other thing I found it that appearently roaming relies on background scans. When a background scan is performed it will evaluate the signal strength and optionally hop AP's. See description from the wpa_supplicant.conf man page:

# bgscan: Background scanning
# wpa_supplicant behavior for background scanning can be specified by
# configuring a bgscan module. These modules are responsible for requesting
# background scans for the purpose of roaming within an ESS (i.e., within a
# single network block with all the APs using the same SSID). The bgscan
# parameter uses following format: "<bgscan module name>:<module parameters>"
# Following bgscan modules are available:
# simple - Periodic background scans based on signal strength
# bgscan="simple:<short bgscan interval in seconds>:<signal strength threshold>:
# <long interval>"
# bgscan="simple:30:-45:300"
# learn - Learn channels used by the network and try to avoid bgscans on other
# channels (experimental)
# bgscan="learn:<short bgscan interval in seconds>:<signal strength threshold>:
# <long interval>[:<database file name>]"
# bgscan="learn:30:-45:300:/etc/wpa_supplicant/network1.bgscan"

The scan type is dependant on which modules are built in during compile time. I was thinking of using a simple scan type for a start in my testing. I think that should work because:

# bgscan
NEED_BGSCAN=y
CONFIG_BGSCAN_LEARN=y
CONFIG_BGSCAN_SIMPLE=y

I'm going to test using that simple bgscan parameter in the wpa_supplicant.conf and optionally compile using CONFIG_NO_ROAMING=n if it turn out that the default value is CONFIG_NO_ROAMING=y.

There's not too much documentation on how this is supposed to work but I found this too:

http://comments.gmane.org/gmane.linux.drivers.hostap/26925

So.. to be continued.

Here's the code responsible for roaming external/wpa_supplicant_8_ti/wpa_supplicant/events.c:

#ifndef CONFIG_NO_ROAMING
wpa_dbg(wpa_s, MSG_DEBUG, "Considering within-ESS reassociation");
wpa_dbg(wpa_s, MSG_DEBUG, "Current BSS: " MACSTR " level=%d",
MAC2STR(current_bss->bssid), current_bss->level);
wpa_dbg(wpa_s, MSG_DEBUG, "Selected BSS: " MACSTR " level=%d",
MAC2STR(selected->bssid), selected->level);

if (wpa_s->current_ssid->bssid_set &&
os_memcmp(selected->bssid, wpa_s->current_ssid->bssid, ETH_ALEN) ==
0) {
wpa_dbg(wpa_s, MSG_DEBUG, "Allow reassociation - selected BSS "
"has preferred BSSID");
return 1;
}

min_diff = 2;
if (current_bss->level < 0) {
if (current_bss->level < -85)
min_diff = 1;
else if (current_bss->level < -80)
min_diff = 2;
else if (current_bss->level < -75)
min_diff = 3;
else if (current_bss->level < -70)
min_diff = 4;
else
min_diff = 5;
}
if (abs(current_bss->level - selected->level) < min_diff) {
wpa_dbg(wpa_s, MSG_DEBUG, "Skip roam - too small difference "
"in signal level");
return 0;
}

wpa_supplicant_mark_roaming(wpa_s);
return 1;
#else /* CONFIG_NO_ROAMING */
return 0;
#endif /* CONFIG_NO_ROAMING */
}

I looks like this code is compiled when the CONFIG_NO_ROAMING is NOT defined. So I believe the statement #ifndef CONFIG_NO_ROAMING implies that if you set CONFIG_NO_ROAMING=n it is actually defined and it will have the same effect as setting it to to CONFIG_NO_ROAMING=y because it only tests whether its defined or not. It doesn't look at the value, am I right in assuming that? My limited knowledge tell me that it evaluates the difference in signal strength and roams if it's big enough.

So t should at least print:

Considering within-ESS reassociation

and then optionally:

Skip roam - too small difference

or

Allow reassociation - selected BSS

depending on signal strength.

I have not seen any of these messages in the logcat so it looks like this code isn't working. Any dev mind looking at this? I have not got dev skills. Looks like the code is all there but some configuration breaks it. Could it be as simple as adding that bgscan option to wpa_supplicant.conf? Anyone running CM10.2 care to test?

Putting the following into wpa_supplicant.conf and test roaming whilst watching logcat for the lines above?

bgscan="simple:30:-45:300"

Ok last edit, this is taken from another thread but this is what the log is SUPPOSED to look like. I don't see any of these lines on my device:

W/wpa_supplicant(26939): wlan0: [HTC] wpa_supplicant_event():2272- Got an original EVENT_SCAN_RESULTS
I/wpa_supplicant(26939): Got an original EVENT_SCAN_RESULTS
I/wpa_supplicant(26939): [FN] 00:16:b6:14:7d:6b freq=2412 qual=0 noise=0 level=-74 flags=0x2b
I/wpa_supplicant(26939): selected BSS 00:16:b6:14:7d:6b ssid='FN'
I/wpa_supplicant(26939): Check WiFi offload status: wpa_s->vh_wifi_to_mobile:0 ,wpa_s->vh_user_connect:0
I/wpa_supplicant(26939): Considering within-ESS reassociation
I/wpa_supplicant(26939): Current BSS: 00:16:b6:14:7d:6b level=-74
I/wpa_supplicant(26939): Selected BSS: 00:16:b6:14:7d:6b level=-74
I/wpa_supplicant(26939): Skip roam - too small difference in signal level

Came from here: http://xdaforums.com/showthread.php?p=33192240

Ok I have tested, clean install and added the options for bgscan to wpa_supplicant.conf and I cannot see any debug lines saying it considering roaming. I've stood UNDER an access point for 10 minutes with -95db connection to another AP down the hallway.

I hope someone is going to post in this topic, my post keeps getting longer and longer :)