summaryrefslogtreecommitdiff
path: root/drivers/input/joystick/xpad.c
AgeCommit message (Collapse)Author
2015-10-19Input: xpad - fix clash of presence handling with LED settingPavel Rojtberg
Do not call xpad_identify_controller at init with wireless devices: it conflicts with the already sent presence packet and will be called by xpad360w_process_packet as needed anyway. Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-10-10Input: xpad - query wireless controller state at initPavel Rojtberg
When we initialize the driver/device, we really don't know how many controllers are connected. So send a "query presence" command to the base-station. (Command discovered by Zachary Lund) Presence packet taken from: https://github.com/computerquip/xpad5 Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-10-10Input: xpad - move the input device creation to a new functionPierre-Loup A. Griffais
To allow us to later create / destroy the input device from the urb callback, we need to initialize/ deinitialize the input device from a separate function. So pull that logic out now to make later patches more "obvious" as to what they do. Signed-off-by: "Pierre-Loup A. Griffais" <pgriffais@valvesoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-10-10Input: xpad - x360w: report dpad as buttons and axesPavel Rojtberg
as discussed here[0], x360w is the only pad that maps dpad_to_button. This is bad for downstream developers as they have to differ between x360 and x360w which is not intuitive. This patch implements the suggested solution of exposing the dpad both as axes and as buttons. This retains backward compatibility with software already dealing with the difference while makes new software work as expected across x360/ x360w pads. [0] http://www.spinics.net/lists/linux-input/msg34421.html Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-10-10Input: xpad - factor out URB submission in xpad_play_effectPavel Rojtberg
Move submission logic to a single point at the end of the function. This makes it easy to add locking/ queuing code later on. Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-10-10Input: xpad - remove needless bulk out URB used for LED setupPavel Rojtberg
This code was probably wrong ever since and is redundant with xpad_send_led_command. Both try to send a similar command to the xbox360 controller. However xpad_send_led_command correctly uses the pad_nr instead of bInterfaceNumber to select the led and re-uses the irq_out URB instead of creating a new one. Note that this change only affects the two supported wireless controllers. Tested using the xbox360 wireless controller (PC). Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-10-10Input: xpad - use ida() for finding the pad_nrPavel Rojtberg
The pad_nr corresponds to the lit up LED on the controller. Therefore there should be no gaps when enumerating. Currently a LED is only re-assigned after a controller is re-connected 4 times. This patch uses ida to track connected pads - this way we can re-assign freed up pad number immediately. Consider the following case: 1. pad A is connected and gets pad_nr = 0 2. pad B is connected and gets pad_nr = 1 3. pad A is disconnected 4. pad A is connected again using ida_simple_get() controller A now correctly gets pad_nr = 0 again. Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-10-10Input: xpad - clarify LED enumerationPavel Rojtberg
Rename led_no -> pad_nr: the number stored there is not the LED number - it gets translated later on to a LED number in xpad_identify_controller; Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-10-10Input: xpad - fix Razer Atrox Arcade Stick button mappingDario Scarpa
The "Razer Atrox Arcade Stick" features 10 buttons, and two of them (LT/RT) don't work properly. Change its definition in xpad_device[] (mapping field) to fix. Signed-off-by: Dario Scarpa <dario.scarpa@duskzone.it> Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-10-10Input: xpad - add Covert Forces edition of the Xbox One controllerErik Lundgren
It is identical to the Xbox One controller but has a different product ID. Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-06-22Input: xpad - re-send LED command on present eventPavel Rojtberg
The controller only receives commands when its present. So for the correct LED to be lit the LED command has to be sent on the present event. Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-06-22Input: xpad - set the LEDs properly on XBox Wireless controllersPierre-Loup A. Griffais
Based on Patch by Pierre-Loup A. Griffais <pgriffais@valvesoftware.com>: Add the logic to set the LEDs on XBox Wireless controllers. Command sequence found by sniffing the Windows data stream when plugging the device in. Updated based on comments on linux-input: unify codepaths in xpad_send_led_command for wired/ wireless controller. Also document command values for clarification. All values tested on Xbox 360 Wireless Controller. Signed-off-by: Pavel Rojtberg <rojtberg@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2015-04-14Input: xpad - add rumble support for Xbox One controllerMing-ting Yao Wei
This adds rumble support for Xbox One controller by sending continuous rumble command. Trigger button rumbling is not yet implemented. Signed-off-by: Ming-ting Yao Wei <mwei@lxde.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-12-15Merge branch 'next' into for-linusDmitry Torokhov
Prepare input updates for 3.19.
2014-12-03Input: initialize device counter variables with -1Aniroop Mathur
Let's initialize atomic_t variables keeping track of number of various devices created so far with -1 in order to avoid extra subtraction operation. Signed-off-by: Aniroop Mathur <aniroop.mathur@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-11-25Input: xpad - use proper endpoint typeGreg Kroah-Hartman
The xpad wireless endpoint is not a bulk endpoint on my devices, but rather an interrupt one, so the USB core complains when it is submitted. I'm guessing that the author really did mean that this should be an interrupt urb, but as there are a zillion different xpad devices out there, let's cover out bases and handle both bulk and interrupt endpoints just as easily. Signed-off-by: "Pierre-Loup A. Griffais" <pgriffais@valvesoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: stable <stable@vger.kernel.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-10-16Input: xpad - add Thrustmaster as Xbox 360 controller vendorTommi Rantala
Add Thrustmaster as Xbox 360 controller vendor. This is required for example to make the GP XID (044f:b326) gamepad work. Signed-off-by: Tommi Rantala <tt.rantala@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-10-16Input: xpad - add USB ID for Thrustmaster Ferrari 458 Racing WheelTommi Rantala
Add the USB ID for the Xbox 360 Thrustmaster Ferrari 458 Racing Wheel. Signed-off-by: Tommi Rantala <tt.rantala@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-09-08Input: xpad - sync device IDs with xboxdrvBenjamin Valentin
The userspace xboxdrv driver knows some more device ids than the kernel. This patch adds the missing xbox gamepads from [1] to xpad.c [1] https://github.com/Grumbel/xboxdrv/blob/master/src/xpad_device.cpp Signed-off-by: Benjamin Valentin <benpicco@zedat.fu-berlin.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-09-08Input: xpad - add VID/PID for Razer SabertoothFrank Razenberg
The xpad driver recognizes Razer Sabertooth controllers as generic xbox controller, while it is really a 360 controller. This patch adds pid/vid mappings for the controller so that it is correctly recognized. Signed-off-by: Frank Razenberg <frank@zzattack.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-08-13Input: xpad - add support for Xbox One controllersTed Mielczarek
Xbox One controllers require an initialization message to start sending data, so xpad_init_output becomes a required function. The Xbox One controller does not have LEDs like the Xbox 360 controller, so that functionality is not implemented. The format of messages controlling rumble is currently undocumented, so rumble support is not yet implemented. Note that Xbox One controller advertises three interfaces with the same interface class, subclass and protocol, so we have to also match against interface number. Signed-off-by: Ted Mielczarek <ted@mielczarek.org> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-01-23Merge branch 'next' into for-linusDmitry Torokhov
First round of input updates for 3.14.
2014-01-06Input: delete non-required instances of include <linux/init.h>Paul Gortmaker
None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-01-02Input: xpad - add new USB IDs for Logitech F310 and F710Petr Sebor
This enables the rumble force feedback on the F710 unit since it is no longer treated as XTYPE_UNKNOWN type. Signed-off-by: Petr Sebor <petr@scssoft.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2014-01-02Input: xpad - change D-PAD mapping on Razer devicesThomaz de Oliveira dos Reis
When using Razer Onza controller the dpad doesn't work in many games because D-PAD was mapped to buttons (useful for dance pads) and not to HAT0X/Y axis. ers who really want to have it mapped to buttons can restore previous behavior by using 'dpad_to_buttons' module option. Signed-off-by: Thomaz de Oliveira dos Reis <thor27@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2013-08-26Input: xpad - add signature for Razer Onza Classic EditionMag
Signed-off-by: Nol "Mag" Archinova <magissia@magissia.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2013-06-18Input: xpad - fix for "Mad Catz Street Fighter IV FightPad" controllersShawn Joseph
Added MAP_TRIGGERS_TO_BUTTONS for Mad Catz Street Fighter IV FightPad device. This controller model was already supported by the xpad driver, but none of the buttons work correctly without this change. Tested on kernel version 3.9.5. Signed-off-by: Shawn Joseph <jms.576@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-12-03Input: xpad - add a few new VID/PID combinationsGuillermo A. Amaral
This adds VID/PID combinations for MadCatz, PDP and PowerA (new). Removed Pelican 'TSZ' Wired Xbox 360 Controller since it's clashing with Edge wireless Controller and I failed to confirm the PID. Signed-off-by: "Guillermo A. Amaral B." <g@maral.me> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-12-03Input: xpad - minor formatting fixesGuillermo A. Amaral
Fixed a few minor coding style issues in xpad driver. Signed-off-by: "Guillermo A. Amaral B." <g@maral.me> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-07-24Merge branch 'next' into for-linusDmitry Torokhov
2012-07-12Input: xpad - add Andamiro Pump It Up padYuri Khan
I couldn't find the vendor ID in any of the online databases, but this mat has a Pump It Up logo on the top side of the controller compartment, and a disclaimer stating that Andamiro will not be liable on the bottom. Signed-off-by: Yuri Khan <yurivkhan@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-07-11Input: xpad - add signature for Razer Onza Tournament EditionIlia Katsnelson
Signed-off-by: Ilia Katsnelson <k0009000@gmail.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-07-11Input: xpad - handle all variations of Mad Catz Beat PadYuri Khan
The device should be handled by xpad driver instead of generic HID driver. Signed-off-by: Yuri Khan <yurivkhan@gmail.com> Acked-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
2012-05-04USB: input: xpad.c: fix up dev_* messagesGreg Kroah-Hartman
Previously I had made the struct device point to the input device, but after talking with Dmitry, he said that the USB device would make more sense for this driver to point to. So converted it to use that instead. CC: Dmitry Torokhov <dmitry.torokhov@gmail.com> CC: "Magnus Hörlin" <magnus@alefors.se> CC: Rusty Russell <rusty@rustcorp.com.au> CC: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-01USB: xpad.c: remove dbg() usageGreg Kroah-Hartman
dbg() was a very old USB-specific macro that should no longer be used. This patch removes it from being used in the driver and uses dev_dbg() instead. CC: Dmitry Torokhov <dmitry.torokhov@gmail.com> CC: "Magnus Hörlin" <magnus@alefors.se> CC: Rusty Russell <rusty@rustcorp.com.au> CC: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-05-01USB: input: xpad.c: fix up dev_err() usageGreg Kroah-Hartman
We should always reference the input device for dev_err(), not the USB device. Fix up the places where I got this wrong. Reported-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> CC: "Magnus Hörlin" <magnus@alefors.se> CC: Rusty Russell <rusty@rustcorp.com.au> CC: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-04-25USB: xpad.c: remove err() usageGreg Kroah-Hartman
err() was a very old USB-specific macro that I thought had gone away. This patch removes it from being used in the driver and uses dev_err() instead. CC: Dmitry Torokhov <dmitry.torokhov@gmail.com> CC: "Magnus Hörlin" <magnus@alefors.se> CC: Rusty Russell <rusty@rustcorp.com.au> CC: Mauro Carvalho Chehab <mchehab@redhat.com> CC: Chris Moeller <kode54@gmail.c> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-01-13module_param: make bool parameters really bool (drivers & misc)Rusty Russell
module_param(bool) used to counter-intuitively take an int. In fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy trick. It's time to remove the int/unsigned int option. For this version it'll simply give a warning, but it'll break next kernel version. Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-11-18USB: convert drivers/input/* to use module_usb_driver()Greg Kroah-Hartman
This converts the drivers in drivers/input/* to use the module_usb_driver() macro which makes the code smaller and a bit simpler. Added bonus is that it removes some unneeded kernel log messages about drivers loading and/or unloading. Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Ville Syrjala <syrjala@sci.fi> Cc: Henk Vergonet <Henk.Vergonet@gmail.com> Cc: Alessandro Rubini <rubini@ipvvis.unipv.it> Cc: Henrik Rydberg <rydberg@euromail.se> Cc: "Magnus Hörlin" <magnus@alefors.se> Cc: Chris Moeller <kode54@gmail.c> Cc: Christoph Fritz <chf.fritz@googlemail.com> Cc: Lucas De Marchi <lucas.demarchi@profusion.mobi> Cc: Jesper Juhl <jj@chaosbits.net> Cc: Edwin van Vliet <edwin@cheatah.nl> Cc: Ping Cheng <pingc@wacom.com> Cc: Eduard Hasenleithner <eduard@hasenleithner.at> Cc: Alexander Strakh <strakh@ispras.ru> Cc: Glenn Sommer <gsommer@datanordisk.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-07-04Input: xpad - enable rumble support for XBox360 Wireless ControllersChris Moeller
This patch implements rumble support for XBox360 Wireless Controllers. Signed-off-by: Chris Moeller <kode54@gmail.c> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2011-06-21Input: xpad - add support for two more dance pads and a guitarMagnus Hörlin
Signed-off-by: Magnus Hörlin <magnus@alefors.se> Reviewed-by: Christoph Fritz <chf.fritz@googlemail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-11-18Input: xpad - ensure xpad->bulk_out is initialized before submitting urbAxel Lin
As pointed out by Oliver Neukum: xpad->irq_in is currently submitted before xpad->bulk_out is allocated. That however is a race, because the callback for irq_in can call xpad360w_process_packet(), which will in turn submit the bulk URB. This patch moves initialization for xpad->bulk_out earlier, so we can ensure xpad->bulk_out is initialized before submitting urb. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-11-11Input: xpad - remove useless check in xpad_removeDmitry Torokhov
ixpad can never be NULL here; if it is NULL we would not have been bound to the interface and then why would we be called? Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-11-11Input: xpad - fix resource reclaim in xpad_probe error pathAxel Lin
Properly free the resources in error path by the reverse order of resource allocation. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-11-11Input: xpad - fix a memory leakAxel Lin
In xpad_led_disconnect(), what we really want is to kfree(xpad_led). In xpad_disconnect(), add a missing kfree(xpad->bdata) to fix the memory leak. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-11-11Input: xpad - return proper error in error pathAxel Lin
In current implementation, xpad_probe return 0 when usb_alloc_urb failed for xpad->bulk_out and kzalloc failed for xpad->bdata. This patch removes the initialization for error variable, assign the error code at the place the error happens instead. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-08-10Merge branch 'next' into for-linusDmitry Torokhov
2010-08-10Input: xpad - add USB-ID for PL-3601 Xbox 360 padChristoph Fritz
This patch adds USB Vendor and Product ID for Pelican PL-3601 'TSZ' Wired Xbox 360 Controller to the device table. Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
2010-08-02Merge branch 'next' into for-linusDmitry Torokhov
2010-07-26Input: xpad - add product ID for Hori Fighting Stick EX2Chris Merrett
Signed-off-by: Chris Merrett <chrisfu@hardc0re.org.uk> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>