From ac06fb12f58398f7cf715a2e0b6cc84512fb6e41 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 24 Sep 2012 01:05:51 +0300 Subject: [PATCH] P2P: Add more debug prints for GO start routines This makes it easier to debug issues in starting GO mode. Signed-hostap: Jouni Malinen --- wpa_supplicant/events.c | 2 ++ wpa_supplicant/p2p_supplicant.c | 25 +++++++++++++++++++++---- wpa_supplicant/scan.c | 1 + 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 17db4082d..e245d4acd 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -851,6 +851,8 @@ static void wpa_supplicant_req_new_scan(struct wpa_supplicant *wpa_s, * we don't wait timeout seconds before transitioning * to INACTIVE state. */ + wpa_dbg(wpa_s, MSG_DEBUG, "Short-circuit new scan request " + "since there are no enabled networks"); wpa_supplicant_set_state(wpa_s, WPA_INACTIVE); return; } diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 4463eb6c8..883761a50 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -848,12 +848,18 @@ static void wpas_start_wps_go(struct wpa_supplicant *wpa_s, { struct wpa_ssid *ssid; - if (wpas_copy_go_neg_results(wpa_s, params) < 0) + wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Starting GO"); + if (wpas_copy_go_neg_results(wpa_s, params) < 0) { + wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Could not copy GO Negotiation " + "results"); return; + } ssid = wpa_config_add_network(wpa_s->conf); - if (ssid == NULL) + if (ssid == NULL) { + wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Could not add network for GO"); return; + } wpa_s->show_group_started = 0; @@ -890,6 +896,8 @@ static void wpas_start_wps_go(struct wpa_supplicant *wpa_s, wpa_s->connect_without_scan = ssid; wpa_s->reassociate = 1; wpa_s->disconnected = 0; + wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Request scan (that will be skipped) to " + "start GO)"); wpa_supplicant_req_scan(wpa_s, 0, 0); } @@ -3731,18 +3739,27 @@ wpas_p2p_get_group_iface(struct wpa_supplicant *wpa_s, int addr_allocated, { struct wpa_supplicant *group_wpa_s; - if (!wpas_p2p_create_iface(wpa_s)) + if (!wpas_p2p_create_iface(wpa_s)) { + wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use same interface for group " + "operations"); return wpa_s; + } if (wpas_p2p_add_group_interface(wpa_s, go ? WPA_IF_P2P_GO : - WPA_IF_P2P_CLIENT) < 0) + WPA_IF_P2P_CLIENT) < 0) { + wpa_msg(wpa_s, MSG_ERROR, "P2P: Failed to add group interface"); return NULL; + } group_wpa_s = wpas_p2p_init_group_interface(wpa_s, go); if (group_wpa_s == NULL) { + wpa_msg(wpa_s, MSG_ERROR, "P2P: Failed to initialize group " + "interface"); wpas_p2p_remove_pending_group_interface(wpa_s); return NULL; } + wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Use separate group interface %s", + group_wpa_s->ifname); return group_wpa_s; } diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index c01867119..f32354bd7 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -451,6 +451,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) } if (wpa_s->disconnected && !wpa_s->scan_req) { + wpa_dbg(wpa_s, MSG_DEBUG, "Disconnected - do not scan"); wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED); return; }