corrected input master
authorPaul Kocialkowski <contact@paulk.fr>
Sat, 23 Feb 2013 10:10:51 +0000 (11:10 +0100)
committerPaul Kocialkowski <contact@paulk.fr>
Sat, 23 Feb 2013 10:10:51 +0000 (11:10 +0100)
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
input.c
piranha_sensors.c

diff --git a/input.c b/input.c
index 1f8a427..20dcbc7 100644 (file)
--- a/input.c
+++ b/input.c
@@ -44,6 +44,7 @@ int input_open(char *name)
 
        char input_name[80] = { 0 };
        char path[PATH_MAX];
+       char *c;
        int fd;
        int rc;
 
@@ -67,6 +68,10 @@ int input_open(char *name)
                if (rc < 0)
                        continue;
 
+               c = strstr(&input_name, "\n");
+               if (c != NULL)
+                       *c = '\0';
+
                if (strcmp(input_name, name) == 0)
                        return fd;
                else
@@ -83,6 +88,7 @@ int sysfs_path_prefix(char *name, char *path_prefix)
 
        char input_name[80] = { 0 };
        char path[PATH_MAX];
+       char *c;
        int fd;
 
        if (name == NULL || path_prefix == NULL)
@@ -105,7 +111,11 @@ int sysfs_path_prefix(char *name, char *path_prefix)
                read(fd, &input_name, sizeof(input_name));
                close(fd);
 
-               if (strncmp(input_name, name, strlen(name)) == 0) {
+               c = strstr(&input_name, "\n");
+               if (c != NULL)
+                       *c = '\0';
+
+               if (strcmp(input_name, name) == 0) {
                        snprintf(path_prefix, PATH_MAX, "/sys/class/input/%s", di->d_name);
                        return 0;
                }
index 5c1532c..abaf789 100644 (file)
@@ -40,7 +40,7 @@ struct sensor_t piranha_sensors[] = {
        { "YAS530 Magnetic Sensor", "Yamaha", 1, SENSOR_TYPE_MAGNETIC_FIELD,
                SENSOR_TYPE_MAGNETIC_FIELD, 800.0f, 0.3f, 4.0f, 10000, {}, },
        { "YAS Orientation Sensor", "Yamaha", 1, SENSOR_TYPE_ORIENTATION,
-               SENSOR_TYPE_ORIENTATION, 360.0f, 1.0f, 0.0f, 10000, {}, },
+               SENSOR_TYPE_ORIENTATION, 360.0f, 0.1f, 0.0f, 10000, {}, },
        { "BH1721 Light Sensor", "ROHM", 1, SENSOR_TYPE_LIGHT,
                SENSOR_TYPE_LIGHT, 0.0f, 0.0f, 0.0f, 0, {}, },
 };
@@ -175,6 +175,7 @@ int piranha_sensors_poll(struct sensors_poll_device_t *dev,
                                }
                        }
 
+                       device->poll_fds[i].revents = 0;
                }
        }