Last Comment Bug 878828 - finalize and enable Gamepad API
: finalize and enable Gamepad API
Status: VERIFIED FIXED
[games:p1]
: dev-doc-complete, feature
Product: Core
Classification: Components
Component: DOM: Events (show other bugs)
: unspecified
: All All
: -- normal (vote)
: mozilla28
Assigned To: Ted Mielczarek [:ted.mielczarek]
: Alexandra Lucinet, QA Mentor [:adalucinet][PTO: 21st June - 5th July]
Mentors:
: 878903 (view as bug list)
Depends on: 604039 851547 921565 926091 936104 963053 980876 985967
Blocks: gecko-games html5test 901284
  Show dependency treegraph
 
Reported: 2013-06-03 08:31 PDT by Vladimir Vukicevic [:vlad] [:vladv]
Modified: 2014-12-13 11:23 PST (History)
19 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
disabled
fixed
29+


Attachments
Enable Gamepad API by default (1.41 KB, patch)
2013-12-06 04:39 PST, Ted Mielczarek [:ted.mielczarek]
bugs: review+
bugs: superreview+
Details | Diff | Review

Description Vladimir Vukicevic [:vlad] [:vladv] 2013-06-03 08:31:57 PDT
We need to finalize the Gamepad API and get it enabled everywhere.  We're close, but there's a mess currently.
Comment 1 Ted Mielczarek [:ted.mielczarek] 2013-06-03 09:16:00 PDT
I have a bunch of outstanding patches and spec work I need to finish up. In no particular order, here are the ones I can remember off the top of my head:

Patches:
bug 851547 - make Gamepad API preffable. Waiting on a patch from smaug so that it can make the event types not visible to content
bug 860413 - allow setting standard mapping
bug 860409 - Allow passing both an analog and digital value for buttons
bug 690937 - XInput backend for Windows
(unfiled)  - hook up gamepad mappings from a static list

Spec work:
* Figure out how to expose analog+digital buttons
* Figure out how to expose button names
* Spec buttonpress/release events
* https://www.w3.org/Bugs/Public/show_bug.cgi?id=21434 - Spec liveness of Gamepad objects
* Might want to change spec to use navigator.gamepads.get() instead of navigator.getGamepads()
Comment 2 Mardeg 2013-06-03 11:26:47 PDT
*** Bug 878903 has been marked as a duplicate of this bug. ***
Comment 3 Olli Pettay [:smaug] (high review load, please consider other reviewers) 2013-06-03 11:44:07 PDT
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #1)
> bug 851547 - make Gamepad API preffable. Waiting on a patch from smaug so
> that it can make the event types not visible to content
My patch to let generated events to use webidl is still waiting for review.
Comment 4 Ted Mielczarek [:ted.mielczarek] 2013-06-12 11:21:33 PDT
bug 690935 is navigator.getGamepads().
Comment 5 Ted Mielczarek [:ted.mielczarek] 2013-06-21 07:19:46 PDT
I buckled down and got a bunch of those landed. We can ship it preffed off in 24 now, which is an improvement (since people can actually test it in release builds).

I'd still like to get XInput landed, and there's another bug (maybe not filed) about how we don't currently notice DirectInput devices being connected or disconnected on Windows that we really ought to fix.

I would like to get a few of those spec issues nailed down before we commit to shipping it preffed on.
Comment 6 Martin Best (:mbest) 2013-07-07 11:00:25 PDT
Is this still shipping prefed off in 24?
Comment 7 Ted Mielczarek [:ted.mielczarek] 2013-07-08 03:51:43 PDT
Yes, it's behind the dom.gamepad.enabled pref.
Comment 8 José Jeria 2013-07-30 08:06:21 PDT
Shouldnt this be added to the release notes? Aurora release notes does not currently display this:
http://www.mozilla.org/en-US/firefox/24.0a2/auroranotes/
Comment 9 Ted Mielczarek [:ted.mielczarek] 2013-07-30 08:23:08 PDT
It's behind a pref at the moment, but we could relnote it.
Comment 10 Florian Bender 2013-10-11 11:40:26 PDT
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #1)
> bug 690937 - XInput backend for Windows
> (unfiled)  - hook up gamepad mappings from a static list

