Suppose you want one Android phone to connect to another. Unfortunately, the WifiManager in stock Android ignores ad-hoc networks. There are a couple ways around this:
The original purpose of this patch was to enable an Android device tether to another Android phone using Barnacle Wifi Tether.
At this time, Android does not support ad-hoc networks. That is, ad-hoc (IBSS) entries are filtered out from the scan results reported by the wpa_supplicant.
To add ad-hoc network support one could augment the
WifiStateTracker to not
filter IBSS entries out and set the wpa_supplicant in
AP_SCAN 2 mode to
establish new IBSS instead of associating with a scanned one. That would
require fiddling with the Java framework on the phone.
A more crazy way to do this is to augment the wpa_supplicant to masquerade ad- hoc networks as regular infrastructure access points (APs). This makes changes only to the wpa_supplicant and allows a drop in replacement on rooted phones.
The patch below modifies the wpa_supplicant code in the
external/wpa_supplicant AOSP repo to make ad-hoc networks appear as regular
APs with a
[IBSS]flag from scan results,
mode 1(ad-hoc) if the ssid is for IBSS
I've shared some thoughts on the future of ad-hoc in hereblog comments powered by Disqus