summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2015-09-25 11:39:50 +0200
committerMichael Stapelberg <michael@stapelberg.de>2015-09-25 11:40:07 +0200
commitf3125fdfded91144cb9f5b9ea3bf406598f17321 (patch)
treed2de0d8ac700a0af570b10f2fa1c390c467f2163
parent06a133135f4dd0f0618cccd0c4d046f8d60c9790 (diff)
document code origins
fixes #65
-rw-r--r--src/print_wireless_info.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c
index 039ae19..48d81d4 100644
--- a/src/print_wireless_info.c
+++ b/src/print_wireless_info.c
@@ -100,6 +100,7 @@ static void print_bitrate(char *buffer, int buflen, int bitrate) {
snprintf(buffer, buflen, "%g %cb/s", rate / divisor, scale);
}
+// Based on NetworkManager/src/platform/wifi/wifi-utils-nl80211.c
static uint32_t nl80211_xbm_to_percent(int32_t xbm, uint32_t divisor) {
#define NOISE_FLOOR_DBM -90
#define SIGNAL_MAX_DBM -20
@@ -113,9 +114,9 @@ static uint32_t nl80211_xbm_to_percent(int32_t xbm, uint32_t divisor) {
return 100 - 70 * (((float)SIGNAL_MAX_DBM - (float)xbm) / ((float)SIGNAL_MAX_DBM - (float)NOISE_FLOOR_DBM));
}
-#define WLAN_EID_SSID 0
-
+// Based on NetworkManager/src/platform/wifi/wifi-utils-nl80211.c
static void find_ssid(uint8_t *ies, uint32_t ies_len, uint8_t **ssid, uint32_t *ssid_len) {
+#define WLAN_EID_SSID 0
*ssid = NULL;
*ssid_len = 0;