All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Pavel Rojtberg <rojtberg@gmail.com>
Cc: linux-input@vger.kernel.org, pgriffais@valvesoftware.com,
	gregkh@linuxfoundation.org
Subject: Re: [PATCH 06/15] Input: xpad: x360w: report dpad as buttons and axes
Date: Sat, 10 Oct 2015 09:45:51 -0700	[thread overview]
Message-ID: <20151010164551.GG39573@dtor-ws> (raw)
In-Reply-To: <1443733046-29610-7-git-send-email-rojtberg@gmail.com>

On Thu, Oct 01, 2015 at 10:57:17PM +0200, Pavel Rojtberg wrote:
> From: Pavel Rojtberg <rojtberg@gmail.com>
> 
> 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 compability 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>

Applied, thank you.

> ---
>  drivers/input/joystick/xpad.c | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index 1195dbb..15da2a3 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -436,7 +436,14 @@ static void xpad360_process_packet(struct usb_xpad *xpad,
>  		input_report_key(dev, BTN_TRIGGER_HAPPY2, data[2] & 0x08);
>  		input_report_key(dev, BTN_TRIGGER_HAPPY3, data[2] & 0x01);
>  		input_report_key(dev, BTN_TRIGGER_HAPPY4, data[2] & 0x02);
> -	} else {
> +	}
> +	/* this should be a simple else block. However historically xbox360w
> +	 * has mapped DPAD to buttons while xbox360 did not.
> +	 * This made no sense, but now we can not just switch back and have to
> +	 * support both behaviors.
> +	 */
> +	if (!(xpad->mapping & MAP_DPAD_TO_BUTTONS) ||
> +			xpad->xtype == XTYPE_XBOX360W) {
>  		input_report_abs(dev, ABS_HAT0X,
>  				 !!(data[2] & 0x08) - !!(data[2] & 0x04));
>  		input_report_abs(dev, ABS_HAT0Y,
> @@ -1144,7 +1151,14 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
>  	if (xpad->mapping & MAP_DPAD_TO_BUTTONS) {
>  		for (i = 0; xpad_btn_pad[i] >= 0; i++)
>  			__set_bit(xpad_btn_pad[i], input_dev->keybit);
> -	} else {
> +	}
> +	/* this should be a simple else block. However historically xbox360w
> +	 * has mapped DPAD to buttons while xbox360 did not.
> +	 * This made no sense, but now we can not just switch back and have to
> +	 * support both behaviors.
> +	 */
> +	if(!(xpad->mapping & MAP_DPAD_TO_BUTTONS) ||
> +			xpad->xtype == XTYPE_XBOX360W) {
>  		for (i = 0; xpad_abs_pad[i] >= 0; i++)
>  			xpad_set_up_abs(input_dev, xpad_abs_pad[i]);
>  	}
> -- 
> 1.9.1
> 

-- 
Dmitry

  reply	other threads:[~2015-10-10 16:45 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-01 20:57 [PATCH 00/15] Input: xpad: updates Pavel Rojtberg
2015-10-01 20:57 ` [PATCH 01/15] Input: xpad: add Covert Forces edition of the Xbox One controller Pavel Rojtberg
2015-10-10 16:42   ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 02/15] Input: xpad: fix Razer Atrox Arcade Stick button mapping Pavel Rojtberg
2015-10-10 16:43   ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 03/15] Input: xpad: clarify LED enumeration Pavel Rojtberg
2015-10-10 16:44   ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 04/15] Input: xpad: remove needless bulk out URB used for LED setup Pavel Rojtberg
2015-10-10 16:45   ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 05/15] Input: xpad: factor out URB submission in xpad_play_effect Pavel Rojtberg
2015-10-10 16:45   ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 06/15] Input: xpad: x360w: report dpad as buttons and axes Pavel Rojtberg
2015-10-10 16:45   ` Dmitry Torokhov [this message]
2015-10-01 20:57 ` [PATCH 07/15] Input: xpad: move the input device creation to a new function Pavel Rojtberg
2015-10-10 18:00   ` Dmitry Torokhov
2015-10-15 19:19     ` Pavel Rojtberg
2015-10-17 16:49       ` Dmitry Torokhov
2015-10-17 18:08         ` Pavel Rojtberg
2015-10-01 20:57 ` [PATCH 08/15] Input: xpad: query Wireless controller state at init Pavel Rojtberg
2015-10-01 20:57 ` [PATCH 09/15] Input: xpad: handle "present" and "gone" correctly Pavel Rojtberg
2015-10-10 16:42   ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 10/15] Input: xpad: use ida() for finding the pad_nr Pavel Rojtberg
2015-10-01 22:53   ` Pavel Rojtberg
2015-10-10 17:06     ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 11/15] Input: xpad: do not submit active URBs Pavel Rojtberg
2015-10-01 20:57 ` [PATCH 12/15] Input: xpad: replace mutex by spinlock Pavel Rojtberg
2015-10-10 18:10   ` Dmitry Torokhov
2015-10-01 20:57 ` [PATCH 13/15] Input: xpad: re-submit pending ff and led requests Pavel Rojtberg
2015-10-01 20:57 ` [PATCH 14/15] Input: xpad: workaround dead irq_out after suspend/ resume Pavel Rojtberg
2015-10-01 20:57 ` [PATCH 15/15] Input: xpad: update Xbox One Force Feedback Support Pavel Rojtberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151010164551.GG39573@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-input@vger.kernel.org \
    --cc=pgriffais@valvesoftware.com \
    --cc=rojtberg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.