diff options
| author | Dmitry Shmidt <dimitrysh@google.com> | 2011-09-28 18:10:36 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2011-09-28 18:10:36 -0700 |
| commit | b98d1c2746bf93497d587d12b2657cb9b8c5c76c (patch) | |
| tree | 27d556c72aa6900ba5c0212110a09824eb82c647 | |
| parent | 2b7fea278e437f1fe13970a1e65ca51149223d96 (diff) | |
| parent | fc41cadcff448cdd2b60e376fc6e7378e2e57b5e (diff) | |
| download | android_external_wpa_supplicant_8-b98d1c2746bf93497d587d12b2657cb9b8c5c76c.tar.gz android_external_wpa_supplicant_8-b98d1c2746bf93497d587d12b2657cb9b8c5c76c.tar.bz2 android_external_wpa_supplicant_8-b98d1c2746bf93497d587d12b2657cb9b8c5c76c.zip | |
am fc41cadc: nl80211: Add get_noa() support for WFD certification (BRCM)
* commit 'fc41cadcff448cdd2b60e376fc6e7378e2e57b5e':
nl80211: Add get_noa() support for WFD certification (BRCM)
| -rw-r--r-- | src/drivers/driver_nl80211.c | 2 | ||||
| -rw-r--r-- | src/p2p/p2p_group.c | 8 | ||||
| -rw-r--r-- | src/p2p/p2p_i.h | 5 | ||||
| -rw-r--r-- | wpa_supplicant/ctrl_iface.c | 67 | ||||
| -rw-r--r-- | wpa_supplicant/p2p_supplicant.c | 39 | ||||
| -rw-r--r-- | wpa_supplicant/p2p_supplicant.h | 2 |
6 files changed, 117 insertions, 6 deletions
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index dfca9eff..9dc24945 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -209,6 +209,7 @@ static int wpa_driver_nl80211_probe_req_report(void *priv, int report); static void mlme_event_deauth_disassoc(struct wpa_driver_nl80211_data *drv, enum wpa_event_type type, const u8 *frame, size_t len); +int wpa_driver_get_p2p_noa(void *priv, u8 *buf, size_t len); int wpa_driver_set_p2p_noa(void *priv, u8 count, int start, int duration); int wpa_driver_set_p2p_ps(void *priv, int legacy_ps, int opp_ps, int ctwindow); int wpa_driver_set_ap_wps_p2p_ie(void *priv, const struct wpabuf *beacon, @@ -6837,6 +6838,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = { .remove_pmkid = nl80211_remove_pmkid, .flush_pmkid = nl80211_flush_pmkid, #ifdef ANDROID_BRCM_P2P_PATCH + .get_noa = wpa_driver_get_p2p_noa, .set_noa = wpa_driver_set_p2p_noa, .set_p2p_powersave = wpa_driver_set_p2p_ps, .set_ap_wps_ie = wpa_driver_set_ap_wps_p2p_ie, diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c index 9fb9f00f..0d05319c 100644 --- a/src/p2p/p2p_group.c +++ b/src/p2p/p2p_group.c @@ -499,7 +499,11 @@ int p2p_group_notif_noa(struct p2p_group *group, const u8 *noa, } else { if (group->noa) { if (wpabuf_size(group->noa) >= noa_len) { + #ifdef ANDROID_BRCM_P2P_PATCH + group->noa->used = 0; + #else group->noa->size = 0; + #endif wpabuf_put_data(group->noa, noa, noa_len); } else { wpabuf_free(group->noa); @@ -658,11 +662,11 @@ u8 p2p_group_presence_req(struct p2p_group *group, else wpa_hexdump(MSG_DEBUG, "P2P: Current NoA", curr_noa, curr_noa_len); - +#ifndef ANDROID_BRCM_P2P_PATCH /* TODO: properly process request and store copy */ if (curr_noa_len > 0) return P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE; - +#endif return P2P_SC_SUCCESS; } diff --git a/src/p2p/p2p_i.h b/src/p2p/p2p_i.h index 52d93116..afb891e2 100644 --- a/src/p2p/p2p_i.h +++ b/src/p2p/p2p_i.h @@ -532,6 +532,11 @@ struct p2p_noa_desc { /* p2p_group.c */ const u8 * p2p_group_get_interface_addr(struct p2p_group *group); + +#ifdef ANDROID_BRCM_P2P_PATCH +void p2p_get_group_noa(struct p2p_group *group, u8 *noa, size_t* noa_len); +#endif + u8 p2p_group_presence_req(struct p2p_group *group, const u8 *client_interface_addr, const u8 *noa, size_t noa_len); diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 1ee2d154..a163c281 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -327,12 +327,12 @@ static int wpa_supplicant_ctrl_iface_wps_pbc(struct wpa_supplicant *wpa_s, #if defined(ANDROID_BRCM_P2P_PATCH) && defined(CONFIG_AP) for (iface = wpa_s->global->ifaces; iface; iface = iface->next) { if (iface->ap_iface){ - wpa_printf(MSG_DEBUG, "CTRL_IFACE WPS_PBC: iface 0x%08x wpa_s->ap_iface %p", iface, iface->ap_iface); + wpa_printf(MSG_DEBUG, "CTRL_IFACE WPS_PBC: iface 0x%08x wpa_s->ap_iface %p", (u32)iface, iface->ap_iface); wpa_supplicant_ap_wps_pbc(iface, _bssid, _p2p_dev_addr); return 0; } else - wpa_printf(MSG_DEBUG, "CTRL_IFACE WPS_PBC: ap_iface is not set iface 0x%08x", iface); + wpa_printf(MSG_DEBUG, "CTRL_IFACE WPS_PBC: ap_iface is not set iface 0x%08x", (u32)iface); } #elif defined CONFIG_AP if (wpa_s->ap_iface) @@ -370,14 +370,14 @@ static int wpa_supplicant_ctrl_iface_wps_pin(struct wpa_supplicant *wpa_s, #if defined(ANDROID_BRCM_P2P_PATCH) && defined(CONFIG_AP) for (iface = wpa_s->global->ifaces; iface; iface = iface->next) { if (iface->ap_iface){ - wpa_printf(MSG_DEBUG, "CTRL_IFACE WPS_PIN: iface 0x%08x wpa_s->ap_iface %p", iface, iface->ap_iface); + wpa_printf(MSG_DEBUG, "CTRL_IFACE WPS_PIN: iface 0x%08x wpa_s->ap_iface %p", (u32)iface, iface->ap_iface); /* Call the wps registrar for the main interface */ wpa_supplicant_ap_wps_pin(iface, _bssid, pin, buf, buflen); return 0; } else - wpa_printf(MSG_DEBUG, "CTRL_IFACE WPS_PIN: ap_iface is not set iface 0x%08x", iface); + wpa_printf(MSG_DEBUG, "CTRL_IFACE WPS_PIN: ap_iface is not set iface 0x%08x", (u32)iface); } #elif defined CONFIG_AP if (wpa_s->ap_iface) @@ -2814,6 +2814,24 @@ static int p2p_ctrl_peer(struct wpa_supplicant *wpa_s, char *cmd, buf, buflen); } +#ifdef ANDROID_BRCM_P2P_PATCH +struct wpa_supplicant* p2p_get_apif(struct wpa_supplicant* wpa_s) +{ + struct wpa_supplicant* iface; + for (iface = wpa_s->global->ifaces; iface; iface = iface->next) + if (iface->ap_iface) + return iface; + return wpa_s; +} +struct wpa_supplicant* p2p_get_clientif(struct wpa_supplicant* wpa_s) +{ + struct wpa_supplicant* iface; + for (iface = wpa_s->global->ifaces; iface; iface = iface->next) + if (iface->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT) + return iface; + return wpa_s; +} +#endif static int p2p_ctrl_set(struct wpa_supplicant *wpa_s, char *cmd) { @@ -2869,17 +2887,46 @@ static int p2p_ctrl_set(struct wpa_supplicant *wpa_s, char *cmd) return -1; wpa_printf(MSG_DEBUG, "CTRL_IFACE: P2P_SET GO NoA: count=%d " "start=%d duration=%d", count, start, duration); +#ifdef ANDROID_BRCM_P2P_PATCH + return wpas_p2p_set_noa(p2p_get_apif(wpa_s), count, start, duration); +#else return wpas_p2p_set_noa(wpa_s, count, start, duration); +#endif } if (os_strcmp(cmd, "ps") == 0) +#ifdef ANDROID_BRCM_P2P_PATCH + return wpas_drv_set_p2p_powersave(p2p_get_clientif(wpa_s), atoi(param), -1, -1); +#else return wpa_drv_set_p2p_powersave(wpa_s, atoi(param), -1, -1); +#endif if (os_strcmp(cmd, "oppps") == 0) +#ifdef ANDROID_BRCM_P2P_PATCH + return wpas_drv_set_p2p_powersave(p2p_get_apif(wpa_s), -1, atoi(param), -1); +#else return wpa_drv_set_p2p_powersave(wpa_s, -1, atoi(param), -1); +#endif if (os_strcmp(cmd, "ctwindow") == 0) +#ifdef ANDROID_BRCM_P2P_PATCH + return wpa_drv_set_p2p_powersave(p2p_get_apif(wpa_s), -1, -1, atoi(param)); +#else return wpa_drv_set_p2p_powersave(wpa_s, -1, -1, atoi(param)); +#endif + + if (os_strcmp(cmd, "disabled") == 0) { + wpa_s->global->p2p_disabled = atoi(param); + wpa_printf(MSG_DEBUG, "P2P functionality %s", + wpa_s->global->p2p_disabled ? + "disabled" : "enabled"); + if (wpa_s->global->p2p_disabled) { + wpas_p2p_stop_find(wpa_s); + os_memset(wpa_s->p2p_auth_invite, 0, ETH_ALEN); + p2p_flush(wpa_s->global->p2p); + } + return 0; + } if (os_strcmp(cmd, "disabled") == 0) { wpa_s->global->p2p_disabled = atoi(param); @@ -3312,6 +3359,18 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s, if (wpas_p2p_cancel(wpa_s)) reply_len = -1; } else if (os_strncmp(buf, "P2P_PRESENCE_REQ ", 17) == 0) { + #if defined(ANDROID_BRCM_P2P_PATCH) && defined(CONFIG_P2P) + /* We have to send presence command to p2p interface if p2p_interface is started + * otherwise we can send it to primary interface + */ + struct wpa_supplicant* ifs; + for (ifs = wpa_s->global->ifaces; ifs; ifs = ifs->next) { + if ( (ifs->p2p_group_interface == P2P_GROUP_INTERFACE_GO ) ||(ifs->p2p_group_interface == P2P_GROUP_INTERFACE_CLIENT )) { + wpa_s = ifs; + break; + } + } + #endif /* defined ANDROID_BRCM_P2P_PATCH && defined CONFIG_P2P */ if (p2p_ctrl_presence_req(wpa_s, buf + 17) < 0) reply_len = -1; } else if (os_strcmp(buf, "P2P_PRESENCE_REQ") == 0) { diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 12dae342..f4c5a53d 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -4168,10 +4168,49 @@ int wpas_p2p_set_noa(struct wpa_supplicant *wpa_s, u8 count, int start, { if (!wpa_s->ap_iface) return -1; + +#ifdef ANDROID_BRCM_P2P_PATCH +#define NOA_BUF_LEN 50 + /* Now get the NOA descriptor from the driver */ + hostapd_p2p_set_noa(wpa_s->ap_iface->bss[0], count, start, + duration); + if(count > 0) { + u8 noa[NOA_BUF_LEN]; + int noa_len = 0; + wpa_printf(MSG_DEBUG, "P2P: Get NOA attribute from driver"); + noa_len = wpa_drv_get_noa(wpa_s, noa, NOA_BUF_LEN); + if (noa_len) { + wpa_printf(MSG_DEBUG, "P2P: Now Update NOA attributes in Beacons/ProbeRsps noa_len %d", noa_len); + return p2p_group_notif_noa(wpa_s->p2p_group, noa, noa_len); + } + else + return 0; + } + else + return 0; +#else return hostapd_p2p_set_noa(wpa_s->ap_iface->bss[0], count, start, duration); +#endif } +#ifdef ANDROID_BRCM_P2P_PATCH +int wpas_drv_set_p2p_powersave(struct wpa_supplicant *wpa_s, int legacy_ps, int opp_ps, int ctwindow) +{ +#define NOA_BUF_LEN 50 + u8 noa[NOA_BUF_LEN]; + int noa_len = 0; + wpa_drv_set_p2p_powersave(wpa_s, legacy_ps, opp_ps, ctwindow); + wpa_printf(MSG_DEBUG, "P2P: Get NOA attribute from driver"); + noa_len = wpa_drv_get_noa(wpa_s, noa, NOA_BUF_LEN); + if (noa_len) { + wpa_printf(MSG_DEBUG, "P2P: Now Update NOA attributes in Beacons/ProbeRsps noa_len %d", noa_len); + return p2p_group_notif_noa(wpa_s->p2p_group, noa, noa_len); + } + else + return 0; +} +#endif int wpas_p2p_set_cross_connect(struct wpa_supplicant *wpa_s, int enabled) { diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h index 93a5afd0..5be9ba29 100644 --- a/wpa_supplicant/p2p_supplicant.h +++ b/wpa_supplicant/p2p_supplicant.h @@ -111,6 +111,8 @@ void wpas_p2p_deauth_notif(struct wpa_supplicant *wpa_s, const u8 *bssid, #ifdef ANDROID_BRCM_P2P_PATCH void wpas_p2p_group_remove_notif(struct wpa_supplicant *wpa_s, u16 reason_code); +int wpas_drv_set_p2p_powersave(struct wpa_supplicant *wpa_s, int legacy_ps, + int opp_ps, int ctwindow); #endif /* ANDROID_BRCM_P2P_PATCH */ void wpas_p2p_disassoc_notif(struct wpa_supplicant *wpa_s, const u8 *bssid, u16 reason_code, const u8 *ie, size_t ie_len); |
