From f06196652a3e12af00503f4a548c56d4e60f7246 Mon Sep 17 00:00:00 2001 From: Irfan Sheriff Date: Sun, 23 Sep 2012 19:11:37 -0700 Subject: [PATCH] Fix build: Add ANDROID_P2P for SCC interop fixes Change-Id: I847b63428b47016cf9a9a0b090636e1d5b9d28b8 --- src/p2p/p2p_build.c | 2 ++ src/p2p/p2p_go_neg.c | 14 ++++++++++++++ src/p2p/p2p_invitation.c | 8 ++++++++ wpa_supplicant/p2p_supplicant.c | 10 +++++++++- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/p2p/p2p_build.c b/src/p2p/p2p_build.c index 66e8456..bbe2002 100644 --- a/src/p2p/p2p_build.c +++ b/src/p2p/p2p_build.c @@ -135,6 +135,7 @@ void p2p_buf_add_channel_list(struct wpabuf *buf, const char *country, wpa_printf(MSG_DEBUG, "P2P: * Channel List"); } +#ifdef ANDROID_P2P /* Adds a given channel as the only channel in channel list attribute */ void p2p_buf_add_oper_as_channel_list(struct wpabuf *buf, const char *country, u8 reg_class, u8 channel) @@ -156,6 +157,7 @@ void p2p_buf_add_oper_as_channel_list(struct wpabuf *buf, const char *country, WPA_PUT_LE16(len, (u8 *) wpabuf_put(buf, 0) - len - 2); wpa_printf(MSG_DEBUG, "P2P: * Oper as Channel List %u", channel); } +#endif void p2p_buf_add_status(struct wpabuf *buf, u8 status) { diff --git a/src/p2p/p2p_go_neg.c b/src/p2p/p2p_go_neg.c index 0324fe5..b0b53fe 100644 --- a/src/p2p/p2p_go_neg.c +++ b/src/p2p/p2p_go_neg.c @@ -174,13 +174,17 @@ static struct wpabuf * p2p_build_go_neg_req(struct p2p_data *p2p, p2p_buf_add_ext_listen_timing(buf, p2p->ext_listen_period, p2p->ext_listen_interval); p2p_buf_add_intended_addr(buf, p2p->intended_addr); +#ifdef ANDROID_P2P if (p2p->cfg->p2p_concurrency == P2P_SINGLE_CHANNEL_CONCURRENT && p2p->op_channel) { wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Force channel list %d", p2p->op_channel); p2p_buf_add_oper_as_channel_list(buf, p2p->cfg->country, p2p->op_reg_class, p2p->op_channel); } else { +#endif p2p_buf_add_channel_list(buf, p2p->cfg->country, &p2p->channels); +#ifdef ANDROID_P2P } +#endif p2p_buf_add_device_info(buf, p2p, peer); p2p_buf_add_operating_channel(buf, p2p->cfg->country, p2p->op_reg_class, p2p->op_channel); @@ -300,14 +304,18 @@ static struct wpabuf * p2p_build_go_neg_resp(struct p2p_data *p2p, p2p_buf_add_go_intent(buf, (p2p->go_intent << 1) | tie_breaker); p2p_buf_add_config_timeout(buf, p2p->go_timeout, p2p->client_timeout); if (peer && peer->go_state == REMOTE_GO) { +#ifdef ANDROID_P2P if (p2p->cfg->p2p_concurrency == P2P_SINGLE_CHANNEL_CONCURRENT && p2p->op_channel) { wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Forcing a channel "); p2p_buf_add_operating_channel(buf, p2p->cfg->country, p2p->op_reg_class, p2p->op_channel); } else { +#endif wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Omit Operating " "Channel attribute"); +#ifdef ANDROID_P2P } +#endif } else { p2p_buf_add_operating_channel(buf, p2p->cfg->country, p2p->op_reg_class, @@ -315,11 +323,13 @@ static struct wpabuf * p2p_build_go_neg_resp(struct p2p_data *p2p, } p2p_buf_add_intended_addr(buf, p2p->intended_addr); +#ifdef ANDROID_P2P if (p2p->cfg->p2p_concurrency == P2P_SINGLE_CHANNEL_CONCURRENT && p2p->op_channel) { wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "P2P: Force channel list %d", p2p->op_channel); p2p_buf_add_oper_as_channel_list(buf, p2p->cfg->country, p2p->op_reg_class, p2p->op_channel); } else { +#endif if (status || peer == NULL) { p2p_buf_add_channel_list(buf, p2p->cfg->country, &p2p->channels); @@ -332,7 +342,9 @@ static struct wpabuf * p2p_build_go_neg_resp(struct p2p_data *p2p, &res); p2p_buf_add_channel_list(buf, p2p->cfg->country, &res); } +#ifdef ANDROID_P2P } +#endif p2p_buf_add_device_info(buf, p2p, peer); if (peer && peer->go_state == LOCAL_GO) { @@ -1188,6 +1200,7 @@ void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa, #endif /* CONFIG_P2P_STRICT */ } +#ifdef ANDROID_P2P if (msg.operating_channel) { dev->oper_freq = p2p_channel_to_freq((const char *) msg.operating_channel, @@ -1197,6 +1210,7 @@ void p2p_process_go_neg_conf(struct p2p_data *p2p, const u8 *sa, "channel preference: %d MHz", dev->oper_freq); } else dev->oper_freq = 0; +#endif if (!msg.channel_list) { wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, diff --git a/src/p2p/p2p_invitation.c b/src/p2p/p2p_invitation.c index b237cf8..785200c 100644 --- a/src/p2p/p2p_invitation.c +++ b/src/p2p/p2p_invitation.c @@ -66,13 +66,17 @@ static struct wpabuf * p2p_build_invitation_req(struct p2p_data *p2p, p2p->op_reg_class, p2p->op_channel); if (p2p->inv_bssid_set) p2p_buf_add_group_bssid(buf, p2p->inv_bssid); +#ifdef ANDROID_P2P if (p2p->cfg->p2p_concurrency == P2P_SINGLE_CHANNEL_CONCURRENT && p2p->op_channel) { wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "Forcing channel list %d", p2p->op_channel); p2p_buf_add_oper_as_channel_list(buf, p2p->cfg->country, p2p->op_reg_class, p2p->op_channel); } else { +#endif p2p_buf_add_channel_list(buf, p2p->cfg->country, &p2p->channels); +#ifdef ANDROID_P2P } +#endif if (go_dev_addr) dev_addr = go_dev_addr; else if (p2p->inv_role == P2P_INVITE_ROLE_CLIENT) @@ -139,14 +143,18 @@ static struct wpabuf * p2p_build_invitation_resp(struct p2p_data *p2p, reg_class, channel); if (group_bssid) p2p_buf_add_group_bssid(buf, group_bssid); +#ifdef ANDROID_P2P if (p2p->cfg->p2p_concurrency == P2P_SINGLE_CHANNEL_CONCURRENT && channel) { wpa_msg(p2p->cfg->msg_ctx, MSG_DEBUG, "Forcing channel list %d", channel); p2p_buf_add_oper_as_channel_list(buf, p2p->cfg->country, reg_class, channel); } else { +#endif if (channels) p2p_buf_add_channel_list(buf, p2p->cfg->country, channels); +#ifdef ANDROID_P2P } +#endif p2p_buf_update_ie_hdr(buf, len); #ifdef CONFIG_WIFI_DISPLAY diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 53b2d5d..903c94f 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -4431,7 +4431,9 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr, { enum p2p_invite_role role; u8 *bssid = NULL; +#ifdef ANDROID_P2P int force_freq = 0, oper_freq = 0; +#endif wpa_s->p2p_persistent_go_freq = freq; wpa_s->p2p_go_ht40 = !!ht40; @@ -4459,6 +4461,7 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr, } wpa_s->pending_invite_ssid_id = ssid->id; +#ifdef ANDROID_P2P if (wpa_s->current_ssid && wpa_drv_get_bssid(wpa_s, bssid) == 0 && wpa_s->assoc_freq) oper_freq = wpa_s->assoc_freq; @@ -4506,7 +4509,7 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr, "interface", oper_freq); force_freq = oper_freq; } - +#endif if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) return wpa_drv_p2p_invite(wpa_s, peer_addr, role, bssid, ssid->ssid, ssid->ssid_len, @@ -4515,8 +4518,13 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr, if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) return -1; +#ifdef ANDROID_P2P return p2p_invite(wpa_s->global->p2p, peer_addr, role, bssid, ssid->ssid, ssid->ssid_len, force_freq, go_dev_addr, 1); +#else + return p2p_invite(wpa_s->global->p2p, peer_addr, role, bssid, + ssid->ssid, ssid->ssid_len, freq, go_dev_addr, 1); +#endif } -- 2.11.0