linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] xpad: Add rumble support for Xbox One controller
@ 2015-04-13  8:21 Ming-ting Yao Wei
  2015-04-13  8:21 ` [PATCH 2/2] xpad: Kudos to the reverse-engineering work Ming-ting Yao Wei
  0 siblings, 1 reply; 4+ messages in thread
From: Ming-ting Yao Wei @ 2015-04-13  8:21 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Ming-ting Yao Wei, linux-input

This adds rumble support for Xbox One controller. Tested with fftest.

---
 drivers/input/joystick/xpad.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 3aa2f3f..9b08c47 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -828,6 +828,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 +858,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)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] xpad: Kudos to the reverse-engineering work
  2015-04-13  8:21 [PATCH 1/2] xpad: Add rumble support for Xbox One controller Ming-ting Yao Wei
@ 2015-04-13  8:21 ` Ming-ting Yao Wei
  2015-04-14 17:19   ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Ming-ting Yao Wei @ 2015-04-13  8:21 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Ming-ting Yao Wei, linux-input

This adds credits to the reverse engineering work.

---
 drivers/input/joystick/xpad.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 9b08c47..882b528 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -10,6 +10,7 @@
  *               2006 Adam Buchbinder <adam.buchbinder@gmail.com>
  *               2007 Jan Kratochvil <honza@jikos.cz>
  *               2010 Christoph Fritz <chf.fritz@googlemail.com>
+ *               2015 Ming-ting Yao Wei <mwei@lxde.org>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -31,6 +32,7 @@
  *  - 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
-- 
2.3.2 (Apple Git-55)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] xpad: Kudos to the reverse-engineering work
  2015-04-13  8:21 ` [PATCH 2/2] xpad: Kudos to the reverse-engineering work Ming-ting Yao Wei
@ 2015-04-14 17:19   ` Dmitry Torokhov
  2015-04-14 17:21     ` Dmitry Torokhov
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Torokhov @ 2015-04-14 17:19 UTC (permalink / raw)
  To: Ming-ting Yao Wei; +Cc: linux-input

Hi Ming-ting,

On Mon, Apr 13, 2015 at 04:21:35PM +0800, Ming-ting Yao Wei wrote:
> This adds credits to the reverse engineering work.

I squashed this into the previous patch (1/2) and applied.

Thank you.

> 
> ---
>  drivers/input/joystick/xpad.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> index 9b08c47..882b528 100644
> --- a/drivers/input/joystick/xpad.c
> +++ b/drivers/input/joystick/xpad.c
> @@ -10,6 +10,7 @@
>   *               2006 Adam Buchbinder <adam.buchbinder@gmail.com>
>   *               2007 Jan Kratochvil <honza@jikos.cz>
>   *               2010 Christoph Fritz <chf.fritz@googlemail.com>
> + *               2015 Ming-ting Yao Wei <mwei@lxde.org>
>   *
>   * This program is free software; you can redistribute it and/or
>   * modify it under the terms of the GNU General Public License as
> @@ -31,6 +32,7 @@
>   *  - 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
> -- 
> 2.3.2 (Apple Git-55)
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] xpad: Kudos to the reverse-engineering work
  2015-04-14 17:19   ` Dmitry Torokhov
@ 2015-04-14 17:21     ` Dmitry Torokhov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2015-04-14 17:21 UTC (permalink / raw)
  To: Ming-ting Yao Wei; +Cc: linux-input

On Tue, Apr 14, 2015 at 10:19:25AM -0700, Dmitry Torokhov wrote:
> Hi Ming-ting,
> 
> On Mon, Apr 13, 2015 at 04:21:35PM +0800, Ming-ting Yao Wei wrote:
> > This adds credits to the reverse engineering work.
> 
> I squashed this into the previous patch (1/2) and applied.
> 
> Thank you.

Oh, wait, I need your "Signed-off-by", please.

> 
> > 
> > ---
> >  drivers/input/joystick/xpad.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
> > index 9b08c47..882b528 100644
> > --- a/drivers/input/joystick/xpad.c
> > +++ b/drivers/input/joystick/xpad.c
> > @@ -10,6 +10,7 @@
> >   *               2006 Adam Buchbinder <adam.buchbinder@gmail.com>
> >   *               2007 Jan Kratochvil <honza@jikos.cz>
> >   *               2010 Christoph Fritz <chf.fritz@googlemail.com>
> > + *               2015 Ming-ting Yao Wei <mwei@lxde.org>
> >   *
> >   * This program is free software; you can redistribute it and/or
> >   * modify it under the terms of the GNU General Public License as
> > @@ -31,6 +32,7 @@
> >   *  - 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
> > -- 
> > 2.3.2 (Apple Git-55)
> > 
> 
> -- 
> Dmitry

-- 
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-14 17:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-13  8:21 [PATCH 1/2] xpad: Add rumble support for Xbox One controller Ming-ting Yao Wei
2015-04-13  8:21 ` [PATCH 2/2] xpad: Kudos to the reverse-engineering work Ming-ting Yao Wei
2015-04-14 17:19   ` Dmitry Torokhov
2015-04-14 17:21     ` Dmitry Torokhov

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).