From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Ming-ting Yao Wei <mwei@lxde.org>
Cc: linux-input@vger.kernel.org
Subject: Re: [PATCH v2] xpad: Add rumble support for Xbox One controller
Date: Tue, 14 Apr 2015 17:00:03 -0700 [thread overview]
Message-ID: <20150415000003.GB22757@dtor-ws> (raw)
In-Reply-To: <1429048261-13002-1-git-send-email-mwei@lxde.org>
On Wed, Apr 15, 2015 at 05:51:01AM +0800, Ming-ting Yao Wei wrote:
> This adds rumble support for Xbox One controller by sending continuous rumble
> command. Trigger button rumbling does not yet implemented.
>
> Signed-off-by: Ming-ting Yao Wei <mwei@lxde.org>
>
Applied, thank you.
> ---
> drivers/input/joystick/xpad.c | 21 ++++++++++++++++++++-
> 1 file changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index 3aa2f3f..61c7611 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -31,12 +31,14 @@
> * - the iForce driver drivers/char/joystick/iforce.c
> * - the skeleton-driver drivers/usb/usb-skeleton.c
> * - Xbox 360 information http://www.free60.org/wiki/Gamepad
> + * - Xbox One information https://github.com/quantus/xbox-one-controller-protocol
> *
> * Thanks to:
> * - ITO Takayuki for providing essential xpad information on his website
> * - Vojtech Pavlik - iforce driver / input subsystem
> * - Greg Kroah-Hartman - usb-skeleton driver
> * - XBOX Linux project - extra USB id's
> + * - Pekka Pöyry (quantus) - Xbox One controller reverse engineering
> *
> * TODO:
> * - fine tune axes (especially trigger axes)
> @@ -828,6 +830,23 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect
>
> return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
>
> + case XTYPE_XBOXONE:
> + xpad->odata[0] = 0x09; /* activate rumble */
> + xpad->odata[1] = 0x08;
> + xpad->odata[2] = 0x00;
> + xpad->odata[3] = 0x08; /* continuous effect */
> + xpad->odata[4] = 0x00; /* simple rumble mode */
> + xpad->odata[5] = 0x03; /* L and R actuator only */
> + xpad->odata[6] = 0x00; /* TODO: LT actuator */
> + xpad->odata[7] = 0x00; /* TODO: RT actuator */
> + xpad->odata[8] = strong / 256; /* left actuator */
> + xpad->odata[9] = weak / 256; /* right actuator */
> + xpad->odata[10] = 0x80; /* length of pulse */
> + xpad->odata[11] = 0x00; /* stop period of pulse */
> + xpad->irq_out->transfer_buffer_length = 12;
> +
> + return usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
> +
> default:
> dev_dbg(&xpad->dev->dev,
> "%s - rumble command sent to unsupported xpad type: %d\n",
> @@ -841,7 +860,7 @@ static int xpad_play_effect(struct input_dev *dev, void *data, struct ff_effect
>
> static int xpad_init_ff(struct usb_xpad *xpad)
> {
> - if (xpad->xtype == XTYPE_UNKNOWN || xpad->xtype == XTYPE_XBOXONE)
> + if (xpad->xtype == XTYPE_UNKNOWN)
> return 0;
>
> input_set_capability(xpad->dev, EV_FF, FF_RUMBLE);
> --
> 2.3.2 (Apple Git-55)
>
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2015-04-15 0:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-14 21:51 [PATCH v2] xpad: Add rumble support for Xbox One controller Ming-ting Yao Wei
2015-04-15 0:00 ` 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=20150415000003.GB22757@dtor-ws \
--to=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=mwei@lxde.org \
/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;
as well as URLs for NNTP newsgroup(s).