Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Issue 307413004: Gamepad: cleanup mappings and add support for Samsung and PS3 gamepads (Closed)

Created:
6 years, 6 months ago by kbalazs
Modified:
6 years, 6 months ago
CC:
chromium-reviews, darin-cc_chromium.org, jam, SaurabhK
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Gamepad: cleanup mappings and add support for Samsung and PS3 gamepads The way we map axes does not look quite correct to me. We rely on the ordering in which InputDevice enumerates the motion ranges. There are several problems with that. First, I don't find any evidence in the documentation that there is a defined ordering. This means that InputDevice.getMotionRanges() does not guarantee to enumerate the axes in the same order on different devices or in different api versions. Second, this leads to using magic constants. Third, ideally one should be able to add the code for a new device or at least check if it is correct by looking at the Android specific documentation of the device. But those documentations refer to api constants like MotionEvent.AXIS_FOO instead of the index of the motion range. This CL cleans it up by storing the axes values associatively indexed by api constants, just like we do for buttons. Finally, it adds the device specific code for the Samsung and the PS3 gamepads. TEST=http://www.html5rocks.com/en/tutorials/doodles/gamepad/gamepad-tester/tester.html BUG=330094 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=275378

Patch Set 1 #

Total comments: 11

Patch Set 2 : fix axes on Shield and nits #

Unified diffs Side-by-side diffs Delta from patch set Stats (+166 lines, -104 lines) Patch
M content/public/android/java/src/org/chromium/content/browser/input/GamepadDevice.java View 1 4 chunks +13 lines, -22 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/input/GamepadMappings.java View 1 4 chunks +153 lines, -82 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
kbalazs
I believe I only made equivalent refactors for the XBox and Nvidia but I hope ...
6 years, 6 months ago (2014-06-03 21:07:01 UTC) #1
jdduke (slow)
Thanks for the update, this looks pretty reasonable to me. skhatri@, PTAL to make sure ...
6 years, 6 months ago (2014-06-03 22:10:46 UTC) #2
kbalazs
https://codereview.chromium.org/307413004/diff/1/content/public/android/java/src/org/chromium/content/browser/input/GamepadMappings.java File content/public/android/java/src/org/chromium/content/browser/input/GamepadMappings.java (right): https://codereview.chromium.org/307413004/diff/1/content/public/android/java/src/org/chromium/content/browser/input/GamepadMappings.java#newcode26 content/public/android/java/src/org/chromium/content/browser/input/GamepadMappings.java:26: } else if (deviceName.contains("Microsoft X-Box 360 pad")) { On ...
6 years, 6 months ago (2014-06-03 22:25:12 UTC) #3
SaurabhK
Sorry for the delay in reply. https://codereview.chromium.org/307413004/diff/1/content/public/android/java/src/org/chromium/content/browser/input/GamepadMappings.java File content/public/android/java/src/org/chromium/content/browser/input/GamepadMappings.java (right): https://codereview.chromium.org/307413004/diff/1/content/public/android/java/src/org/chromium/content/browser/input/GamepadMappings.java#newcode140 content/public/android/java/src/org/chromium/content/browser/input/GamepadMappings.java:140: mapRXAndRYAxesToRightStick(mappedAxes, rawAxes); SHield ...
6 years, 6 months ago (2014-06-05 15:20:26 UTC) #4
jdduke (slow)
https://codereview.chromium.org/307413004/diff/1/content/public/android/java/src/org/chromium/content/browser/input/GamepadMappings.java File content/public/android/java/src/org/chromium/content/browser/input/GamepadMappings.java (right): https://codereview.chromium.org/307413004/diff/1/content/public/android/java/src/org/chromium/content/browser/input/GamepadMappings.java#newcode42 content/public/android/java/src/org/chromium/content/browser/input/GamepadMappings.java:42: float a = rawButtons[KeyEvent.KEYCODE_BUTTON_A]; On 2014/06/03 22:25:11, kbalazs wrote: ...
6 years, 6 months ago (2014-06-05 15:22:21 UTC) #5
kbalazs
https://codereview.chromium.org/307413004/diff/1/content/public/android/java/src/org/chromium/content/browser/input/GamepadDevice.java File content/public/android/java/src/org/chromium/content/browser/input/GamepadDevice.java (right): https://codereview.chromium.org/307413004/diff/1/content/public/android/java/src/org/chromium/content/browser/input/GamepadDevice.java#newcode56 content/public/android/java/src/org/chromium/content/browser/input/GamepadDevice.java:56: List<MotionRange> ranges = inputDevice.getMotionRanges(); On 2014/06/03 22:10:46, jdduke wrote: ...
6 years, 6 months ago (2014-06-05 17:59:36 UTC) #6
jdduke (slow)
lgtm, thanks!
6 years, 6 months ago (2014-06-05 18:07:14 UTC) #7
kbalazs
The CQ bit was checked by b.kelemen@samsung.com
6 years, 6 months ago (2014-06-05 22:58:01 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/b.kelemen@samsung.com/307413004/20001
6 years, 6 months ago (2014-06-05 22:58:56 UTC) #9
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: ios_rel_device_ninja on tryserver.chromium ...
6 years, 6 months ago (2014-06-06 04:27:13 UTC) #10
commit-bot: I haz the power
6 years, 6 months ago (2014-06-06 10:34:46 UTC) #11
Message was sent while issue was closed.
Change committed as 275378

Powered by Google App Engine
This is Rietveld 408576698