All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] HID: ACRUX - fix enabling force feedback support
@ 2011-08-04  7:25 Dmitry Torokhov
  2011-08-04  7:25 ` [PATCH 2/2] HID: ACRUX - handle gamepads with different report layout Dmitry Torokhov
  2011-08-04 13:26 ` [PATCH 1/2] HID: ACRUX - fix enabling force feedback support Jiri Kosina
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2011-08-04  7:25 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-input, Sergei Kolzun

From: Sergei Kolzun <x0r@dv-life.ru>

The config option needs to be a 'bool' and not a tristate, otheriwse
force feedback support never makes it into the module.

Signed-off-by: Sergei Kolzun <x0r@dv-life.ru>
Cc: stable@kernel.org
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
 drivers/hid/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 36ca465..a1f3c0d 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -69,7 +69,7 @@ config HID_ACRUX
 	Say Y here if you want to enable support for ACRUX game controllers.
 
 config HID_ACRUX_FF
-	tristate "ACRUX force feedback support"
+	bool "ACRUX force feedback support"
 	depends on HID_ACRUX
 	select INPUT_FF_MEMLESS
 	---help---
-- 
1.7.6


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

* [PATCH 2/2] HID: ACRUX - handle gamepads with different report layout
  2011-08-04  7:25 [PATCH 1/2] HID: ACRUX - fix enabling force feedback support Dmitry Torokhov
@ 2011-08-04  7:25 ` Dmitry Torokhov
  2011-08-04 13:26 ` [PATCH 1/2] HID: ACRUX - fix enabling force feedback support Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2011-08-04  7:25 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-input, Sergei Kolzun

From: Sergei Kolzun <x0r@dv-life.ru>

There are gamepads that share the same VID and PID but have different
report structure - instead of having 4 fields with one value they have
one field that can hold all 4 values. Make the driver cope with devices
using both styles.

Signed-off-by: Sergei Kolzun <x0r@dv-life.ru>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
 drivers/hid/hid-axff.c |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/drivers/hid/hid-axff.c b/drivers/hid/hid-axff.c
index b455428..ef32aef 100644
--- a/drivers/hid/hid-axff.c
+++ b/drivers/hid/hid-axff.c
@@ -6,7 +6,7 @@
  * Xbox 360 controller.
  *
  * 1a34:0802 "ACRUX USB GAMEPAD 8116"
- *  - tested with a EXEQ EQ-PCU-02090 game controller.
+ *  - tested with an EXEQ EQ-PCU-02090 game controller.
  *
  * Copyright (c) 2010 Sergei Kolzun <x0r@dv-life.ru>
  */
@@ -45,7 +45,10 @@ static int axff_play(struct input_dev *dev, void *data, struct ff_effect *effect
 {
 	struct hid_device *hid = input_get_drvdata(dev);
 	struct axff_device *axff = data;
+	struct hid_report *report = axff->report;
+	int field_count = 0;
 	int left, right;
+	int i, j;
 
 	left = effect->u.rumble.strong_magnitude;
 	right = effect->u.rumble.weak_magnitude;
@@ -55,10 +58,14 @@ static int axff_play(struct input_dev *dev, void *data, struct ff_effect *effect
 	left = left * 0xff / 0xffff;
 	right = right * 0xff / 0xffff;
 
-	axff->report->field[0]->value[0] = left;
-	axff->report->field[1]->value[0] = right;
-	axff->report->field[2]->value[0] = left;
-	axff->report->field[3]->value[0] = right;
+	for (i = 0; i < report->maxfield; i++) {
+		for (j = 0; j < report->field[i]->report_count; j++) {
+			report->field[i]->value[j] =
+				field_count % 2 ? right : left;
+			field_count++;
+		}
+	}
+
 	dbg_hid("running with 0x%02x 0x%02x", left, right);
 	usbhid_submit_report(hid, axff->report, USB_DIR_OUT);
 
@@ -72,6 +79,8 @@ static int axff_init(struct hid_device *hid)
 	struct hid_input *hidinput = list_first_entry(&hid->inputs, struct hid_input, list);
 	struct list_head *report_list =&hid->report_enum[HID_OUTPUT_REPORT].report_list;
 	struct input_dev *dev = hidinput->input;
+	int field_count = 0;
+	int i, j;
 	int error;
 
 	if (list_empty(report_list)) {
@@ -80,9 +89,16 @@ static int axff_init(struct hid_device *hid)
 	}
 
 	report = list_first_entry(report_list, struct hid_report, list);
+	for (i = 0; i < report->maxfield; i++) {
+		for (j = 0; j < report->field[i]->report_count; j++) {
+			report->field[i]->value[j] = 0x00;
+			field_count++;
+		}
+	}
 
-	if (report->maxfield < 4) {
-		hid_err(hid, "no fields in the report: %d\n", report->maxfield);
+	if (field_count < 4) {
+		hid_err(hid, "not enough fields in the report: %d\n",
+			field_count);
 		return -ENODEV;
 	}
 
@@ -97,13 +113,9 @@ static int axff_init(struct hid_device *hid)
 		goto err_free_mem;
 
 	axff->report = report;
-	axff->report->field[0]->value[0] = 0x00;
-	axff->report->field[1]->value[0] = 0x00;
-	axff->report->field[2]->value[0] = 0x00;
-	axff->report->field[3]->value[0] = 0x00;
 	usbhid_submit_report(hid, axff->report, USB_DIR_OUT);
 
-	hid_info(hid, "Force Feedback for ACRUX game controllers by Sergei Kolzun<x0r@dv-life.ru>\n");
+	hid_info(hid, "Force Feedback for ACRUX game controllers by Sergei Kolzun <x0r@dv-life.ru>\n");
 
 	return 0;
 
-- 
1.7.6


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

* Re: [PATCH 1/2] HID: ACRUX - fix enabling force feedback support
  2011-08-04  7:25 [PATCH 1/2] HID: ACRUX - fix enabling force feedback support Dmitry Torokhov
  2011-08-04  7:25 ` [PATCH 2/2] HID: ACRUX - handle gamepads with different report layout Dmitry Torokhov
@ 2011-08-04 13:26 ` Jiri Kosina
  1 sibling, 0 replies; 3+ messages in thread
From: Jiri Kosina @ 2011-08-04 13:26 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, Sergei Kolzun

On Thu, 4 Aug 2011, Dmitry Torokhov wrote:

> From: Sergei Kolzun <x0r@dv-life.ru>
> 
> The config option needs to be a 'bool' and not a tristate, otheriwse
> force feedback support never makes it into the module.
> 
> Signed-off-by: Sergei Kolzun <x0r@dv-life.ru>
> Cc: stable@kernel.org
> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
> ---
>  drivers/hid/Kconfig |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
> index 36ca465..a1f3c0d 100644
> --- a/drivers/hid/Kconfig
> +++ b/drivers/hid/Kconfig
> @@ -69,7 +69,7 @@ config HID_ACRUX
>  	Say Y here if you want to enable support for ACRUX game controllers.
>  
>  config HID_ACRUX_FF
> -	tristate "ACRUX force feedback support"
> +	bool "ACRUX force feedback support"
>  	depends on HID_ACRUX
>  	select INPUT_FF_MEMLESS
>  	---help---

I have applied both patches, thanks Dmitry and Sergei!

-- 
Jiri Kosina
SUSE Labs

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

end of thread, other threads:[~2011-08-04 13:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-04  7:25 [PATCH 1/2] HID: ACRUX - fix enabling force feedback support Dmitry Torokhov
2011-08-04  7:25 ` [PATCH 2/2] HID: ACRUX - handle gamepads with different report layout Dmitry Torokhov
2011-08-04 13:26 ` [PATCH 1/2] HID: ACRUX - fix enabling force feedback support Jiri Kosina

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.