summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libsensors/GyroSensor.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/libsensors/GyroSensor.cpp b/libsensors/GyroSensor.cpp
index 770afbd..75a24ca 100644
--- a/libsensors/GyroSensor.cpp
+++ b/libsensors/GyroSensor.cpp
@@ -80,19 +80,16 @@ int GyroSensor::setInitialState() {
int GyroSensor::enable(int32_t handle, int en) {
int flags = en ? 1 : 0;
- int fd;
+ int err;
if (flags != mEnabled) {
- 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;
+ err = sspEnable(LOGTAG, SSP_GYRO, en);
+ if(err >= 0){
+ mEnabled = flags;
+ setInitialState();
+
+ return 0;
+ }
+ return -1;
}
return 0;
}