Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

HACK: sensors: hard code pollrate

pollrate coming from ICS userspace is too slow
need to track down why its setting it so slow.
possibly a unit conversion issue
  • Loading branch information...
commit 1237e4d8542dfb6655b2c53c063ec612aa0bb91d 1 parent 12a4865
Erik Hardesty dalingrin authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 libsensors/lsm303dlh_acc.cpp
10 libsensors/lsm303dlh_acc.cpp
View
@@ -27,7 +27,7 @@
#include "lsm303dlh_acc.h"
-#define POLL_RATE 200000000
+#define POLL_RATE 50000000 //50ms
Lsm303dlhGSensor::Lsm303dlhGSensor()
: SensorBase(LSM303DLH_ACC_DEVICE_NAME, "lsm303dlh_acc_sysfs"),
@@ -73,7 +73,7 @@ int Lsm303dlhGSensor::enable(int32_t handle, int en)
if (!err) {
mEnabled = newState;
- setDelay(0, POLL_RATE);
+ //setDelay(0, POLL_RATE);
}
return err;
@@ -87,19 +87,19 @@ int Lsm303dlhGSensor::setDelay(int32_t handle, int64_t ns)
if (ns < 0)
return -EINVAL;
- unsigned long delay = ns / 1000000; //nano to mili
-
// ok we need to set our enabled state
int fd = open(LSM303DLH_ACC_DELAY_FILE, O_WRONLY);
if(fd >= 0) {
char buffer[20];
- int bytes = sprintf(buffer, "%d\n", delay);
+ int bytes = sprintf(buffer, "%d\n", 100/*ns / (100 * 100)*/);
err = write(fd, buffer, bytes);
err = err < 0 ? -errno : 0;
} else {
err = -errno;
}
+ close(fd);
+
LOGE_IF(err < 0,
"Error setting delay of LSM303DLH accelerometer (%s)",
strerror(-err)); }
Please sign in to comment.
Something went wrong with that request. Please try again.