summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeff Brown <jeffbrown@google.com> 2011-06-13 18:40:50 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2011-06-13 18:40:50 -0700
commitf2751aaedecf398b58f2d1eac3d78b54cbbd89eb (patch)
treeac471671e5ed6281ca2defdce09c8b886b6d1c1b
parenta934219ca8d23a63e5a9f443fafd6d4ac9847c71 (diff)
parentb3a2d1330716812784aee91b6d6275764b5e4210 (diff)
Merge "Take advantage of updated linux/input.h kernel headers."
-rw-r--r--services/input/EventHub.cpp1
-rw-r--r--services/input/EventHub.h35
-rw-r--r--services/input/InputReader.cpp9
-rw-r--r--services/input/tests/InputReader_test.cpp3
4 files changed, 10 insertions, 38 deletions
diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp
index 29add52c8af2..6e803a441356 100644
--- a/services/input/EventHub.cpp
+++ b/services/input/EventHub.cpp
@@ -192,6 +192,7 @@ status_t EventHub::getAbsoluteAxisInfo(int32_t deviceId, int axis,
outAxisInfo->maxValue = info.maximum;
outAxisInfo->flat = info.flat;
outAxisInfo->fuzz = info.fuzz;
+ outAxisInfo->resolution = info.resolution;
}
return OK;
}
diff --git a/services/input/EventHub.h b/services/input/EventHub.h
index 558959b1a968..abe1318206ff 100644
--- a/services/input/EventHub.h
+++ b/services/input/EventHub.h
@@ -34,39 +34,6 @@
#include <linux/input.h>
-/* These constants are not defined in linux/input.h in the version of the kernel
- * headers currently provided with Bionic. */
-
-#define EVIOCGPROP(len) _IOC(_IOC_READ, 'E', 0x09, len)
-
-#define INPUT_PROP_POINTER 0x00
-#define INPUT_PROP_DIRECT 0x01
-#define INPUT_PROP_BUTTONPAD 0x02
-#define INPUT_PROP_SEMI_MT 0x03
-#define INPUT_PROP_MAX 0x1f
-#define INPUT_PROP_CNT (INPUT_PROP_MAX + 1)
-
-#define ABS_MT_SLOT 0x2f
-#define ABS_MT_TOUCH_MAJOR 0x30
-#define ABS_MT_TOUCH_MINOR 0x31
-#define ABS_MT_WIDTH_MAJOR 0x32
-#define ABS_MT_WIDTH_MINOR 0x33
-#define ABS_MT_ORIENTATION 0x34
-#define ABS_MT_POSITION_X 0x35
-#define ABS_MT_POSITION_Y 0x36
-#define ABS_MT_TOOL_TYPE 0x37
-#define ABS_MT_BLOB_ID 0x38
-#define ABS_MT_TRACKING_ID 0x39
-#define ABS_MT_PRESSURE 0x3a
-#define ABS_MT_DISTANCE 0x3b
-
-#define MT_TOOL_FINGER 0
-#define MT_TOOL_PEN 1
-
-#define SYN_MT_REPORT 2
-#define SYN_DROPPED 3
-
-
/* Convenience constants. */
#define BTN_FIRST 0x100 // first button scancode
@@ -97,6 +64,7 @@ struct RawAbsoluteAxisInfo {
int32_t maxValue; // maximum value
int32_t flat; // center flat position, eg. flat == 8 means center is between -8 and 8
int32_t fuzz; // error tolerance, eg. fuzz == 4 means value is +/- 4 due to noise
+ int32_t resolution; // resolution in units per mm or radians per mm
inline void clear() {
valid = false;
@@ -104,6 +72,7 @@ struct RawAbsoluteAxisInfo {
maxValue = 0;
flat = 0;
fuzz = 0;
+ resolution = 0;
}
};
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index fcc619857c0a..15bb300d3bae 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -1044,8 +1044,8 @@ void InputMapper::fadePointer() {
void InputMapper::dumpRawAbsoluteAxisInfo(String8& dump,
const RawAbsoluteAxisInfo& axis, const char* name) {
if (axis.valid) {
- dump.appendFormat(INDENT4 "%s: min=%d, max=%d, flat=%d, fuzz=%d\n",
- name, axis.minValue, axis.maxValue, axis.flat, axis.fuzz);
+ dump.appendFormat(INDENT4 "%s: min=%d, max=%d, flat=%d, fuzz=%d, resolution=%d\n",
+ name, axis.minValue, axis.maxValue, axis.flat, axis.fuzz, axis.resolution);
} else {
dump.appendFormat(INDENT4 "%s: unknown range\n", name);
}
@@ -5656,9 +5656,10 @@ void JoystickInputMapper::dump(String8& dump) {
dump.appendFormat(INDENT4 " scale=%0.5f, offset=%0.5f, "
"highScale=%0.5f, highOffset=%0.5f\n",
axis.scale, axis.offset, axis.highScale, axis.highOffset);
- dump.appendFormat(INDENT4 " rawAxis=%d, rawMin=%d, rawMax=%d, rawFlat=%d, rawFuzz=%d\n",
+ dump.appendFormat(INDENT4 " rawAxis=%d, rawMin=%d, rawMax=%d, "
+ "rawFlat=%d, rawFuzz=%d, rawResolution=%d\n",
mAxes.keyAt(i), axis.rawAxisInfo.minValue, axis.rawAxisInfo.maxValue,
- axis.rawAxisInfo.flat, axis.rawAxisInfo.fuzz);
+ axis.rawAxisInfo.flat, axis.rawAxisInfo.fuzz, axis.rawAxisInfo.resolution);
}
}
diff --git a/services/input/tests/InputReader_test.cpp b/services/input/tests/InputReader_test.cpp
index d04c9e7db145..acda86bc74fe 100644
--- a/services/input/tests/InputReader_test.cpp
+++ b/services/input/tests/InputReader_test.cpp
@@ -481,7 +481,7 @@ public:
}
void addAbsoluteAxis(int32_t deviceId, int axis,
- int32_t minValue, int32_t maxValue, int flat, int fuzz) {
+ int32_t minValue, int32_t maxValue, int flat, int fuzz, int resolution = 0) {
Device* device = getDevice(deviceId);
RawAbsoluteAxisInfo info;
@@ -490,6 +490,7 @@ public:
info.maxValue = maxValue;
info.flat = flat;
info.fuzz = fuzz;
+ info.resolution = resolution;
device->absoluteAxes.add(axis, info);
}