summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2010-09-22 19:59:48 +0200
committerMichael Stapelberg <michael@stapelberg.de>2010-09-22 19:59:48 +0200
commitaf5fd7b77ea00d6c1390e70310d51828016ab2b0 (patch)
tree358bd9f22570ebc8db4a920cabd464d6fa1c1cfa /src
parentfac05bf4e8368ddf8fa43f97d199c7a486441d1d (diff)
Implement displaying the wireless connection speed (Thanks Felicitus)
Based on a patch by Felicitus.
Diffstat (limited to 'src')
-rw-r--r--src/print_wireless_info.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c
index 60eb906..3a96b86 100644
--- a/src/print_wireless_info.c
+++ b/src/print_wireless_info.c
@@ -25,6 +25,7 @@ typedef struct {
int signal_level_max;
int noise_level;
int noise_level_max;
+ int bitrate;
} wireless_info_t;
static int get_wireless_info(const char *interface, wireless_info_t *info) {
@@ -132,6 +133,10 @@ static int get_wireless_info(const char *interface, wireless_info_t *info) {
}
}
+ struct iwreq wrq;
+ if (iw_get_ext(skfd, interface, SIOCGIWRATE, &wrq) >= 0)
+ info->bitrate = wrq.u.bitrate.value;
+
close(skfd);
return 1;
#endif
@@ -210,6 +215,15 @@ void print_wireless_info(const char *interface, const char *format_up, const cha
else (void)printf("no IP");
walk += strlen("ip");
}
+
+ if (BEGINS_WITH(walk+1, "bitrate")) {
+ char buffer[128];
+
+ iw_print_bitrate(buffer, sizeof(buffer), info.bitrate);
+
+ printf("%s", buffer);
+ walk += strlen("bitrate");
+ }
}
(void)printf("%s", endcolor());