commit
ff6c029dba
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user