Input: xpad - don't depend on endpoint order
authorCameron Gutman <aicommander@gmail.com>
Wed, 4 Jan 2017 06:40:38 +0000 (22:40 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 26 Nov 2017 13:51:09 +0000 (13:51 +0000)
commitc59778f2b745d3dd5ce497d200ebdc303eaaabf6
tree57c695e0274cfb46dec78b3b47f7af0d46b05091
parent8e6535216c719085f1eea7a61c7512339f79a8fc
Input: xpad - don't depend on endpoint order

commit c01b5e7464f0cf20936d7467c7528163c4e2782d upstream.

The order of endpoints is well defined on official Xbox pads, but
we have found at least one 3rd-party pad that doesn't follow the
standard ("Titanfall 2 Xbox One controller" 0e6f:0165).

Fortunately, we get lucky with this specific pad because it uses
endpoint addresses that differ only by direction. We know that
there are other pads out where this is not true, so let's go
ahead and fix this.

Signed-off-by: Cameron Gutman <aicommander@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
[bwh: Backported to 3.2:
 - Use 'fail3' label in case of failure
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/input/joystick/xpad.c