Browse Source

Show current mode (station/AB/IBSS) in status

Jouni Malinen 15 years ago
parent
commit
0e15e529eb
2 changed files with 26 additions and 0 deletions
  1. 21 0
      wpa_supplicant/ctrl_iface.c
  2. 5 0
      wpa_supplicant/wpa_gui-qt4/wpagui.cpp

+ 21 - 0
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

+ 5 - 0
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;