OSDN Git Service

GMINL-7944: Introduce internal sensor types for ALS
[android-x86/hardware-intel-libsensors.git] / sens.c
diff --git a/sens.c b/sens.c
index efb5811..8a6f6cc 100644 (file)
--- a/sens.c
+++ b/sens.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 Intel Corporation.
+ * Copyright (C) 2014-2015 Intel Corporation.
  */
 
 #include <stdio.h>
@@ -9,6 +9,7 @@
 #include <dlfcn.h>
 #include <pthread.h>
 #include <errno.h>
+#include <signal.h>
 
 #include <hardware/sensors.h>
 #include <utils/Log.h>
@@ -150,7 +151,7 @@ static void print_event(struct sensors_event_t *e)
                fprintf(f, "event: step_detector=%10.2f\n", e->data[0]);
                break;
        case SENSOR_TYPE_STEP_COUNTER:
-               fprintf(f, "event: step_detector=%llu\n",
+               fprintf(f, "event: step_counter=%llu\n",
                        (unsigned long long)e->u64.step_counter);
                break;
        }
@@ -176,8 +177,16 @@ static void run_sensors_poll_v0(void)
        }
 }
 
+static void sig_pipe(int sig)
+{
+       client = NULL;
+}
+
 static void *run_sensors_thread(void *arg __attribute((unused)))
 {
+
+       signal(SIGPIPE, sig_pipe);
+
        switch (dev->version) {
        case SENSORS_DEVICE_API_VERSION_0_1:
        default:
@@ -408,7 +417,6 @@ static int start_server(void)
                        fclose(f);
                }
 
-
                close(conn);
        }
 }
@@ -496,7 +504,7 @@ static int start_hal(int argc, char **argv)
 
 int main(int argc, char **argv)
 {
-       char cmd[1024], *tmp;
+       char cmd[1024];
        int sock, i;
        struct iovec buff = {
                .iov_base = cmd,