OSDN Git Service

Tweak Lenovo target for Jelly Bean
authorJim Bride <jim.bride@intel.com>
Thu, 12 Jul 2012 20:00:14 +0000 (13:00 -0700)
committerMattias Pettersson <mattias.pettersson@intel.com>
Wed, 4 Dec 2013 14:13:11 +0000 (15:13 +0100)
Change some logging stuff and tweak the location of the accelerometer
XML permissions file to make this target build correctly on Jelly
Bean.

Change-Id: Ic7e8ec9bf2044a07f635ec6a537df22e124c8258
Signed-off-by: Jim Bride <jim.bride@intel.com>
common/libsensors/SensorBase.cpp
common/libsensors/SensorInputDev.cpp
common/libsensors/sensors.cpp

index 8e3886c..202f8d1 100644 (file)
@@ -40,8 +40,8 @@ int64_t SensorBase::getTimestamp()
 int SensorBase::open()
 {
     mFd = ::open(mDevPath.c_str(), O_RDONLY);
 int SensorBase::open()
 {
     mFd = ::open(mDevPath.c_str(), O_RDONLY);
-    LOGE_IF(mFd < 0, "%s: device %s err:%d", __func__, mDevPath.c_str(), -errno);
-    LOGV("%s: device path:%s, fd:%d", __func__, mDevPath.c_str(), mFd);
+    ALOGE_IF(mFd < 0, "%s: device %s err:%d", __func__, mDevPath.c_str(), -errno);
+    ALOGV("%s: device path:%s, fd:%d", __func__, mDevPath.c_str(), mFd);
     return mFd;
 }
 
     return mFd;
 }
 
@@ -49,5 +49,5 @@ void SensorBase::close()
 {
     int ret = ::close(mFd);
     mFd = -1;
 {
     int ret = ::close(mFd);
     mFd = -1;
-    LOGV("%s: device path:%s, fd:%d", __func__, mDevPath.c_str(), mFd);
+    ALOGV("%s: device path:%s, fd:%d", __func__, mDevPath.c_str(), mFd);
 }
 }
index 0205acf..c561f81 100644 (file)
@@ -63,7 +63,7 @@ again:
                 count--;
                 numEventReceived++;
             }
                 count--;
                 numEventReceived++;
             }
-            LOGV("%s:%s:, in type = EV_SYN, after, count = %d, numEventReceived = %d, mEnabled = %d",
+            ALOGV("%s:%s:, in type = EV_SYN, after, count = %d, numEventReceived = %d, mEnabled = %d",
                  __func__, mDevPath.c_str(), count, numEventReceived, mEnabled);
         }
 
                  __func__, mDevPath.c_str(), count, numEventReceived, mEnabled);
         }
 
@@ -103,7 +103,7 @@ bool SensorInputDev::findInputDev(const std::string &inputName,
         if (fd < 0)
             continue;
 
         if (fd < 0)
             continue;
 
-        LOGV("%s: probing path %s against %s", __func__, (dev + "/" + de->d_name).c_str(), inputName.c_str());
+        ALOGV("%s: probing path %s against %s", __func__, (dev + "/" + de->d_name).c_str(), inputName.c_str());
         char readName[80];
         if (ioctl(fd, EVIOCGNAME(sizeof(readName) - 1), &readName) < 1)
                 readName[0] = '\0';
         char readName[80];
         if (ioctl(fd, EVIOCGNAME(sizeof(readName) - 1), &readName) < 1)
                 readName[0] = '\0';
@@ -113,14 +113,14 @@ bool SensorInputDev::findInputDev(const std::string &inputName,
         if (inputName.compare(readName) == 0) {
             foundPath = (dev + "/" + de->d_name);
             found = true;
         if (inputName.compare(readName) == 0) {
             foundPath = (dev + "/" + de->d_name);
             found = true;
-            LOGV("%s: found %s", __func__, foundPath.c_str());
+            ALOGV("%s: found %s", __func__, foundPath.c_str());
             break;
         }
     }
 
     closedir(dir);
 
             break;
         }
     }
 
     closedir(dir);
 
-    LOGE_IF(!found, "couldn't find '%s' input device", inputName.c_str());
+    ALOGE_IF(!found, "couldn't find '%s' input device", inputName.c_str());
 
     return found;
 }
 
     return found;
 }
