]> git.sur5r.net Git - i3/i3status/commitdiff
wifi: properly display ad-hoc networks
authorAdrien Schildknecht <adrien+dev@schischi.me>
Thu, 24 Jan 2013 13:51:33 +0000 (14:51 +0100)
committerMichael Stapelberg <michael@stapelberg.de>
Thu, 24 Jan 2013 14:22:00 +0000 (15:22 +0100)
No statistics are displayed with ad-hoc networks since none are available.

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';
         }
 
                 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
         /* 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