diff options
Diffstat (limited to 'libsensors/GyroSensor.cpp')
-rw-r--r-- | libsensors/GyroSensor.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libsensors/GyroSensor.cpp b/libsensors/GyroSensor.cpp index 5bccbc8..75a24ca 100644 --- a/libsensors/GyroSensor.cpp +++ b/libsensors/GyroSensor.cpp @@ -22,6 +22,7 @@ #include <dirent.h> #include <sys/select.h> #include <cutils/log.h> +#include <cstring> #include "GyroSensor.h" @@ -48,6 +49,7 @@ GyroSensor::GyroSensor() strcat(input_sysfs_path, input_name); strcat(input_sysfs_path, "/device/"); input_sysfs_path_len = strlen(input_sysfs_path); + enable(0, 1); } } @@ -77,11 +79,12 @@ int GyroSensor::setInitialState() { } int GyroSensor::enable(int32_t handle, int en) { + int flags = en ? 1 : 0; int err; - if (en != mEnabled) { + if (flags != mEnabled) { err = sspEnable(LOGTAG, SSP_GYRO, en); if(err >= 0){ - mEnabled = en; + mEnabled = flags; setInitialState(); return 0; @@ -99,7 +102,7 @@ int GyroSensor::setDelay(int32_t handle, int64_t ns) { int fd; - strcpy(&input_sysfs_path[input_sysfs_path_len], "gyro_poll_delay"); + strcpy(&input_sysfs_path[input_sysfs_path_len], "poll_delay"); fd = open(input_sysfs_path, O_RDWR); if (fd >= 0) { char buf[80]; |