Show current mode (station/AB/IBSS) in status
authorJouni Malinen <jouni.malinen@atheros.com>
Wed, 16 Dec 2009 14:02:38 +0000 (16:02 +0200)
committerJouni Malinen <j@w1.fi>
Wed, 16 Dec 2009 14:02:38 +0000 (16:02 +0200)
wpa_supplicant/ctrl_iface.c
wpa_supplicant/wpa_gui-qt4/wpagui.cpp

index 8ceebd3..d19500d 100644 (file)
@@ -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
index 943bd53..990268c 100644 (file)
@@ -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;