From: Razvan Stamate Date: Thu, 23 Apr 2015 13:27:12 +0000 (+0300) Subject: sens : add poll_stop function to stop the polling output stream X-Git-Tag: android-x86-7.1-r1~19^2~2 X-Git-Url: http://git.osdn.net/view?p=android-x86%2Fhardware-intel-libsensors.git;a=commitdiff_plain;h=0aa1bbb sens : add poll_stop function to stop the polling output stream Change-Id: Id332d8db8dda0098f422835e6e7c246933a44cf3 Signed-off-by: Razvan Stamate --- diff --git a/sens.c b/sens.c index 8a6f6cc..b7578eb 100644 --- a/sens.c +++ b/sens.c @@ -20,6 +20,7 @@ int usage(void) fprintf(stderr, "sens [activate | deactivate] sensor_id\n"); fprintf(stderr, "sens set_delay sensor_id delay\n"); fprintf(stderr, "sens poll\n"); + fprintf(stderr, "sens poll_stop\n"); return 1; } @@ -312,6 +313,15 @@ static int dispatch_cmd(char *cmd, FILE *f) pthread_mutex_unlock(&client_mutex); return 1; + } else if (!strcmp(argv[0], "poll_stop")) { + pthread_mutex_lock(&client_mutex); + if (client){ + fclose(client); + client = NULL; + } + pthread_mutex_unlock(&client_mutex); + + return 1; } else if (!strcmp(argv[0], "stop")) { exit(1); } else {