index 6ff9e5c..7b4bdb2 100644 (file)
@@ -99,7 +99,7 @@ sensors_poll_context_t::sensors_poll_context_t()
 
     int wakeFds[2];
     int result = pipe(wakeFds);
 
     int wakeFds[2];
     int result = pipe(wakeFds);
-    LOGE_IF(result<0, "error creating wake pipe (%s)", strerror(errno));
+    ALOGE_IF(result<0, "error creating wake pipe (%s)", strerror(errno));
     fcntl(wakeFds[0], F_SETFL, O_NONBLOCK);
     fcntl(wakeFds[1], F_SETFL, O_NONBLOCK);
     mWritePipeFd = wakeFds[1];
     fcntl(wakeFds[0], F_SETFL, O_NONBLOCK);
     fcntl(wakeFds[1], F_SETFL, O_NONBLOCK);
     mWritePipeFd = wakeFds[1];
@@ -121,14 +121,14 @@ int sensors_poll_context_t::activate(int handle, int enabled) {
     int index = BoardConfig::handleToDriver(handle);
     if (index < 0) return index;
 
     int index = BoardConfig::handleToDriver(handle);
     if (index < 0) return index;
 
-    LOGD("%s: %s sensor %d", __func__, enabled?"enable":"disable", index);
+    ALOGD("%s: %s sensor %d", __func__, enabled?"enable":"disable", index);
     SensorBase* const s(mSensors[index]);
     int err = 0;
     if (enabled) {
         if (((err = s->open()) > 0) && (err = s->enable(1)) == 0) {
             const char wakeMessage(WAKE_MESSAGE);
             int result = write(mWritePipeFd, &wakeMessage, 1);
     SensorBase* const s(mSensors[index]);
     int err = 0;
     if (enabled) {
         if (((err = s->open()) > 0) && (err = s->enable(1)) == 0) {
             const char wakeMessage(WAKE_MESSAGE);
             int result = write(mWritePipeFd, &wakeMessage, 1);
-            LOGE_IF(result<0, "error sending wake message (%s)", strerror(errno));
+            ALOGE_IF(result<0, "error sending wake message (%s)", strerror(errno));
         } else
             s->close();
     } else {
         } else
             s->close();
     } else {
@@ -166,7 +166,7 @@ int sensors_poll_context_t::pollEvents(sensors_event_t* data, int count)
                     mPollFds[i].revents = 0;
 
                     if (nb < 0) {
                     mPollFds[i].revents = 0;
 
                     if (nb < 0) {
-                        LOGD("%s: handle:%d error:%d", __func__, i, nb);
+                        ALOGD("%s: handle:%d error:%d", __func__, i, nb);
                         continue;
                     }
                 }
                         continue;
                     }
                 }
@@ -182,14 +182,14 @@ int sensors_poll_context_t::pollEvents(sensors_event_t* data, int count)
             // anything to return
             n = poll(mPollFds, numFds, nbEvents ? 0 : POLL_TIMEOUT_MSEC);
             if (n<0) {
             // anything to return
             n = poll(mPollFds, numFds, nbEvents ? 0 : POLL_TIMEOUT_MSEC);
             if (n<0) {
-                LOGE("poll() failed (%s)", strerror(errno));
+                ALOGE("poll() failed (%s)", strerror(errno));
                 return -errno;
             }
             if (mPollFds[wake].revents & POLLIN) {
                 char msg;
                 int result = read(mPollFds[wake].fd, &msg, 1);
                 return -errno;
             }
             if (mPollFds[wake].revents & POLLIN) {
                 char msg;
                 int result = read(mPollFds[wake].fd, &msg, 1);
-                LOGE_IF(result<0, "error reading from wake pipe (%s)", strerror(errno));
-                LOGE_IF(msg != WAKE_MESSAGE, "unknown message on wake queue (0x%02x)", int(msg));
+                ALOGE_IF(result<0, "error reading from wake pipe (%s)", strerror(errno));
+                ALOGE_IF(msg != WAKE_MESSAGE, "unknown message on wake queue (0x%02x)", int(msg));
                 mPollFds[wake].revents = 0;
             }
         }
                 mPollFds[wake].revents = 0;
             }
         }