<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>27444</bug_id>
          
          <creation_ts>2014-11-26 14:34:46 +0000</creation_ts>
          <short_desc>Gamepad objects should have a dictionary of attributes about the controller and data source</short_desc>
          <delta_ts>2015-04-24 11:00:10 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>HISTORICAL - Gamepad</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ted Mielczarek [:ted]">ted</reporter>
          <assigned_to name="Ted Mielczarek [:ted]">ted</assigned_to>
          <cc>b.kelemen</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>mike</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>115514</commentid>
    <comment_count>0</comment_count>
    <who name="Ted Mielczarek [:ted]">ted</who>
    <bug_when>2014-11-26 14:34:46 +0000</bug_when>
    <thetext>A few weeks ago some interested parties had an informal meetup at the Mozilla office to discuss the issues surrounding the Gamepad API as-implemented. The biggest issue we noted is the inconsistent mapping of controls across browsers and operating systems. We talked at length about this, and it feels like a really hard problem to solve. A number of people have written content libraries to try to smooth this over (including myself and Scott):
https://github.com/luser/gamepadmapping.js
https://github.com/sgraham/gamepad.js
http://mozilla.github.io/galaxy.js/docs/galaxy.js.html#getGamepads

However, because of the differences across browsers and OSes the complexity blows up quickly. (Example: https://github.com/luser/gamepadmapping.js/blob/6dae0a5751df4acacfae2a5d3619758b7bb4bf43/gamepadmapping.js#L90 )

Specing things to remove this complexity might be possible, but it would be hard. We think as a stopgap we can make things better by simply exposing more information about the controller and the source of the data in a structured manner, to allow content libraries to make better choices.

Right now there&apos;s an &quot;id&quot; string on the Gamepad object that is basically unspecified (bug 25202). We should deprecate that in favor of a dictionary of useful attributes. My proposal would be something like this:

dictionary GamepadAttributes {
  unsigned short? vendorId;
  unsigned short? productId;
  DOMString name;
  GamepadDataSource dataSource;
};

enum GamepadDataSource {
  &quot;hid&quot;,
  &quot;xinput&quot;,
  &quot;linuxjoy&quot;,
  // other values
};

interface Gamepad {
  GamepadAttributes attributes; // Probably needs a better name
  ...
};

We&apos;d like to see how well we can do with content libraries if we give them better data, and this feels like it ought to be enough to work with.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115523</commentid>
    <comment_count>1</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-11-26 15:19:39 +0000</bug_when>
    <thetext>This should probably be an interface, not a dictionary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115524</commentid>
    <comment_count>2</comment_count>
    <who name="Ted Mielczarek [:ted]">ted</who>
    <bug_when>2014-11-26 15:24:11 +0000</bug_when>
    <thetext>I kind of wanted to leave some wiggle room for implementers to extend this, but I guess you can put arbitrary non-spec attributes on an object that claims to be a particular interface anyway, eh?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>115526</commentid>
    <comment_count>3</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-11-26 15:32:26 +0000</bug_when>
    <thetext>Indeed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>119883</commentid>
    <comment_count>4</comment_count>
    <who name="Ted Mielczarek [:ted]">ted</who>
    <bug_when>2015-04-24 11:00:10 +0000</bug_when>
    <thetext>Moved to https://github.com/w3c/gamepad/issues/12</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>