From 939087cec91bf3db72bb0b30ae42e3092b4c6292 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 14 Dec 2015 02:55:33 +0100 Subject: [PATCH] gluon-status-page-api: neighbours-batadv: use batman-adv-visdata, increase interval --- package/gluon-status-page-api/Makefile | 2 +- .../src/neighbours-batadv.c | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package/gluon-status-page-api/Makefile b/package/gluon-status-page-api/Makefile index 46c9e7d2..5b806331 100644 --- a/package/gluon-status-page-api/Makefile +++ b/package/gluon-status-page-api/Makefile @@ -12,7 +12,7 @@ define Package/gluon-status-page-api SECTION:=gluon CATEGORY:=Gluon TITLE:=API for gluon-status-page - DEPENDS:=+gluon-core +uhttpd +sse-multiplex +gluon-neighbour-info +gluon-announced +libiwinfo +libjson-c + DEPENDS:=+gluon-core +uhttpd +sse-multiplex +batman-adv-visdata +gluon-neighbour-info +gluon-announced +libiwinfo +libjson-c endef define Build/Prepare diff --git a/package/gluon-status-page-api/src/neighbours-batadv.c b/package/gluon-status-page-api/src/neighbours-batadv.c index 1fd62eaf..fb7be776 100644 --- a/package/gluon-status-page-api/src/neighbours-batadv.c +++ b/package/gluon-status-page-api/src/neighbours-batadv.c @@ -12,12 +12,10 @@ static json_object *neighbours(void) { FILE *f; - f = fopen("/sys/kernel/debug/batman_adv/bat0/originators" , "r"); + f = fopen("/tmp/batman-adv-visdata/bat0/originators" , "r"); - if (f == NULL) { - perror("Can not open bat0/originators"); - exit(1); - } + if (f == NULL) + return NULL; while (!feof(f)) { char mac1[18]; @@ -55,10 +53,12 @@ int main(void) { while (1) { obj = neighbours(); - printf("data: %s\n\n", json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PLAIN)); - fflush(stdout); - json_object_put(obj); - sleep(1); + if (obj) { + printf("data: %s\n\n", json_object_to_json_string_ext(obj, JSON_C_TO_STRING_PLAIN)); + fflush(stdout); + json_object_put(obj); + } + sleep(10); } return 0;