From 0e15e529eb201478954c7104ebb22edb7fb4359b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 16 Dec 2009 16:02:38 +0200 Subject: [PATCH] Show current mode (station/AB/IBSS) in status --- wpa_supplicant/ctrl_iface.c | 21 +++++++++++++++++++++ wpa_supplicant/wpa_gui-qt4/wpagui.cpp | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 8ceebd321..d19500d6b 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -473,6 +473,27 @@ static int wpa_supplicant_ctrl_iface_status(struct wpa_supplicant *wpa_s, return pos - buf; pos += ret; } + + switch (ssid->mode) { + case 0: + ret = os_snprintf(pos, end - pos, + "mode=station\n"); + break; + case 1: + ret = os_snprintf(pos, end - pos, + "mode=IBSS\n"); + break; + case 2: + ret = os_snprintf(pos, end - pos, + "mode=AP\n"); + break; + default: + ret = 0; + break; + } + if (ret < 0 || ret >= end - pos) + return pos - buf; + pos += ret; } #ifdef CONFIG_AP diff --git a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp index 943bd5354..990268c6b 100644 --- a/wpa_supplicant/wpa_gui-qt4/wpagui.cpp +++ b/wpa_supplicant/wpa_gui-qt4/wpagui.cpp @@ -508,6 +508,7 @@ void WpaGui::updateStatus() bool bssid_updated = false, ipaddr_updated = false; bool status_updated = false; char *pairwise_cipher = NULL, *group_cipher = NULL; + char *mode = NULL; start = buf; while (*start) { @@ -544,6 +545,8 @@ void WpaGui::updateStatus() pairwise_cipher = pos; } else if (strcmp(start, "group_cipher") == 0) { group_cipher = pos; + } else if (strcmp(start, "mode") == 0) { + mode = pos; } } @@ -551,6 +554,8 @@ void WpaGui::updateStatus() break; start = end + 1; } + if (status_updated && mode) + textStatus->setText(textStatus->text() + " (" + mode + ")"); if (pairwise_cipher || group_cipher) { QString encr;