OSDN Git Service

sens : add poll_stop function to stop the polling output stream
[android-x86/hardware-intel-libsensors.git] / sens.c
diff --git a/sens.c b/sens.c
index 8a6f6cc..b7578eb 100644 (file)
--- 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 {