These are not in the dependancy list (others as well, but they're fixed now). Can somebody add them, please (and file the missing bug)?

Also, are there still changes expected for the API (i.e. how stable is the API)? I'm asking because of Bug 802882 and I may file a bug for HTML5Test.com to exclude the API from the current (upcoming) set of tests (at least exclude it from counting towards the total score).
Comment 11 Ted Mielczarek [:ted.mielczarek] 2013-10-12 11:11:28 PDT
The two open blockers are the only things we need to fix to ship this. Anything else is just gravy.
Comment 12 Ted Mielczarek [:ted.mielczarek] 2013-12-06 04:24:32 PST
I landed a patch for 936104, so I think I'd be pretty comfortable with enabling the Gamepad API by default in Firefox 28.
Comment 13 Ted Mielczarek [:ted.mielczarek] 2013-12-06 04:26:07 PST
(In reply to Florian Bender from comment #10)
> Also, are there still changes expected for the API (i.e. how stable is the
> API)? I'm asking because of Bug 802882 and I may file a bug for
> HTML5Test.com to exclude the API from the current (upcoming) set of tests
> (at least exclude it from counting towards the total score).

bug 926091 was the last breaking change I intend to make to the spec, it changed Gamepad.buttons[] to be an array of GamepadButton instead of just double. Any future spec changes should be backwards-compatible.
Comment 14 Ted Mielczarek [:ted.mielczarek] 2013-12-06 04:39:05 PST
Created attachment 8343701 [details] [diff] [review]
Enable Gamepad API by default

Here's the simple patch that enables the Gamepad API by default.
Comment 15 Ted Mielczarek [:ted.mielczarek] 2013-12-06 04:49:44 PST
I posted an intent to ship message to dev.platform:
https://groups.google.com/forum/#!topic/mozilla.dev.platform/JjuTCr2VYUA
Comment 16 Ted Mielczarek [:ted.mielczarek] 2013-12-06 04:55:12 PST
Comment on attachment 8343701 [details] [diff] [review]
Enable Gamepad API by default

smaug suggested that this might want a superreview? I'm not sure what the current policy is.
Comment 17 Florian Bender 2013-12-06 12:21:16 PST
Alright, thanks for the info!
Comment 18 Olli Pettay [:smaug] (high review load, please consider other reviewers) 2013-12-06 13:55:11 PST
Comment on attachment 8343701 [details] [diff] [review]
Enable Gamepad API by default

I was thinking this kind of sr :)

As far as I know, we could enable the API.
Comment 19 Ted Mielczarek [:ted.mielczarek] 2013-12-07 07:36:13 PST
https://hg.mozilla.org/integration/mozilla-inbound/rev/3bc9cffda68a
Comment 20 Phil Ringnalda (:philor) 2013-12-07 15:12:21 PST
https://hg.mozilla.org/mozilla-central/rev/3bc9cffda68a
Comment 21 Chris Mills (Mozilla, MDN editor) [:cmills] 2013-12-10 00:18:04 PST
We already have this:

https://developer.mozilla.org/en-US/docs/API/Gamepad/Using_Gamepad_API

Not sure how up to date it is.
Comment 22 Ted Mielczarek [:ted.mielczarek] 2013-12-10 04:18:48 PST
It's a bit out of date, but it could be fixed to be useful. The events are now just "gamepadconnected" and "gamepaddisconnected". The button/axis events are not currently in the spec. The Gamepad object has a few more properties, and the buttons property is slightly different. The whole "DOM implementation" section is no longer accurate (and of questionable utility anyway).

You can refer to the latest editor's draft of the spec for more:
https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html
Comment 23 Ted Mielczarek [:ted.mielczarek] 2013-12-10 04:39:30 PST
I also have a draft Hacks article that's 95% complete that we should be publishing this week.
Comment 24 Chris Mills (Mozilla, MDN editor) [:cmills] 2013-12-10 08:00:20 PST
Thanks for the info Ted; I'll start working on the guide update and API reference pages for this straight away.

For testing purposes, I've found out my old PS2 controller, and now I'm guessing I just need to buy a PS2 -> USB adaptor. None of them mention Mac support - will they 'just work' on Mac? Are some of them better than others?

(In reply to Ted Mielczarek [:ted.mielczarek] from comment #22)
> It's a bit out of date, but it could be fixed to be useful. The events are
> now just "gamepadconnected" and "gamepaddisconnected". The button/axis
> events are not currently in the spec. The Gamepad object has a few more
> properties, and the buttons property is slightly different. The whole "DOM
> implementation" section is no longer accurate (and of questionable utility
> anyway).
> 
> You can refer to the latest editor's draft of the spec for more:
> https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html
Comment 25 Ted Mielczarek [:ted.mielczarek] 2013-12-10 08:08:02 PST
Almost any USB controller will "just work" on Mac, Windows or Linux. The biggest current exception is the PS3 DualShock 3 controller, which doesn't have a driver for Windows, and may not work out of the box on Mac. Wired Xbox 360 controllers work fine everywhere, wireless ones need an adapter (that you can still buy but isn't manufactured anymore, AFAIK). Any dirt-cheap USB gamepad you can buy anywhere has a high probability of working fine.
Comment 26 Chris Mills (Mozilla, MDN editor) [:cmills] 2014-01-06 07:25:57 PST
I have updated the Gamepad API guide to be more up to date:

