summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wright <michaelwr@google.com>2013-07-23 20:52:42 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-07-23 20:52:42 +0000
commitf52ca32724edefc493663439d7fb76d8c9741488 (patch)
treeae71bd385a56f068d2f583942a49dbad74e9d714
parent4ffb7b1c9b373a3c9588159b7fd377399991e27f (diff)
parent0415d63b1adf15f6546fea902c66f8bd508afbfc (diff)
downloadframeworks_native-f52ca32724edefc493663439d7fb76d8c9741488.zip
frameworks_native-f52ca32724edefc493663439d7fb76d8c9741488.tar.gz
frameworks_native-f52ca32724edefc493663439d7fb76d8c9741488.tar.bz2
Merge "Add controller numbers for gamepads / joysticks"
-rw-r--r--include/input/InputDevice.h6
-rw-r--r--libs/input/InputDevice.cpp17
2 files changed, 12 insertions, 11 deletions
diff --git a/include/input/InputDevice.h b/include/input/InputDevice.h
index d8256c1..1419b45 100644
--- a/include/input/InputDevice.h
+++ b/include/input/InputDevice.h
@@ -67,10 +67,11 @@ public:
float resolution;
};
- void initialize(int32_t id, int32_t generation, const InputDeviceIdentifier& identifier,
- const String8& alias, bool isExternal);
+ void initialize(int32_t id, int32_t generation, int32_t controllerNumber,
+ const InputDeviceIdentifier& identifier, const String8& alias, bool isExternal);
inline int32_t getId() const { return mId; }
+ inline int32_t getControllerNumber() const { return mControllerNumber; }
inline int32_t getGeneration() const { return mGeneration; }
inline const InputDeviceIdentifier& getIdentifier() const { return mIdentifier; }
inline const String8& getAlias() const { return mAlias; }
@@ -111,6 +112,7 @@ public:
private:
int32_t mId;
int32_t mGeneration;
+ int32_t mControllerNumber;
InputDeviceIdentifier mIdentifier;
String8 mAlias;
bool mIsExternal;
diff --git a/libs/input/InputDevice.cpp b/libs/input/InputDevice.cpp
index 54703d4..b11110a 100644
--- a/libs/input/InputDevice.cpp
+++ b/libs/input/InputDevice.cpp
@@ -127,26 +127,25 @@ String8 getInputDeviceConfigurationFilePathByName(
// --- InputDeviceInfo ---
InputDeviceInfo::InputDeviceInfo() {
- initialize(-1, -1, InputDeviceIdentifier(), String8(), false);
+ initialize(-1, 0, -1, InputDeviceIdentifier(), String8(), false);
}
InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other) :
- mId(other.mId), mGeneration(other.mGeneration), mIdentifier(other.mIdentifier),
- mAlias(other.mAlias), mIsExternal(other.mIsExternal), mSources(other.mSources),
- mKeyboardType(other.mKeyboardType),
- mKeyCharacterMap(other.mKeyCharacterMap),
- mHasVibrator(other.mHasVibrator),
- mHasButtonUnderPad(other.mHasButtonUnderPad),
- mMotionRanges(other.mMotionRanges) {
+ mId(other.mId), mGeneration(other.mGeneration), mControllerNumber(other.mControllerNumber),
+ mIdentifier(other.mIdentifier), mAlias(other.mAlias), mIsExternal(other.mIsExternal),
+ mSources(other.mSources), mKeyboardType(other.mKeyboardType),
+ mKeyCharacterMap(other.mKeyCharacterMap), mHasVibrator(other.mHasVibrator),
+ mHasButtonUnderPad(other.mHasButtonUnderPad), mMotionRanges(other.mMotionRanges) {
}
InputDeviceInfo::~InputDeviceInfo() {
}
-void InputDeviceInfo::initialize(int32_t id, int32_t generation,
+void InputDeviceInfo::initialize(int32_t id, int32_t generation, int32_t controllerNumber,
const InputDeviceIdentifier& identifier, const String8& alias, bool isExternal) {
mId = id;
mGeneration = generation;
+ mControllerNumber = controllerNumber;
mIdentifier = identifier;
mAlias = alias;
mIsExternal = isExternal;