]> git.sur5r.net Git - i3/i3status/blobdiff - src/print_wireless_info.c
wifi: properly display ad-hoc networks
[i3/i3status] / src / print_wireless_info.c
index 9ab9c2f38786f8132d448f69ba7b3f4cb96155d2..a678f522b92b7383666e3d2b1350af54cee42107 100644 (file)
@@ -93,6 +93,15 @@ static int get_wireless_info(const char *interface, wireless_info_t *info) {
                 info->essid[IW_ESSID_MAX_SIZE] = '\0';
         }
 
+        /* If the function iw_get_stats does not return proper stats, the
+           wifi is considered as down.
+           Since ad-hoc network does not have theses stats, we need to return
+           here for this mode. */
+        if (wcfg.mode == 1) {
+                close(skfd);
+                return 1;
+        }
+
         /* Wireless quality is a relative value in a driver-specific range.
            Signal and noise level can be either relative or absolute values
            in dBm. Furthermore, noise and quality can be expressed directly