Ok just a new post here because the old one is getting quite long..
I think I may have cracked it. There is another file /data/misc/wifi/wpa_supplicant.conf
When I add the bgscan line into there it parses the line upon starting wpa_supplicant because it throws an error when starting complaining this is not a global variable. So I added it manually to the network specific configuration area like so:
model_name=HTC One X
model_number=HTC One X
Bottom line under network configuration bgscan="simple:20:-30:20"
. Beware this is a very bad setting because it implies now:
Do background scans when the signal gets lower than -30db (so almost continuously, this was on purpose for my testing)
Then rescan every 20 seconds, and I believe the second 20 value is the scan interval when the signal is good.
Despite being a bad value'd test setup.
I can see it re scanning every 20 seconds and considering the roaming candidates. WHOOHOO.
I'm not sure how to put a line in that file from source because it's maintained on the fly I guess because the network is added to it when you connect to it and provide the key. So someone has to make a change in the code that appends lines in that file upon connecting to an unknown network and saving it in there.
In case anyone goes working on this; a sensible config like would be:
So don't bgscan unless the signal gets worse than -65db and then once every 30 seconds.
When the signal is good do it every 300 seconds.
So now all we need is a developer who can change whatever code that generates that /data/misc/wifi/wpa_supplicant.conf to include an extra line per network that gets added. That should resolve the issue. Again, I have no dev skills so I'm kindly asking someone to have a look at this.
So until this gets merged we actually have a manual fix.. ADB pull the file, put the line in the network section. Push it back and fix the permissions and ownership. Then reboot or wpa_cli reconfigure.
Re-testing now on the stock CM10.2 20131002 nightly to see if it works without the CONFIG_BGSCAN=y