Patch android wifi to enable IBSS/WEP support
Only To developers.
wpa_supplicant 0.8.X, wpa_supplicant_drvier nl80211, wifi chip bcm4330.
Patch
修改Settings/wifi中的代码以显示[IBSS][WEP] ssid或没有名字的ssid.
当UI显示SSID列表时,会获取从wpa_supplicant最近扫描到的APs;wpa_supplicant的输出扫描结果并没有过滤掉IBSS或隐藏的APs。
In constructAccessPoints()@WifiSettings.java,
final List<ScanResult> results = mWifiManager.getScanResults(); //同步操作
if (results != null) {
for (ScanResult result : results) {
// Ignore hidden and ad-hoc networks.
if (result.SSID == null || result.SSID.length() == 0 /* || result.capabilities.contains("[IBSS]")*/ ) {
continue;
}
修改wpa_supplicant,设置IBSS spot工作模式配置和连接时避免跳过
当第一次点击连接IBSS/ADHOC AP时,会弹出输入密码对话框,wpa_supplicant会将AP configuration信息保存到wpa_supplicant.conf中;此时保存该IBSS AP的工作模式为mode=1,保存到wpa_supplicant.conf中。
In wpa_supplicant_ctrl_iface_set_network(…)@ctrl_iface.c
static int wpa_supplicant_ctrl_iface_set_network(
struct wpa_supplicant *wpa_s, char *cmd)
{
int id;
struct wpa_ssid *ssid;
char *name, *value;
struct wpa_bss *bss;
/* cmd: "<network id> <variable name> <value>" */
name = os_strchr(cmd, ' ');
if (name == NULL)
return -1;
*name++ = '\0';
value = os_strchr(name, ' ');
if (value == NULL)
return -1;
*value++ = '\0';
id = atoi(cmd);
wpa_printf(MSG_DEBUG, "CTRL_IFACE: SET_NETWORK id=%d name='%s'",
id, name);
wpa_hexdump_ascii_key(MSG_INFO, "CTRL_IFACE: value",
(u8 *) value, os_strlen(value));
ssid = wpa_config_get_network(wpa_s->conf, id);
if (ssid == NULL) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Could not find network "
"id=%d", id);
return -1;
}
if (wpa_config_set(ssid, name, value, 0) < 0) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE: Failed to set network "
"variable '%s'", name);
return -1;
}
if (os_strcmp(name, "ssid") == 0) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE: check if hook %s ssid->mode to 1(IBSS) ", value);
bss = NULL;
dl_list_for_each(bss, &wpa_s->bss_id, struct wpa_bss, list_id) {
if(bss->ssid) {
wpa_printf(MSG_DEBUG, "CTRL_IFACE: bss ssid foreach '%s'", bss->ssid);
if(os_strncmp(bss->ssid, value+1, os_strlen(bss->ssid))==0 && (bss->caps & IEEE80211_CAP_IBSS))
{
wpa_printf(MSG_DEBUG, "CTRL_IFACE: find matched ssid for '%d', try to set IBSS mode", id);
if (wpa_config_set(ssid, "mode", "1", 0) < 0) {