Query input device for initial slot index.

This fixes a problem where touches can get stuck because the
driver and the framework have different ideas of what the
initial slot index is.  The framework assumed it was slot 0
but it could in principle be any slot, such as slot 1.  When
that happened, the framework would start tracking the first
touch as slot 0, but it might never receive an "up" for that slot.

Change-Id: Idaffc4534b275d66b9d4360987b28dc2d0f63218
diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp
index 95b8a57..ca2540b 100644
--- a/services/input/EventHub.cpp
+++ b/services/input/EventHub.cpp
@@ -212,8 +212,8 @@
     struct input_absinfo info;
 
     if(ioctl(device->fd, EVIOCGABS(axis), &info)) {
-        LOGW("Error reading absolute controller %d for device %s fd %d\n",
-             axis, device->identifier.name.string(), device->fd);
+        LOGW("Error reading absolute controller %d for device %s fd %d, errno=%d",
+             axis, device->identifier.name.string(), device->fd, errno);
         return -errno;
     }
 
@@ -335,6 +335,33 @@
     return AKEY_STATE_UNKNOWN;
 }
 
+status_t EventHub::getAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t* outValue) const {
+    if (axis >= 0 && axis <= ABS_MAX) {
+        AutoMutex _l(mLock);
+
+        Device* device = getDeviceLocked(deviceId);
+        if (device != NULL) {
+            return getAbsoluteAxisValueLocked(device, axis, outValue);
+        }
+    }
+    *outValue = 0;
+    return -1;
+}
+
+status_t EventHub::getAbsoluteAxisValueLocked(Device* device, int32_t axis,
+        int32_t* outValue) const {
+    struct input_absinfo info;
+
+     if(ioctl(device->fd, EVIOCGABS(axis), &info)) {
+         LOGW("Error reading absolute controller %d for device %s fd %d, errno=%d",
+              axis, device->identifier.name.string(), device->fd, errno);
+         return -errno;
+     }
+
+     *outValue = info.value;
+     return OK;
+}
+
 bool EventHub::markSupportedKeyCodes(int32_t deviceId, size_t numCodes,
         const int32_t* keyCodes, uint8_t* outFlags) const {
     AutoMutex _l(mLock);