From b05da5a8c808715098cae93ef1db1f2684f71c9f Mon Sep 17 00:00:00 2001 From: Dmitry Shmidt Date: Tue, 27 Sep 2011 12:18:12 -0700 Subject: bcmdhd: wpa_supplicant: Fix WFD and WPS certification problem for GO BUG: b/5367351 Change-Id: I8786e2ffc8eb13cc1d67c2fb064f4929918ca38b Signed-off-by: Dmitry Shmidt --- bcmdhd/wpa_supplicant_8_lib/driver_cmd_common.h | 5 ++ bcmdhd/wpa_supplicant_8_lib/driver_cmd_nl80211.c | 61 ++++++++++++++++++++++++ bcmdhd/wpa_supplicant_8_lib/driver_nl80211.h | 1 + 3 files changed, 67 insertions(+) (limited to 'bcmdhd/wpa_supplicant_8_lib') diff --git a/bcmdhd/wpa_supplicant_8_lib/driver_cmd_common.h b/bcmdhd/wpa_supplicant_8_lib/driver_cmd_common.h index 5469e99..03ce253 100644 --- a/bcmdhd/wpa_supplicant_8_lib/driver_cmd_common.h +++ b/bcmdhd/wpa_supplicant_8_lib/driver_cmd_common.h @@ -17,6 +17,11 @@ #define MAX_DRV_CMD_SIZE 248 #define DRV_NUMBER_SEQUENTIAL_ERRORS 4 +#define RSSI_CMD "RSSI" +#define LINKSPEED_CMD "LINKSPEED" + +#define MAX_WPSP2PIE_CMD_SIZE 384 + #define WEXT_PNOSETUP_HEADER "PNOSETUP " #define WEXT_PNOSETUP_HEADER_SIZE 9 #define WEXT_PNO_TLV_PREFIX 'S' diff --git a/bcmdhd/wpa_supplicant_8_lib/driver_cmd_nl80211.c b/bcmdhd/wpa_supplicant_8_lib/driver_cmd_nl80211.c index 2c9241e..5300315 100644 --- a/bcmdhd/wpa_supplicant_8_lib/driver_cmd_nl80211.c +++ b/bcmdhd/wpa_supplicant_8_lib/driver_cmd_nl80211.c @@ -282,3 +282,64 @@ int wpa_driver_nl80211_driver_cmd(void *priv, char *cmd, char *buf, } return ret; } + +int wpa_driver_set_p2p_noa(void *priv, u8 count, int start, int duration) +{ + char buf[MAX_DRV_CMD_SIZE]; + + memset(buf, 0, sizeof(buf)); + wpa_printf(MSG_DEBUG, "%s: Entry", __func__); + snprintf(buf, sizeof(buf), "P2P_SET_NOA %d %d %d", count, start, duration); + return wpa_driver_nl80211_driver_cmd(priv, buf, buf, strlen(buf)+1); +} + +int wpa_driver_set_p2p_ps(void *priv, int legacy_ps, int opp_ps, int ctwindow) +{ + char buf[MAX_DRV_CMD_SIZE]; + + memset(buf, 0, sizeof(buf)); + wpa_printf(MSG_DEBUG, "%s: Entry", __func__); + snprintf(buf, sizeof(buf), "P2P_SET_PS %d %d %d", legacy_ps, opp_ps, ctwindow); + return wpa_driver_nl80211_driver_cmd(priv, buf, buf, strlen(buf) + 1); +} + +int wpa_driver_set_ap_wps_p2p_ie(void *priv, const struct wpabuf *beacon, + const struct wpabuf *proberesp, + const struct wpabuf *assocresp) +{ + char buf[MAX_WPSP2PIE_CMD_SIZE]; + struct wpabuf *ap_wps_p2p_ie = NULL; + char *_cmd = "SET_AP_WPS_P2P_IE"; + char *pbuf; + int ret = 0; + int i; + struct cmd_desc { + int cmd; + const struct wpabuf *src; + } cmd_arr[] = { + {0x1, beacon}, + {0x2, proberesp}, + {0x4, assocresp}, + {-1, NULL} + }; + + wpa_printf(MSG_DEBUG, "%s: Entry", __func__); + for (i = 0; cmd_arr[i].cmd != -1; i++) { + os_memset(buf, 0, sizeof(buf)); + pbuf = buf; + pbuf += sprintf(pbuf, "%s %d", _cmd, cmd_arr[i].cmd); + *pbuf++ = '\0'; + ap_wps_p2p_ie = cmd_arr[i].src ? + wpabuf_dup(cmd_arr[i].src) : NULL; + if (ap_wps_p2p_ie) { + os_memcpy(pbuf, wpabuf_head(ap_wps_p2p_ie), wpabuf_len(ap_wps_p2p_ie)); + ret = wpa_driver_nl80211_driver_cmd(priv, buf, buf, + strlen(_cmd) + 3 + wpabuf_len(ap_wps_p2p_ie)); + wpabuf_free(ap_wps_p2p_ie); + if (ret < 0) + break; + } + } + + return ret; +} diff --git a/bcmdhd/wpa_supplicant_8_lib/driver_nl80211.h b/bcmdhd/wpa_supplicant_8_lib/driver_nl80211.h index 0a0f3f4..7d19995 100644 --- a/bcmdhd/wpa_supplicant_8_lib/driver_nl80211.h +++ b/bcmdhd/wpa_supplicant_8_lib/driver_nl80211.h @@ -128,6 +128,7 @@ struct wpa_driver_nl80211_data { u64 send_action_cookie; unsigned int last_mgmt_freq; + unsigned int ap_oper_freq; struct wpa_driver_scan_filter *filter_ssids; size_t num_filter_ssids; -- cgit v1.1