https://developer.mozilla.org/en-US/docs/Web/Guide/API/Gamepad

Quite a bit of it is stolen out of your MDN article, because the examples there are very concise and nicely written ;-) My PS2 controller was giving some funny results, but I think it might be slightly dodgy; I have ordered a new Wired XBox 360 controller so I can do a comparison and check what's going on.

Let me know if these is anything obviously wrong. I'll be adding some more examples soon.

Next step will be to create a proper API reference. I'll keep going.
Comment 27 Chris Mills (Mozilla, MDN editor) [:cmills] 2014-01-06 10:11:29 PST
Draft landing page for the whole API:

https://developer.mozilla.org/en-US/docs/Gamepad
Comment 28 Alexandra Lucinet, QA Mentor [:adalucinet][PTO: 21st June - 5th July] 2014-01-31 05:47:09 PST
Tested Gamepad feature for pre-beta sign off on latest Aurora (Build ID: 20140122004004) on: Windows 7 64bit, Windows XP 64bit, Mac OSX 10.9 and Ubuntu 13.10 32bit.
Comment 29 Anthony Hughes (:ashughes) [GFX][QA][Mentor] 2014-03-10 18:02:16 PDT
Updating status flags as per:
http://hg.mozilla.org/releases/mozilla-release/file/c6c843644fbf
Comment 30 Anthony Hughes (:ashughes) [GFX][QA][Mentor] 2014-03-10 18:02:47 PDT
(In reply to Anthony Hughes, QA Mentor (:ashughes) from comment #29)
> Updating status flags as per:
> http://hg.mozilla.org/releases/mozilla-release/file/c6c843644fbf

Not sure whether relnote should be changed in kind.
Comment 31 Chris Mills (Mozilla, MDN editor) [:cmills] 2014-03-11 01:04:10 PDT
Gamepad API reference docs need a technical review:

https://developer.mozilla.org/en-US/docs/Gamepad

Could someone check these out for me? thanks in advance ;-)
Comment 32 Alexandra Lucinet, QA Mentor [:adalucinet][PTO: 21st June - 5th July] 2014-03-11 05:05:04 PDT
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:28.0) Gecko/20100101 Firefox/28.0
Mozilla/5.0 (X11; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:28.0) Gecko/20100101 Firefox/28.0

Gamepad API is properly disabled on Firefox 28 RC (Build ID: 20140310174439): dom.gamepad.enabled is set to false by default.
Comment 33 Lukas Blakk [:lsblakk] use ?needinfo 2014-03-13 12:13:30 PDT
We're going to remove the Gamepad API note as it has been disabled, so this will go back to FF29

Note You need to log in before you can comment on or make changes to this bug.