rpms/kernel/devel linux-2.6-input-hid-extra-gamepad.patch, NONE, 1.1 kernel.spec, 1.1405, 1.1406

Dave Jones davej at fedoraproject.org
Tue Mar 10 15:35:02 UTC 2009


Author: davej

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv7574

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-input-hid-extra-gamepad.patch 
Log Message:
HID: add support for another version of 0e8f:0003 device in hid-pl

linux-2.6-input-hid-extra-gamepad.patch:

--- NEW FILE linux-2.6-input-hid-extra-gamepad.patch ---
>From 28b692b039a477e92fd9bff8ece163a647b9c490 Mon Sep 17 00:00:00 2001
From: Anssi Hannula <anssi.hannula at gmail.com>
Date: Fri, 27 Feb 2009 23:47:00 +0200
Subject: [PATCH] HID: add support for another version of 0e8f:0003 device in hid-pl

Add support for another version of 0e8f:0003 device into hid-pl driver.
This device has the values in separate fields and resembles devices
handled by hid-zpff.

Signed-off-by: Anssi Hannula <anssi.hannula at gmail.com>
Tested-by: Pantelis Koukousoulas <pktoss at gmail.com>
Signed-off-by: Jiri Kosina <jkosina at suse.cz>
---
 drivers/hid/hid-pl.c |   50 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/drivers/hid/hid-pl.c b/drivers/hid/hid-pl.c
index 46941f9..9ad76bf 100644
--- a/drivers/hid/hid-pl.c
+++ b/drivers/hid/hid-pl.c
@@ -9,9 +9,12 @@
  *   - contains two reports, one for each port (HID_QUIRK_MULTI_INPUT)
  *
  *  0e8f:0003 "GreenAsia Inc.    USB Joystick     "
- *   - tested with K??ng Gaming gamepad
+ *   - tested with König Gaming gamepad
  *
- *  Copyright (c) 2007 Anssi Hannula <anssi.hannula at gmail.com>
+ *  0e8f:0003 "GASIA USB Gamepad"
+ *   - another version of the König gamepad
+ *
+ *  Copyright (c) 2007, 2009 Anssi Hannula <anssi.hannula at gmail.com>
  */
 
 /*
@@ -46,6 +49,8 @@
 
 struct plff_device {
 	struct hid_report *report;
+	s32 *strong;
+	s32 *weak;
 };
 
 static int hid_plff_play(struct input_dev *dev, void *data,
@@ -62,8 +67,8 @@ static int hid_plff_play(struct input_dev *dev, void *data,
 	left = left * 0x7f / 0xffff;
 	right = right * 0x7f / 0xffff;
 
-	plff->report->field[0]->value[2] = left;
-	plff->report->field[0]->value[3] = right;
+	*plff->strong = left;
+	*plff->weak = right;
 	debug("running with 0x%02x 0x%02x", left, right);
 	usbhid_submit_report(hid, plff->report, USB_DIR_OUT);
 
@@ -80,6 +85,8 @@ static int plff_init(struct hid_device *hid)
 	struct list_head *report_ptr = report_list;
 	struct input_dev *dev;
 	int error;
+	s32 *strong;
+	s32 *weak;
 
 	/* The device contains one output report per physical device, all
 	   containing 1 field, which contains 4 ff00.0002 usages and 4 16bit
@@ -87,7 +94,12 @@ static int plff_init(struct hid_device *hid)
 
 	   The input reports also contain a field which contains
 	   8 ff00.0001 usages and 8 boolean values. Their meaning is
-	   currently unknown. */
+	   currently unknown.
+	   
+	   A version of the 0e8f:0003 exists that has all the values in
+	   separate fields and misses the extra input field, thus resembling
+	   Zeroplus (hid-zpff) devices.
+	*/
 
 	if (list_empty(report_list)) {
 		dev_err(&hid->dev, "no output reports found\n");
@@ -110,8 +122,21 @@ static int plff_init(struct hid_device *hid)
 			return -ENODEV;
 		}
 
-		if (report->field[0]->report_count < 4) {
-			dev_err(&hid->dev, "not enough values in the field\n");
+		if (report->field[0]->report_count >= 4) {
+			report->field[0]->value[0] = 0x00;
+			report->field[0]->value[1] = 0x00;
+			strong = &report->field[0]->value[2];
+			weak = &report->field[0]->value[3];
+			debug("detected single-field device");
+		} else if (report->maxfield >= 4 && report->field[0]->maxusage == 1 &&
+				report->field[0]->usage[0].hid == (HID_UP_LED | 0x43)) {
+			report->field[0]->value[0] = 0x00;
+			report->field[1]->value[0] = 0x00;
+			strong = &report->field[2]->value[0];
+			weak = &report->field[3]->value[0];
+			debug("detected 4-field device");
+		} else {
+			dev_err(&hid->dev, "not enough fields or values\n");
 			return -ENODEV;
 		}
 
@@ -130,10 +155,11 @@ static int plff_init(struct hid_device *hid)
 		}
 
 		plff->report = report;
-		plff->report->field[0]->value[0] = 0x00;
-		plff->report->field[0]->value[1] = 0x00;
-		plff->report->field[0]->value[2] = 0x00;
-		plff->report->field[0]->value[3] = 0x00;
+		plff->strong = strong;
+		plff->weak = weak;
+
+		*strong = 0x00;
+		*weak = 0x00;
 		usbhid_submit_report(hid, plff->report, USB_DIR_OUT);
 	}
 
@@ -180,7 +206,7 @@ static const struct hid_device_id pl_devices[] = {
 		.driver_data = 1 }, /* Twin USB Joystick */
 	{ HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR),
 		.driver_data = 1 }, /* Twin USB Joystick */
-	{ HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003), }, /* GreenAsia Inc. USB Joystick */
+	{ HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003), },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, pl_devices);
-- 
1.5.6.3



Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.1405
retrieving revision 1.1406
diff -u -r1.1405 -r1.1406
--- kernel.spec	10 Mar 2009 15:12:16 -0000	1.1405
+++ kernel.spec	10 Mar 2009 15:34:31 -0000	1.1406
@@ -624,6 +624,8 @@
 Patch400: linux-2.6-scsi-cpqarray-set-master.patch
 Patch450: linux-2.6-input-kill-stupid-messages.patch
 Patch451: linux-2.6-input-fix-toshiba-hotkeys.patch
+Patch452: linux-2.6-input-hid-extra-gamepad.patch
+
 Patch460: linux-2.6-serial-460800.patch
 Patch510: linux-2.6-silence-noise.patch
 Patch530: linux-2.6-silence-fbcon-logo.patch
@@ -1149,6 +1151,9 @@
 # Get away from having to poll Toshibas
 ApplyPatch linux-2.6-input-fix-toshiba-hotkeys.patch
 
+# HID: add support for another version of 0e8f:0003 device in hid-pl
+ApplyPatch linux-2.6-input-hid-extra-gamepad.patch
+
 # Allow to use 480600 baud on 16C950 UARTs
 ApplyPatch linux-2.6-serial-460800.patch
 # Silence some useless messages that still get printed with 'quiet'
@@ -1810,6 +1815,9 @@
 # and build.
 
 %changelog
+* Tue Mar 10 2009 Dave Jones <davej at redhat.com>
+- HID: add support for another version of 0e8f:0003 device in hid-pl
+
 * Tue Mar 10 2009 Mauro Carvalho Cheahb <mchehab at redhat.com>
 - updates V4L/DVB from linux-next and adds git log summary on patches
 




More information about the fedora-extras-commits mailing list