diff options
author | 2013-07-17 13:21:45 -0700 | |
---|---|---|
committer | 2013-07-23 13:50:10 -0700 | |
commit | ac6c78b6eef49f5c1ab2a346d90ccb99ccec18f4 (patch) | |
tree | 18f7a2e4727360f0431697e995d865a8d2f8944d /services/input/InputReader.cpp | |
parent | 6944165014bf026e24aafe0cb359d7aad66bea7b (diff) |
Add controller numbers for gamepads / joysticks
Change-Id: I30ac9add6a2473a5ebd83a022c571545e61d1136
Diffstat (limited to 'services/input/InputReader.cpp')
-rw-r--r-- | services/input/InputReader.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp index 07731fc68425..feed31c40117 100644 --- a/services/input/InputReader.cpp +++ b/services/input/InputReader.cpp @@ -354,8 +354,9 @@ void InputReader::addDeviceLocked(nsecs_t when, int32_t deviceId) { InputDeviceIdentifier identifier = mEventHub->getDeviceIdentifier(deviceId); uint32_t classes = mEventHub->getDeviceClasses(deviceId); + int32_t controllerNumber = mEventHub->getDeviceControllerNumber(deviceId); - InputDevice* device = createDeviceLocked(deviceId, identifier, classes); + InputDevice* device = createDeviceLocked(deviceId, controllerNumber, identifier, classes); device->configure(when, &mConfig, 0); device->reset(when); @@ -395,10 +396,10 @@ void InputReader::removeDeviceLocked(nsecs_t when, int32_t deviceId) { delete device; } -InputDevice* InputReader::createDeviceLocked(int32_t deviceId, +InputDevice* InputReader::createDeviceLocked(int32_t deviceId, int32_t controllerNumber, const InputDeviceIdentifier& identifier, uint32_t classes) { InputDevice* device = new InputDevice(&mContext, deviceId, bumpGenerationLocked(), - identifier, classes); + controllerNumber, identifier, classes); // External devices. if (classes & INPUT_DEVICE_CLASS_EXTERNAL) { @@ -843,8 +844,8 @@ bool InputReaderThread::threadLoop() { // --- InputDevice --- InputDevice::InputDevice(InputReaderContext* context, int32_t id, int32_t generation, - const InputDeviceIdentifier& identifier, uint32_t classes) : - mContext(context), mId(id), mGeneration(generation), + int32_t controllerNumber, const InputDeviceIdentifier& identifier, uint32_t classes) : + mContext(context), mId(id), mGeneration(generation), mControllerNumber(controllerNumber), mIdentifier(identifier), mClasses(classes), mSources(0), mIsExternal(false), mDropUntilNextSync(false) { } @@ -995,7 +996,8 @@ void InputDevice::timeoutExpired(nsecs_t when) { } void InputDevice::getDeviceInfo(InputDeviceInfo* outDeviceInfo) { - outDeviceInfo->initialize(mId, mGeneration, mIdentifier, mAlias, mIsExternal); + outDeviceInfo->initialize(mId, mGeneration, mControllerNumber, mIdentifier, mAlias, + mIsExternal); size_t numMappers = mMappers.size(); for (size_t i = 0; i < numMappers; i++) { |