14 if ((dir
= opendir ("/sys/kernel/debug/ieee80211/")) != NULL
) {
15 printf("{\"data\":[");
16 while ((ent
= readdir (dir
)) != NULL
) {
17 if (strcmp(".", ent
->d_name
) && strcmp("..", ent
->d_name
)) {
20 printf("{\"{#PHY}\":\"%s\"}", ent
->d_name
);
33 int get_param(char *phy
, char *stat
)
35 char *filename
= NULL
;
38 stat
= basename(stat
);
39 if (asprintf(&filename
, "/sys/kernel/debug/ieee80211/%s/statistics/%s", phy
, stat
) > 0)
40 f
= fopen(filename
, "r");
44 while (fgets(temp
, 256, f
) != NULL
)
58 fprintf(stderr
, "Usage:\n");
59 fprintf(stderr
, " %s discovery\n", name
);
60 fprintf(stderr
, " => print mac80211.phydiscovery discovery rule\n");
61 fprintf(stderr
, " %s PHY STAT\n", name
);
62 fprintf(stderr
, " => cat /sys/kernel/debug/ieee80211/PHY/statistics/STAT as root\n");
66 int main(int argc
, char *argv
[])
73 return get_param(argv
[1], argv
[2]);
75 return usage(argv
[0]);