public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Cameron Gutman <aicommander@gmail.com>
Cc: rojtberg@gmail.com, linux-input@vger.kernel.org,
	kyleabeauchamp@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] Input: xpad - fix PowerA init quirk for some gamepad models
Date: Thu, 31 Aug 2017 11:57:55 -0700	[thread overview]
Message-ID: <20170831185755.GE14370@dtor-ws> (raw)
In-Reply-To: <20170809000135.27359-1-aicommander@gmail.com>

On Tue, Aug 08, 2017 at 05:01:35PM -0700, Cameron Gutman wrote:
> The PowerA gamepad initialization quirk worked with the PowerA
> wired gamepad I had around (0x24c6:0x543a), but a user reported [0]
> that it didn't work for him, even though our gamepads shared the
> same vendor and product IDs.
> 
> When I initially implemented the PowerA quirk, I wanted to avoid
> actually triggering the rumble action during init. My tests showed
> that my gamepad would work correctly even if it received a rumble
> of 0 intensity, so that's what I went with.
> 
> Unfortunately, this apparently isn't true for all models (perhaps
> a firmware difference?). This non-working gamepad seems to require
> the real magic rumble packet that the Microsoft driver sends, which
> actually vibrates the gamepad. To counteract this effect, I still
> send the old zero-rumble PowerA quirk packet which cancels the
> rumble effect before the motors can spin up enough to vibrate.
> 
> [0]: https://github.com/paroj/xpad/issues/48#issuecomment-313904867
> 
> Reported-by: Kyle Beauchamp <kyleabeauchamp@gmail.com>
> Tested-by: Kyle Beauchamp <kyleabeauchamp@gmail.com>
> Fixes: 81093c9848a7 ("Input: xpad - support some quirky Xbox One pads")
> Cc: stable@vger.kernel.org # v4.12
> Signed-off-by: Cameron Gutman <aicommander@gmail.com>
> ---
> Forgot to CC LKML last time, resending to hit the testbots (and people)
> there.

Applied, thank you.

> 
> ---
>  drivers/input/joystick/xpad.c | 24 +++++++++++++++++++-----
>  1 file changed, 19 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index 298a6ba51411..ca0e19ae7a90 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -476,10 +476,21 @@ static const u8 xboxone_hori_init[] = {
>  };
>  
>  /*
> - * A rumble packet is required for some PowerA pads to start
> + * A specific rumble packet is required for some PowerA pads to start
>   * sending input reports. One of those pads is (0x24c6:0x543a).
>   */
> -static const u8 xboxone_zerorumble_init[] = {
> +static const u8 xboxone_rumblebegin_init[] = {
> +	0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00,
> +	0x1D, 0x1D, 0xFF, 0x00, 0x00
> +};
> +
> +/*
> + * A rumble packet with zero FF intensity will immediately
> + * terminate the rumbling required to init PowerA pads.
> + * This should happen fast enough that the motors don't
> + * spin up to enough speed to actually vibrate the gamepad.
> + */
> +static const u8 xboxone_rumbleend_init[] = {
>  	0x09, 0x00, 0x00, 0x09, 0x00, 0x0F, 0x00, 0x00,
>  	0x00, 0x00, 0x00, 0x00, 0x00
>  };
> @@ -494,9 +505,12 @@ static const struct xboxone_init_packet xboxone_init_packets[] = {
>  	XBOXONE_INIT_PKT(0x0e6f, 0x0165, xboxone_hori_init),
>  	XBOXONE_INIT_PKT(0x0f0d, 0x0067, xboxone_hori_init),
>  	XBOXONE_INIT_PKT(0x0000, 0x0000, xboxone_fw2015_init),
> -	XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_zerorumble_init),
> -	XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_zerorumble_init),
> -	XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_zerorumble_init),
> +	XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumblebegin_init),
> +	XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumblebegin_init),
> +	XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumblebegin_init),
> +	XBOXONE_INIT_PKT(0x24c6, 0x541a, xboxone_rumbleend_init),
> +	XBOXONE_INIT_PKT(0x24c6, 0x542a, xboxone_rumbleend_init),
> +	XBOXONE_INIT_PKT(0x24c6, 0x543a, xboxone_rumbleend_init),
>  };
>  
>  struct xpad_output_packet {
> -- 
> 2.13.4
> 

-- 
Dmitry

      reply	other threads:[~2017-08-31 18:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09  0:01 [PATCH RESEND] Input: xpad - fix PowerA init quirk for some gamepad models Cameron Gutman
2017-08-31 18:57 ` Dmitry Torokhov [this message]

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=20170831185755.GE14370@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=aicommander@gmail.com \
    --cc=kyleabeauchamp@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox