Bug 165588 - Gamepad support shows wrong values for PS4 controllers (D-pad is missing)
Summary: Gamepad support shows wrong values for PS4 controllers (D-pad is missing)
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: Safari Technology Preview
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-12-07 20:14 PST by Gregg Tavares
Modified: 2017-01-26 11:23 PST (History)
3 users (show)

See Also:


Attachments
Patch (8.07 KB, patch)
2017-01-26 10:26 PST, Brady Eidson
no flags Details | Formatted Diff | Diff
Patch (9.57 KB, patch)
2017-01-26 11:00 PST, Brady Eidson
no flags Details | Formatted Diff | Diff
Patch (9.59 KB, patch)
2017-01-26 11:16 PST, Brady Eidson
achristensen: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gregg Tavares 2016-12-07 20:14:55 PST
Release 19 (Safari 10.1, WebKit 12603.1.14.2)

If you plug in a PS4 controller and go to 

http://html5gamepad.com/

You'll see there is no info for the DPad

Firefox 50 gets this correct. Chrome 57 also gets it correct. (Chrome 54 does not)
Comment 1 Brady Eidson 2016-12-08 10:10:05 PST
<rdar://problem/29578619>
Comment 2 Brady Eidson 2017-01-26 10:26:37 PST
Created attachment 299815 [details]
Patch
Comment 3 Alex Christensen 2017-01-26 10:39:21 PST
Comment on attachment 299815 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=299815&action=review

> Source/WebCore/platform/gamepad/mac/HIDGamepad.cpp:216
> +    *button++ = value < 2 || value == 7 ? 1.0 : 0.0;

This looks like there are no bounds checks.  Please do this another way.

> Source/WebCore/platform/gamepad/mac/HIDGamepad.h:138
> +    Vector<std::unique_ptr<HIDGamepadDPad>> m_dPads;

these could be UniqueRef.
Comment 4 Brady Eidson 2017-01-26 11:00:04 PST
Created attachment 299817 [details]
Patch
Comment 5 Brady Eidson 2017-01-26 11:16:30 PST
Created attachment 299824 [details]
Patch
Comment 6 Brady Eidson 2017-01-26 11:23:22 PST
https://trac.webkit.org/changeset/211220