Mac: Some gamepad axes read outside -1 to 1 range
Reported by
aicomman...@gmail.com,
Apr 30 2016
|
||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.86 Safari/537.36 Steps to reproduce the problem: 1. Connect an Nvidia Shield controller 2. Go to http://html5gamepad.com/ What is the expected behavior? All axis values should be within the range of -1 to 1, idling at 0. What went wrong? All analog stick axes idle at 65536 instead of 0. Values of axes go from 1 to 65536 to -1. This is both inverted (should start at -1) and outside the bounds of the HTML5 gamepad API. Did this work before? No Chrome version: 52.0.2721.0 Channel: canary OS Version: OS X 10.11.4 Flash Version: Shockwave Flash 21.0 r0 This issue affects the OUYA controller and Shield controller. The fix for this is two-fold. 1) Flip the reported logical min and max before normalization to invert the sign of the result. 2) The normalization calculations need to be performed on unsigned types matching the report size of the HID element.
,
May 1 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/7dac9dec172d28199da24e3084c6449284f12a90 commit 7dac9dec172d28199da24e3084c6449284f12a90 Author: aicommander <aicommander@gmail.com> Date: Sun May 01 00:01:17 2016 Fix broken normalization of some HID axes on OSX The OUYA and Nvidia Shield controllers report axes with a logical range of -1 to 0. The integer values returned by HID manager for these axes range from 0 to 65535. Without treating these logical ranges as unsigned, the normalization calculation yields incorrect results. Post-normalization, these special axes are also opposite of how the gamepad code expects them (1 to -1 instead of -1 to 1). This CL swaps logical min and max for these axes to invert the result of normalization. R=bajones@chromium.org BUG= 608170 TEST=HTML5 Gamepad API test with OUYA or Nvidia Shield controller Review-Url: https://codereview.chromium.org/1939613003 Cr-Commit-Position: refs/heads/master@{#390866} [modify] https://crrev.com/7dac9dec172d28199da24e3084c6449284f12a90/content/browser/gamepad/gamepad_platform_data_fetcher_mac.h [modify] https://crrev.com/7dac9dec172d28199da24e3084c6449284f12a90/content/browser/gamepad/gamepad_platform_data_fetcher_mac.mm
,
May 2 2016
|
||
►
Sign in to add a comment |
||
Comment 1 by aicomman...@gmail.com
, Apr 30 2016