aboutsummaryrefslogtreecommitdiffstats
path: root/input-xpad-disconnect-all-wireless-controllers-at-init.patch
diff options
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-24 16:42:19 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-24 16:42:19 -0800
commit72145f96a0bb72231891d63309bbd1b586a8704b (patch)
tree43eb43c1ec04a417b9cdc689c25b2db380bce453 /input-xpad-disconnect-all-wireless-controllers-at-init.patch
parent798d88bf9ea205e79d015893b1f616d1de6ab039 (diff)
downloadpatches-72145f96a0bb72231891d63309bbd1b586a8704b.tar.gz
xpad patches
Diffstat (limited to 'input-xpad-disconnect-all-wireless-controllers-at-init.patch')
-rw-r--r--input-xpad-disconnect-all-wireless-controllers-at-init.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/input-xpad-disconnect-all-wireless-controllers-at-init.patch b/input-xpad-disconnect-all-wireless-controllers-at-init.patch
new file mode 100644
index 00000000000000..36cc4ae77aba77
--- /dev/null
+++ b/input-xpad-disconnect-all-wireless-controllers-at-init.patch
@@ -0,0 +1,73 @@
+From foo@baz Fri Jan 24 11:58:18 PST 2014
+Date: Fri, 24 Jan 2014 11:58:18 -0800
+To: Greg KH <gregkh@linuxfoundation.org>
+From: "Pierre-Loup A. Griffais" <pgriffais@valvesoftware.com>
+Subject: [PATCH] Input: xpad: disconnect all Wireless controllers at init
+
+From: "Pierre-Loup A. Griffais" <pgriffais@valvesoftware.com>
+
+We initializing the driver/device, we really don't know how many
+controllers are connected. So send a "disconnect all" command to the
+base-station, and let the user pair the controllers in the order in
+which they want them assigned.
+
+Note, this means we now do not "preallocate" all 4 devices when a single
+wireless base station is seen, but require the device to be properly
+connected to the base station before that can happen. The allocation of
+the device happens in the next patch, not here, so in a way, this patch
+breaks all wireless devices...
+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/joystick/xpad.c | 38 ++++++++++++++++++++++++++++++++++----
+ 1 file changed, 34 insertions(+), 4 deletions(-)
+
+--- a/drivers/input/joystick/xpad.c
++++ b/drivers/input/joystick/xpad.c
+@@ -1074,11 +1074,41 @@ static int xpad_probe(struct usb_interfa
+ usb_kill_urb(xpad->irq_in);
+ goto fail9;
+ }
++
++ /*
++ * We don't know how to check the controller state at driver
++ * load, so just disconnect them all, requiring the user to
++ * repair the device in the order they want them used. Good
++ * point is that we don't connect devices in "random" order,
++ * but the extra step seems a bit harsh as other operating
++ * systems don't require this at the moment.
++ *
++ * Power-off packet information came from an OS-X
++ * reverse-engineered driver located at:
++ * http://tattiebogle.net/index.php/ProjectRoot/Xbox360Controller/OsxDriver#toc1
++ */
++ mutex_lock(&xpad->odata_mutex);
++ xpad->odata[0] = 0x00;
++ xpad->odata[1] = 0x00;
++ xpad->odata[2] = 0x08;
++ xpad->odata[3] = 0xC0;
++ xpad->odata[4] = 0x00;
++ xpad->odata[5] = 0x00;
++ xpad->odata[6] = 0x00;
++ xpad->odata[7] = 0x00;
++ xpad->odata[8] = 0x00;
++ xpad->odata[9] = 0x00;
++ xpad->odata[10] = 0x00;
++ xpad->odata[11] = 0x00;
++ xpad->irq_out->transfer_buffer_length = 12;
++ usb_submit_urb(xpad->irq_out, GFP_KERNEL);
++ mutex_unlock(&xpad->odata_mutex);
++ } else {
++ xpad->pad_present = 1;
++ error = xpad_init_input(xpad);
++ if (error)
++ goto fail9;
+ }
+- xpad->pad_present = 1;
+- error = xpad_init_input(xpad);
+- if (error)
+- goto fail9;
+
+ return 0;
+