diff options
author | tilaksidduram <tilaksidduram@gmail.com> | 2016-04-13 21:31:01 +0530 |
---|---|---|
committer | tilaksidduram <tilaksidduram@gmail.com> | 2016-04-13 21:31:01 +0530 |
commit | 3c24870455d00278748e7d9c1272449f2204da2f (patch) | |
tree | 3057c91cca852cf265890b199f8f7dca3f2d4661 | |
parent | 5c57255274204141f462a6c3eca19b406f70b219 (diff) | |
download | device_samsung_n7100-3c24870455d00278748e7d9c1272449f2204da2f.zip device_samsung_n7100-3c24870455d00278748e7d9c1272449f2204da2f.tar.gz device_samsung_n7100-3c24870455d00278748e7d9c1272449f2204da2f.tar.bz2 |
n7100: libsensors: actually try enabling before checking if it worked
-rw-r--r-- | libsensors/GyroSensor.cpp | 21 |
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; } |