summaryrefslogtreecommitdiffstats
path: root/libsensors/GyroSensor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libsensors/GyroSensor.cpp')
-rw-r--r--libsensors/GyroSensor.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/libsensors/GyroSensor.cpp b/libsensors/GyroSensor.cpp
index 7d3a2d9..770afbd 100644
--- a/libsensors/GyroSensor.cpp
+++ b/libsensors/GyroSensor.cpp
@@ -80,16 +80,19 @@ int GyroSensor::setInitialState() {
int GyroSensor::enable(int32_t handle, int en) {
int flags = en ? 1 : 0;
- int err;
+ int fd;
if (flags != mEnabled) {
- if(err >= 0){
- mEnabled = flags;
- err = sspEnable(LOGTAG, SSP_GYRO, en);
- setInitialState();
-
- return 0;
- }
- return -1;
+ strcpy(&input_sysfs_path[input_sysfs_path_len], "enable");
+ fd = open(input_sysfs_path, O_RDWR);
+ if (fd >= 0){
+ write(fd, en == 1 ? "1" : "0", 2);
+ close(fd);
+ mEnabled = flags;
+ setInitialState();
+
+ return 0;
+ }
+ return -1;
}
return 0;
}