Merge pull request #3 from Vlaix/master

Fixed broken wifi
This commit is contained in:
Aaron Marcher 2016-03-09 10:53:27 +01:00
commit ff6c029dba

View file

@ -264,9 +264,12 @@ wifi_signal()
char path_end[11] = "/operstate";
char path[32];
char status[5];
char needle[sizeof wificard + 1];
FILE *fp;
/* generate the path name */
memset(path, 0, sizeof path);
strcat(path, path_start);
strcat(path, wificard);
strcat(path, path_end);
@ -295,10 +298,12 @@ wifi_signal()
}
/* extract the signal strength */
strcpy(needle, wificard);
strcat(needle, ":");
fgets(buf, bufsize, fp);
fgets(buf, bufsize, fp);
fgets(buf, bufsize, fp);
if ((datastart = strstr(buf, "wlp3s0:")) != NULL) {
if ((datastart = strstr(buf, needle)) != NULL) {
datastart = strstr(buf, ":");
sscanf(datastart + 1, " %*d %d %*d %*d %*d %*d %*d %*d %*d %*d", &strength);
}